lomoco-1.0/0000755000175000001440000000000010401325611012136 5ustar gladiacuserslomoco-1.0/src/0000755000175000001440000000000010401325611012725 5ustar gladiacuserslomoco-1.0/src/lomoco.xml0000644000175000001440000002045110401325475014751 0ustar gladiacusers lomoco 1 28 Aug 2005 lomoco Logitech Mouse Control for USB Mice lomoco OPTIONS DESCRIPTION lomoco can configure vendor-specific options on Logitech USB mice (or dual-personality mice plugged into the USB port). A number of recent devices are supported. The program is mostly useful in setting the resolution to 800 cpi or higher on mice that boot at 400 cpi (such as the MX500, MX510, MX1000 etc.), and disabling SmartScroll or Cruise Control for those who would rather use the two extra buttons as ordinary mouse buttons. Hint 1: use a Linux kernel with Event Interface support (the evdev module) if you want full access to the numerous buttons on these mice. Hint 2: on Linux, the usbmouse driver ignores the extra buttons altogether. Don't let it handle your Logitech mice -- use the generic hid driver for USB HID devices instead. EXIT STATUS An exit status of zero indicates successful termination. A non-zero exit status denotes abnormal termination due to an error. OPTIONS lomoco accepts a number of arguments. The following arguments control which device is accessed or modified: -b, --bus=USB-BUS-NUMBER Only apply the command to the specified bus, specified in full (e.g. use -b 001 for bus 1). This is in the same format as reported by lomoco -s (the first column, on the left hand side of the period) or lsusb(1) (next to `Bus'). -d, --dev=USB-DEVICE-NUMBER Only apply the command to the specified bus, specified in full (e.g. use -d 01b for device 27). This is in the same format as reported by lomoco -s (the first column, on the right hand side of the period) or lsusb(1) (next to `Device'). -p, --pid=USB-PRODUCT-ID Only apply the command to the specified USB product ID, specified in hexadecimal and in full (e.g. use -p c025 for an MX-500 optical mouse). Again, you can use lomoco -s or lsusb(1) to get a listing of product IDs (the right hand side of tuples like 046d:xxxx). The following generic actions can be performed: -i, --inquire Obtain and display the status of all supported capabilities for all matching devices. -s, --scan Scan the USB bus and report all matching, supported Logitech mice. The following commands configure wireless receivers and mice with the CSR command set (use lomoco -s to see if yours supports it): -1, --ch1 Set matching devices to channel 1. Please be aware that not all CSR-supporting devices are dual channel. -2, --ch2 Set matching devices to channel 2. -c, --clear Make all matching receivers forget about the mouse connected to it, just as if the "connect" button on the receiver had been pressed for three seconds. -l, --lock Stop the 30 second search for a wireless mouse on all matching receivers. This search is initiated using the -u option, or by pressing the "connect" button on the receiver. -u, --unlock Unlock all matching receivers and initiate a search for any wireless mouse in range. This is the same as pressing the "connect" button on the receiver. The following settings control mouse resolution, for mice with 400, 800, 1200 and 1600 cpi support, and the RES capability. -4, --400 Sets matching devices to a resolution of 400 cpi. -8, --800 Sets matching devices to a resolution of 800 cpi. Very useful on certain Logitech mice (the MX500 is one of them) that boot in 400 cpi. -m, --1200 Sets matching devices to a resolution of 1200 cpi. Very useful on certain Logitech mice (the MX518 is one of them) that boot in 400 cpi. -h, --1600 Sets matching devices to a resolution of 1600 cpi. Very useful on certain Logitech mice (the MX518 is one of them) that boot in 400 cpi. -g, --2000 Sets matching devices to a resolution of 2000 cpi. Very useful on certain Logitech mice (the G5 or G7) that boot in 400 cpi. The following settings control SmartScroll/Cruise Control, for mice that support it (i.e. include the SMS capability). --no-sms Disable SmartScroll/Cruise Control an all matching mice. `Up' and `down' buttons do not also issue wheel events. Useful if you want to use the additional buttons for something else. --sms Enable SmartScroll/Cruise Control an all matching mice. `Up' and `down' buttons will now also issue wheel events (but will also issue their native button events, which user applications are expected to ignore). This is how most mice boot. Other, miscellaneous options: -?, --help List all available options and their meanings. --usage Display brief usage information. -V, --version Show the program's version, credits and licensing. REPORTING BUGS Report bugs to lomoco-dev@lists.linux-gamers.net or #lomoco @ irc.freenode.net SEE ALSO libusb1 AUTHORS Alexios Chouchoulas, Andreas Schneider, Peter Feuerer, Tobias Schleuss. This manual page by Alexios Chouchoulas and Andreas Schneider andreas.schneider@linux-gamers.net. lomoco-1.0/src/Makefile.am0000644000175000001440000000061710401325475014775 0ustar gladiacusers# # Automake description for lomoco # XMLTO = xmlto AM_CFLAGS=-Wall bin_PROGRAMS=lomoco lomoco_SOURCES= \ lomoco.c \ lomoco.h \ cmdline.c \ cmdline.h # # Create Manpages # man_MANS= \ lomoco.1 lomoco.1: lomoco.xml -$(XMLTO) man lomoco.xml EXTRA_DIST = \ lomoco.xml \ $(man_MANS) # Report splint warnings splint: @echo "Running splint on lomoco..." -splint -preproc $(lomoco_SOURCES) lomoco-1.0/src/.splintrc0000644000175000001440000000057110401325475014577 0ustar gladiacusers-I. +unixlib +charindex +charintliteral -realcompare -booltype bool -paramuse -predboolint -nestedextern -Dint8_t=char -Du_int8_t=uchar -Dint16_t=short -Du_int16_t=ushort -Dint32_t=int -Du_int32_t=uint -Dint64_t=long -Du_int64_t=ulong -Din_addr_t=int -Dcaddr_t=short -DPACKAGE=lomoco -DFD_SETSIZE=31 -DB57600=010001 -DB115200=0010011 -DCRTSCTS=0x00020000 -DONLCR=0x00000002 lomoco-1.0/src/cmdline.c0000644000175000001440000002123010401325475014512 0ustar gladiacusers/* cmdline.c - Command-line parser. Copyright (C) 2004 Alexios Chouchoulas Copyright (C) 2005 Andreas Schneider Peter Feuerer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "cmdline.h" /* Option flags and variables. These are initialized in parse_opt. */ command_t command = cmd_none; int set_res = 0; int set_sms = 0; int set_channel = 0; int set_lock = 0; int set_unlock = 0; int set_clear = 0; /*@null@*/char *match_bus = NULL; /*@null@*/char *match_dev = NULL; /*@null@*/int match_pid = 0x0000; /*@null@*/char *local=NULL; /* --local=LOCAL-ENCODING */ /*@null@*/char *remote=NULL; /* --remote=REMOTE-ENCODING */ /*@null@*/char **cmdline=NULL; /* SHELL-COMMAND */ /* prototypes */ static error_t parse_opt (int key, char *arg, struct argp_state *state); static void show_version (FILE *stream, struct argp_state *state); /* The argp functions examine these global variables. */ const char *argp_program_bug_address = ""; void (*argp_program_version_hook) (FILE *, struct argp_state *) = show_version; static char args_doc[] = ""; /* This is the description table for all options argp needs to handle for lomoco */ struct /*@null@*/argp_option options[] = { { NULL, 0, NULL, 0, _("Device Matching"), 0 }, { "bus", 'b', "USB-BUS-NUMBER", 0, "Only apply the command to the specified bus, specified in " "full (e.g. 001 for bus 1)", 0}, { "dev", 'd', "USB-DEV-NUMBER", 0, "Only apply the command to the specified device number, specified " "in full (e.g. 034 for device 34)", 0}, { "pid", 'p', "PRODUCT-ID", 0, "Only apply the command to the specified product ID, specified " "in hexadecimal and in full (e.g. C025 for an MX-500 optical mouse)", 0}, { NULL, 0, NULL, 0, _("Actions"), 0 }, { "scan", 's', NULL, 0, "Scan the USB bus and report any matching, supported Logitech mice", 0}, { "inquire", 'i', NULL, 0, "Obtain and display the status of all supported capabilities " "for all matching devices", 0}, { NULL, 0, NULL, 0, _("Wireless Status Reporting (CSR command set)"), 0 }, { "ch1", '1', NULL, 0, "Set matching devices to channel 1", 0}, { "ch2", '2', NULL, 0, "Set matching devices to channel 2", 0}, { "unlock", 'u', NULL, 0, "Unlock the receiver and search for a wireless mouse in range.", 0}, { "lock", 'l', NULL, 0, "Stop the 30 second search for a wireless mouse.", 0}, { "clear", 'c', NULL, 0, "Make the receiver forget about the mouse connected to it.", 0}, { NULL, 0, NULL, 0, _("Resolution Changing (RES command set)"), 0 }, { "400", '4', NULL, 0, "Set matching devices to a resolution of 400cpi", 0}, { "800", '8', NULL, 0, "Set matching devices to a resolution of 800cpi", 0}, { "1200", 'm', NULL, 0, "Set matching devices to a medium resolution of 1200cpi", 0}, { "1600", 'h', NULL, 0, "Set matching devices to a high resolution of 1600cpi", 0}, { "2000", 'g', NULL, 0, "Set matching devices to a high resolution of 2000cpi", 0}, { NULL, 0, NULL, 0, _("SmartScroll/Cruise Control (SMS command set)"), 0 }, { "sms", KEY_SMS, NULL, 0, "Enable SmartScroll/Cruise Control. 'Up' and 'down' buttons also issue" "wheel up/down events", 0}, { "no-sms", KEY_NO_SMS, NULL, 0, "Disable SmartScroll/Cruise Control. 'Up' and 'down' buttons do " "not also issue wheel events", 0}, { NULL, 0, NULL, 0, NULL, 0 } }; struct /*@null@*/argp argp = { options, parse_opt, args_doc, "Manage vendor-specific features of Logitech USB mice.", NULL, NULL, NULL }; /* * Descripton: Show the version number and copyright information. * * Parameters: * * Return: */ static void show_version (FILE *stream, struct argp_state *state) { /* * Print in small parts whose localizations can hopefully be copied * from other programs. */ fputs(PACKAGE" "VERSION"\n", stream); fprintf(stream, "fork of lmctl written by Alexios Chouchoulas .\n" "Copyright (C) %s %s\n" "Copyright (C) %s %s\n" "This program is free software; you may redistribute it under the terms of\n" "the GNU General Public License. This program has absolutely no warranty.\n" "\n", "2003", "Alexios Chouchoulas", "2005", "Andreas Schneider, Peter Feuerer"); } /* * Description: Parse a single option. Is called by argp_parse and performes steps for * every single option. * * Parameters: key (which option was entered) * *arg (string after option, e.g. -b 001 <-- *arg would contain 001) * *state (TODO) * * Return: */ static error_t parse_opt (int key, char *arg, struct argp_state *state) { int dummy; switch (key) { case 'b': match_bus = strdup (arg); if ((sscanf (arg, "%03d", &dummy) != 1) || (strlen (arg) != 3) || (strspn (arg, "0123456789") != 3)) { fprintf (stderr, "%s: the bus ID must be a three-digit decimal\n" "number (e.g. 005). Use lsusb(1) to see the proper" "format. you must specify the\nUse %s --help for" "usage information.\n", progname, progname); exit (1); } break; case 'd': match_dev = strdup (arg); if ((sscanf (arg, "%03d", &dummy) != 1) || (strlen (arg) != 3) || (strspn (arg, "0123456789") != 3)) { fprintf (stderr, "%s: the device ID must be a three-digit decimal\n" "number (e.g. 005). Use lsusb(1) to see the proper" "format. you must specify the\nUse %s --help for" "usage information.\n", progname, progname); exit (1); } break; case 'p': if ((sscanf (arg, "%x", &match_pid) != 1) || (match_pid > 0xffff) || (match_pid < 0)) { fprintf (stderr, "%s: the product ID must be a hexadecimal " "number (e.g. c025),\nup to four digits long. " "Use lsusb(1) to see the proper format. " "you must\nspecify the\nUse %s --help for " "usage information.\n", progname, progname); exit (1); } break; case 's': /* --scan */ command = cmd_scan; break; case 'i': /* --inquiry */ command = cmd_inquire; break; case '4': /* set the resolution */ case '8': command = cmd_set; set_res = (int) (key - '0') * 100; break; case 'm': command = cmd_set; set_res = (int) (12) * 100; break; case 'h': command = cmd_set; set_res = (int) (16) *100; break; case 'g': command = cmd_set; set_res = (int) (20) *100; break; case '1': /* set the channel */ case '2': command = cmd_set; set_channel = (int) (key - '0'); break; case 'u': command = cmd_set; set_unlock = 1; break; case 'l': command = cmd_set; set_lock = 1; break; case 'c': command = cmd_set; set_clear = 1; break; case KEY_SMS: case KEY_NO_SMS: /* enable/disable SMS */ command = cmd_set; set_sms = key == KEY_SMS? 1: -1; break; case ARGP_KEY_ARG: /* End processing here. */ cmdline = &state->argv [state->next - 1]; state->next = state->argc; break; default: return ARGP_ERR_UNKNOWN; } return 0; } /* * Description: gets called by main function of lomoco.c * and starts the argument parsing function * * Parameters: argc (sum of args) * **argv (array of args) * * Return: nothing, exits program with (EXIT_FAILURE) if something failes */ void cmdline_parse (int argc, char **argv) { /* Parse the arguments */ argp_parse (&argp, argc, argv, ARGP_IN_ORDER, NULL, NULL); /* Validate the arguments */ if (command == cmd_none) { fprintf (stderr, "%s: you must specify a command.\n" "\nUse %s --help for usage information.\n", progname, progname); exit (EXIT_FAILURE); } /* Set up the default command, if one is needed. */ } lomoco-1.0/src/cmdline.h0000644000175000001440000000331410401325475014522 0ustar gladiacusers/* cmdline.h - Command-line parser interface. Copyright (C) 2002 Alexios Chouchoulas Copyright (C) 2005 Andreas Schneider Peter Feuerer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __CMDLINE_H #define __CMDLINE_H #ifdef HAVE_CONFIG_H # include #endif #include #include #include #include #include "lomoco.h" #define _(x) x /* argp option keys */ typedef enum { cmd_none = 0, cmd_scan, cmd_set, cmd_inquire, } command_t; enum { DUMMY_KEY=129, KEY_SMS, KEY_NO_SMS }; /* Option flags and variables. These are initialized in parse_opt. */ extern command_t command; extern int set_res; extern int set_sms; extern char *match_bus; extern char *match_dev; extern int match_pid; extern int set_channel; extern int set_lock; extern int set_unlock; extern int set_clear; void cmdline_parse (int argc, char **argv); #endif /* __CMDLINE_H */ lomoco-1.0/src/lomoco.10000644000175000001440000001256210401325475014315 0ustar gladiacusers.\" ** You probably do not want to edit this file directly ** .\" It was generated using the DocBook XSL Stylesheets (version 1.69.0). .\" Instead of manually editing it, you probably should edit the DocBook XML .\" source for it and then use the DocBook XSL Stylesheets to regenerate it. .TH "LOMOCO" "1" "09/08/2005" "28 Aug 2005" "28 Aug 2005" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" lomoco \- Logitech Mouse Control for USB Mice .SH "SYNOPSIS" .HP 7 \fBlomoco\fR [\fIOPTIONS\fR] .SH "DESCRIPTION" .PP lomoco can configure vendor\-specific options on Logitech USB mice (or dual\-personality mice plugged into the USB port). A number of recent devices are supported. The program is mostly useful in setting the resolution to 800 cpi or higher on mice that boot at 400 cpi (such as the MX500, MX510, MX1000 etc.), and disabling SmartScroll or Cruise Control for those who would rather use the two extra buttons as ordinary mouse buttons. .PP Hint 1: use a Linux kernel with Event Interface support (the evdev module) if you want full access to the numerous buttons on these mice. .PP Hint 2: on Linux, the usbmouse driver ignores the extra buttons altogether. Don't let it handle your Logitech mice \-\- use the generic hid driver for USB HID devices instead. .SH "EXIT STATUS" .PP An exit status of zero indicates successful termination. A non\-zero exit status denotes abnormal termination due to an error. .SH "OPTIONS" .PP lomoco accepts a number of arguments. The following arguments control which device is accessed or modified: .TP \-b, \-\-bus=\fIUSB\-BUS\-NUMBER\fR Only apply the command to the specified bus, specified in full (e.g. use \-b 001 for bus 1). This is in the same format as reported by lomoco \-s (the first column, on the left hand side of the period) or lsusb(1) (next to `Bus'). .TP \-d, \-\-dev=\fIUSB\-DEVICE\-NUMBER\fR Only apply the command to the specified bus, specified in full (e.g. use \-d 01b for device 27). This is in the same format as reported by lomoco \-s (the first column, on the right hand side of the period) or lsusb(1) (next to `Device'). .TP \-p, \-\-pid=\fIUSB\-PRODUCT\-ID\fR Only apply the command to the specified USB product ID, specified in hexadecimal and in full (e.g. use \-p c025 for an MX\-500 optical mouse). Again, you can use lomoco \-s or lsusb(1) to get a listing of product IDs (the right hand side of tuples like 046d:xxxx). .PP The following generic actions can be performed: .TP \-i, \-\-inquire Obtain and display the status of all supported capabilities for all matching devices. .TP \-s, \-\-scan Scan the USB bus and report all matching, supported Logitech mice. .PP The following commands configure wireless receivers and mice with the CSR command set (use lomoco \-s to see if yours supports it): .TP \-1, \-\-ch1 Set matching devices to channel 1. Please be aware that not all CSR\-supporting devices are dual channel. .TP \-2, \-\-ch2 Set matching devices to channel 2. .TP \-c, \-\-clear Make all matching receivers forget about the mouse connected to it, just as if the "connect" button on the receiver had been pressed for three seconds. .TP \-l, \-\-lock Stop the 30 second search for a wireless mouse on all matching receivers. This search is initiated using the \-u option, or by pressing the "connect" button on the receiver. .TP \-u, \-\-unlock Unlock all matching receivers and initiate a search for any wireless mouse in range. This is the same as pressing the "connect" button on the receiver. .PP The following settings control mouse resolution, for mice with 400, 800, 1200 and 1600 cpi support, and the RES capability. .TP \-4, \-\-400 Sets matching devices to a resolution of 400 cpi. .TP \-8, \-\-800 Sets matching devices to a resolution of 800 cpi. Very useful on certain Logitech mice (the MX500 is one of them) that boot in 400 cpi. .TP \-m, \-\-1200 Sets matching devices to a resolution of 1200 cpi. Very useful on certain Logitech mice (the MX518 is one of them) that boot in 400 cpi. .TP \-h, \-\-1600 Sets matching devices to a resolution of 1600 cpi. Very useful on certain Logitech mice (the MX518 is one of them) that boot in 400 cpi. .TP \-g, \-\-2000 Sets matching devices to a resolution of 2000 cpi. Very useful on certain Logitech mice (the G5 or G7) that boot in 400 cpi. .PP The following settings control SmartScroll/Cruise Control, for mice that support it (i.e. include the SMS capability). .TP \-\-no\-sms Disable SmartScroll/Cruise Control an all matching mice. `Up' and `down' buttons do not also issue wheel events. Useful if you want to use the additional buttons for something else. .TP \-\-sms Enable SmartScroll/Cruise Control an all matching mice. `Up' and `down' buttons will now also issue wheel events (but will also issue their native button events, which user applications are expected to ignore). This is how most mice boot. .PP Other, miscellaneous options: .TP \-?, \-\-help List all available options and their meanings. .TP \-\-usage Display brief usage information. .TP \-V, \-\-version Show the program's version, credits and licensing. .SH "REPORTING BUGS" .PP Report bugs to or #lomoco @ irc.freenode.net .SH "SEE ALSO" .PP \fBlibusb\fR(1) .SH "AUTHORS" .PP Alexios Chouchoulas, Andreas Schneider, Peter Feuerer, Tobias Schleuss. This manual page by Alexios Chouchoulas and Andreas Schneider . lomoco-1.0/src/lomoco.c0000644000175000001440000004745410401325475014407 0ustar gladiacusers/* Formerly lmctl.c - Control Logitech USB Mice Copyright (C) 2004 Alexios Chouchoulas lomoco.c - Logitech Mouse Control for USB Mice Copyright (C) 2005 Andreas Schneider Peter Feuerer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "cmdline.h" char *progname; /* * product id: cat /proc/bus/input/devices * name: cat /proc/bus/input/devices * model: you can find on the hardware, look for M/N: ... * csr: mouse with receiver (wireless) * res: mouse has resolution control * sms: mouse has smart control * dual: dual receiver (wireless mouse+wireless keyboard) * * product id, name, model, csr, res, ssr, sms, dual */ mouse_t mice [] = { {0xc00e, "Wheel Mouse Optical", "M-BJ58", 0, 1, 0, 0, 0}, {0xc00f, "MouseMan Traveler", "M-BJ79", 0, 1, 0, 0, 0}, {0xc012, "MouseMan Dual Optical", "M-BL63B", 0, 1, 0, 0, 0}, {0xc01d, "MX510 Optical Mouse", "M-BS81A", 0, 1, 1, 1, 0}, {0xc01e, "MX518 Optical Mouse", "M-BS81A", 0, 1, 1, 0, 0}, {0xc024, "MX300 Optical Mouse", "M-BP82", 0, 1, 0, 0, 0}, {0xc01b, "MX310 Optical Mouse", "M-BP86", 0, 1, 0, 0, 0}, {0xc025, "MX500 Optical Mouse", "M-BP81A", 0, 1, 1, 1, 0}, {0xc031, "iFeel Mouse (silver)", "M-UT58A", 0, 1, 0, 0, 0}, {0xc041, "G5 Laser Gaming Mouse", "M-UAC113", 0, 1, 0, 1, 0}, {0xc501, "Mouse Receiver", "C-BA4-MSE", 1, 0, 0, 0, 0}, {0xc502, "Dual Receiver", "C-UA3-DUAL", 1, 0, 0, 0, 1}, {0xc503, "Receiver for MX900 Receiver", "C-UJ16A", 1, 0, 0, 1, 0}, {0xc504, "Receiver for Cordless Freedom Optical", "C-BD9-DUAL", 1, 0, 0, 0, 1}, {0xc505, "Receiver for Cordless Elite Duo", "C-BG17-DUAL", 1, 0, 0, 0, 1}, {0xc506, "Receiver for MX700 Optical Mouse", "C-BF16-MSE", 1, 0, 0, 1, 0}, {0xc508, "Receiver for Cordless Optical TrackMan", "C-BA4-MSE", 1, 0, 0, 1, 0}, {0xc702, "Receiver for Cordless Presenter", "C-UF15", 1, 0, 0, 0, 0}, {0xc704, "Receiver for diNovo Media Desktop", "C-BQ16A", 1, 0, 1, 1, 0}, /* From Markus Wiesner */ {0xc50e, "Receiver for MX1000 Laser", "C-BN34", 1, 0, 1, 1, 0}, {0xc512, "Receiver for Cordless Desktop MX3100 Laser", "C-BO34", 1, 0, 0, 1, 1}, {0x0000, NULL, NULL, 0, 0, 0, 0} }; /* * Description: Query the mouse and report all cordless mouse specific infos * e.g. receiver type, mouse type, battery status * * Parameters: mouse_t *m * mouse struct with the mouse specs * struct usb_dev_handle *handle * usb device handle of the mouse * unsigned int addr * address for dual receivers * * Return: void */ static void query_csr(mouse_t *m, struct usb_dev_handle *handle, unsigned int addr) { unsigned char buf[12] = {0}; if (usb_control_msg ( handle, USB_TYPE_VENDOR | USB_ENDPOINT_IN, 0x09, (0x0003 | addr), (0x0000 | addr), (char *) buf, 8, TIMEOUT ) != 8) { perror("Writing to USB device: CSR"); exit(EXIT_FAILURE); } /* We have not obtained blocks P6 P0 P4 P5 P8 P9 PB0 PB1 */ /* Is a C504 receiver busy? */ if ((P0 == 0x3b) && (P4 == 0)) { printf("\t*** C504 receiver busy, try again later.\n"); } /* Decode P0 */ printf("\tReceiver type: "); switch (P0) { case 0x0f: printf ("C50E\n"); break; case 0x38: printf ("C501\n"); break; case 0x39: printf ("C502\n"); break; case 0x3a: printf ("C503\n"); break; case 0x3b: printf ("C504\n"); break; case 0x3c: printf ("C508\n"); break; case 0x3d: printf ("C506\n"); break; case 0x3e: printf ("C505\n"); break; case 0x42: printf ("C512\n"); break; default: printf ("Unknown (type %x)\n", P0); } /* Decode P1 */ printf("\tMouse type: "); switch (P4) { case 0x00: printf ("None\n"); break; case 0x04: printf ("Cordless Mouse\n"); break; case 0x05: printf ("Cordless Wheel Mouse\n"); break; case 0x06: printf ("Cordless MouseMan Wheel\n"); break; case 0x07: printf ("Cordless Wheel Mouse\n"); break; case 0x08: printf ("Cordless Wheel Mouse\n"); break; case 0x09: printf ("Cordless TrackMan Wheel\n"); break; case 0x0A: printf ("Trackman Live\n"); break; case 0x0C: printf ("Cordless TrackMan FX\n"); break; case 0x0D: printf ("Cordless MouseMan Optical\n"); break; case 0x0E: printf ("Cordless Optical Mouse\n"); break; case 0x0F: printf ("Cordless Mouse\n"); break; case 0x12: printf ("Cordless MouseMan Optical (2ch)\n"); break; case 0x13: printf ("Cordless Optical Mouse (2ch)\n"); break; case 0x14: printf ("Cordless Mouse (2ch)\n"); break; case 0x15: printf ("MX1000 Laser Cordless Mouse\n"); break; case 0x1a: printf ("MX900 Optical Cordless Mouse\n"); break; case 0x82: printf ("Cordless Optical TrackMan\n"); break; case 0x8A: printf ("MX700 Cordless Optical Mouse\n"); break; case 0x8B: printf ("MX700 Cordless Optical Mouse (2ch)\n"); break; default: printf ("Unknown (type %x)\n", P4); } /* Decode P5 */ printf ("\tConnect button on mouse pressed: %s\n", (P5 & 0x40 ? "yes" : "no")); printf ("\tActive RF Channel: %d\n", (P5 & 0x08 ? 2 : 1)); printf ("\tBattery status: %d ", P5 & 0x07); switch (P5 & 0x07) { case 0: printf ("(unavailable)\n"); break; case 1: case 2: printf ("(critical)\n"); break; case 3: case 4: printf ("(low)\n"); break; case 5: case 6: printf ("(good)\n"); break; case 7: printf ("(full)\n"); break; } /* Decode P8 and P9 */ printf ("\tCordless security ID: 0x%04x\n", (P8 | (P9 << 8))); /* Decode P6 */ if (P6 & 0x20) { printf ("\tReceiver talking: yes\n"); printf ("\tLock Request (CONNECT button pressed): %s\n", P6 & 0x80? "yes": "no"); printf ("\tMouse Powerup (First time out of the box auto-locking): %s\n", P6 & 0x40? "yes": "no"); printf ("\tReceiver Unlocked (Mouse disconnected): %s\n", P6 & 0x10? "yes": "no"); printf ("\tWait Lock (Searching for mouse): %s\n", P6 & 0x08? "yes": "no"); } else { printf ("\tReceiver talking: no\n"); } /* Decode PB0 */ if (PB0 < 0x80) printf ("\tDevice physical shape type: %d\n", PB0); /* Decode PB1 */ if (PB1 & 0x80) { printf ("\tDevice has two channels: %s\n", PB1 & 0x40? "yes": "no"); printf ("\tDevice supports 800 cpi: %s\n", PB1 & 0x20? "yes": "no"); printf ("\tDevice has horizontal roller: %s\n", PB1 & 0x10? "yes": "no"); printf ("\tDevice has vertical roller: %s\n", PB1 & 0x08? "yes": "no"); if ((PB1 & 7) < 7) { printf ("\tNumber of buttons on device: %d\n", (PB1 & 7) + 2); } else { printf ("\tNumber of buttons on device: 9 or more\n"); } } } /* * Description: Query the mouse and report the current resolution * * Parameters: mouse_t *m * struct with the mouse specs * struct usb_dev_handle *handle * device handle of the mouse * unsigned int addr * address for dual receivers * * Return: void */ static void query_res(mouse_t *m, struct usb_dev_handle *handle, unsigned int addr) { unsigned char buf[4] = {0}; if (usb_control_msg ( handle, USB_TYPE_VENDOR | USB_ENDPOINT_IN, 0x01, (0x000e | addr), (0x0000 | addr), (char *) buf, 1, TIMEOUT ) != 1) { perror("Writing to USB device: RES"); exit(EXIT_FAILURE); } assert ((buf [0] == 3) || (buf [0] == 4) || (buf [0] == 5) || (buf [0] == 6) || (buf [0] == 7)); printf ("\tResolution (RES): %d cpi\n", (buf [0] - 2) * 400); } /* * Description: Query the mouse and report smart control if it is availiable * * Parameters: mouse_t *m * struct with the mouse specs * struct usb_dev_handle *handle * device handle of the mouse * unsigned int addr * address for dual receivers * * Return: void */ static void query_sms(mouse_t *m, struct usb_dev_handle *handle, unsigned int addr) { unsigned char buf[4] = {0}; if (m->has_ssr) { if (usb_control_msg ( handle, USB_TYPE_VENDOR | USB_ENDPOINT_IN, 0x01, (0x0017 | addr), (0x0000 | addr), (char*) buf, 1, TIMEOUT ) != 1) { perror("Writing to USB device: SMS"); exit(EXIT_FAILURE); } printf ("\tSmartScroll (SMS): %s\n", (buf [0] ? "on" : "off")); } else { printf ("\tSmartScroll (SMS): reporting not supported\n"); } } /* * Description: print known usb information * * Parameters: mouse_t *m * struct with the mouse specs * usb_device *device * the device which should be queried * * Return: void */ static void query_usb(mouse_t *m, struct usb_device *device) { static const char *usbhid_mousepoll = "/sys/module/usbhid/parameters/mousepoll"; unsigned int mousepoll = 0; /* polling interval value */ unsigned int interval = 0; /* default polling interval */ char buf[4] = {0}; int i, j, k, l, fd; if ((fd = open(usbhid_mousepoll, O_RDONLY)) != -1) { if ((read (fd, buf, (sizeof(buf) - 1))) < (sizeof(buf) - 1)) mousepoll = atoi (buf); } close (fd); for (i = 0; i < device->descriptor.bNumConfigurations; i++) { /* Loop through all of the interfaces */ for (j = 0; j < device->config[i].bNumInterfaces; j++) { /* Loop through all of the alternate mouse settings */ for (k = 0; k < device->config[i].interface[j].num_altsetting; k++) { /* Check if this interface is a mouse */ if ( device->config[i].interface[j].altsetting[k].bInterfaceProtocol == 2 ) { /* Loop trough all of the endpoints */ for (l = 0; l < device->config[i].interface[j].altsetting[k].bNumEndpoints; l++) { /* Get the values and print output */ interval = device->config[i].interface[j].altsetting[k].endpoint[l].bInterval; if (mousepoll) printf ("\tUSB Mouse Polling Interval: %3dms (default: %3dms)\n", mousepoll, interval); else printf ("\tUSB Mouse Polling Interval: %3dms\n", interval); } } } } } } /* * Description: print mouse specific things like current resolution, * state of sms, and for wireless mouse additional: * receiver type, battery strenght and so on * * Parameters: mouse_t *m * struct with the mouse specs * usb_device *device * the device which should be queried * * Retrun: void */ static void query (mouse_t *m, struct usb_device *device) { usb_dev_handle *handle; unsigned int addr; /* * For dual receivers C502, C504 and C505, the mouse is the * second device and uses an addr of 1 in the value and index * fields' high byte. 1 << 8 */ addr = m->is_dual ? 1 << 8 : 0; /* Try to open the device */ handle = usb_open (device); if (handle == NULL) { perror ("Error opening USB device"); exit (EXIT_FAILURE); } /* Parse CSR Status (this one's huge) * for wireless mouse */ if (m->has_csr) { query_csr(m, handle, addr); } /* The RES extension */ if (m->has_res) { query_res(m, handle, addr); } /* The SMS extension */ if (m->has_sms) { query_sms(m, handle, addr); } query_usb(m, device); printf ("\n"); (void) usb_close (handle); } /* * Description: change the wireless channel, start/stop the receiver to search for mouse * and make the receiver to forget the mouse connected to it. * * Parameters: mouse_t *m * struct with the mouse specs * usb_device *device * the device which should be queried * * Retrun: void */ static void configure_csr (/*@unused@*/mouse_t *m, struct usb_dev_handle *handle, unsigned int addr) { /* Set the channel? */ if (set_channel) { assert ((set_channel == 1) || (set_channel == 2)); if (usb_control_msg ( handle, USB_TYPE_VENDOR, 0x02, (0x0008 | addr), ((set_channel - 1) | addr), NULL, 0, TIMEOUT ) != 0) { perror("Writing to USB device: CSR"); exit(EXIT_FAILURE); } printf ("\tRF Channel set to %d\n", set_channel); } /* Unlock? */ if (set_unlock) { if (usb_control_msg ( handle, USB_TYPE_VENDOR, 0x02, (0x06 | addr), (0x1 | addr), NULL, 0, TIMEOUT ) != 0) { perror("Writing to USB device: CSR"); exit(EXIT_FAILURE); } printf ("\tReceiver unlocked, searching for a mouse.\n"); } /* Lock? */ if (set_lock) { if (usb_control_msg ( handle, USB_TYPE_VENDOR, 0x02, (0x0006 | addr), (0x0000 | addr), NULL, 0, TIMEOUT ) != 0) { perror("Writing to USB device: CSR"); exit(EXIT_FAILURE); } printf ("\tReceiver locked, no longer searching for a mouse.\n"); } /* Clear? */ if (set_clear) { if (usb_control_msg ( handle, USB_TYPE_VENDOR, 0x09, (0x0004 | addr), (0x0000 | addr), NULL, 0, TIMEOUT ) != 0) { perror("Writing to USB device: CSR"); exit(EXIT_FAILURE); } printf ("\tReceiver cleared, no longer associated with a mouse.\n"); } } /* * Description: change the resolution * * Parameters: mouse_t *m * struct with the mouse specs * usb_device *device * the device which should be queried * * Retrun: void */ static void configure_res (/*@unused@*/mouse_t *m, struct usb_dev_handle *handle) { if (set_res == 0) return; assert ((set_res == 400) || (set_res == 800) || (set_res == 1200) || (set_res == 1600) || (set_res == 2000)); if (usb_control_msg ( handle, USB_TYPE_VENDOR, 0x0002, 0x000e, (set_res / 400) + 2, NULL, 0, TIMEOUT ) != 0) { perror("Writing to USB device: RES"); exit(EXIT_FAILURE); } printf ("\tResolution set to %d cpi\n", set_res); } /* * Description: change state of sms * * Parameters: mouse_t *m * struct with the mouse specs * usb_device *device * the device which should be queried * * Retrun: void */ static void configure_sms (/*@unused@*/mouse_t *m, struct usb_dev_handle *handle) { if (set_sms == 0) return; assert ((set_sms == 1) || (set_sms == -1)); if (usb_control_msg ( handle, USB_TYPE_VENDOR, 0x02, 0x0017, (set_sms == 1 ? 0x0001 : 0x0000), NULL, 0, TIMEOUT ) != 0) { perror("Writing to USB device: "); exit(EXIT_FAILURE); } if (set_sms == 1) printf ("\tSmartScroll enabled\n"); else printf ("\tSmartScroll disabled\n"); } /* * Description: start the configuration functions of all features * which are supported by the mouse. * * Parameters: mouse_t *m * struct with the mouse specs * usb_device *device * the device which should be queried * * Retrun: void */ static void configure (mouse_t *m, struct usb_device *device) { usb_dev_handle * handle; unsigned int addr; /* * For dual receivers C502, C504 and C505, the mouse is the * second device and uses an addr of 1 in the value and index * fields' high byte. 1 << 8 */ addr = m->is_dual ? 1 << 8 : 0; /* Try to open the device */ handle = usb_open (device); if (handle == NULL) { perror ("Error opening USB device"); exit (EXIT_FAILURE); } if (m->has_csr) configure_csr (m, handle, addr); if (m->has_res) configure_res (m, handle); if (m->has_sms) configure_sms (m, handle); printf ("\n"); (void) usb_close (handle); } /* * Description: Search for the usb-mouse in our mice[] vector * * Parameters: struct usb_device *device * the usb device to be searched for * * Retrun: the data entry of the mouse (or the NULL entry if the mouse * wasn't found) */ static /*@null@*/mouse_t *find_mouse (struct usb_device *device) { int i; for (i = 0; mice [i].pid; i++) { if (device->descriptor.idProduct == mice [i].pid) { return &mice [i]; } } return NULL; } /* * Description: search for the correct mouse in mice[] and get needed data. * then run the command, the user specified. * * Parameters: struct usb_bus *bus * usb bus which should be searched for logitech mice. * * Retrun: return 1 (always) <-- no errorhandling yet !TODO! */ int scan_bus (struct usb_bus *bus) { struct usb_device* roottree = bus->devices; struct usb_device *device; usb_dev_handle *handle; mouse_t *m; int ret = 0; char product[128]; for (device = roottree; device; device = device->next) { /* continue with next iteration of the "for" loop if: * - ID of the Product is different from the one specified match_pid by cmdline.c * - Device name different from the one specified by match_dev from cmdline.c * - Bus is different from the one specified by match_bus from cmdline.c */ if (match_pid && (device->descriptor.idProduct != match_pid)) continue; if ((match_dev != NULL) && (strcmp (device->filename, match_dev))) continue; if ((match_bus != NULL) && (strcmp (device->bus->dirname, match_bus))) continue; /* continue with next iteration of the for loop if it is no Logitech mouse */ if (device->descriptor.idVendor != VENDOR_LOGITECH) { if (command == cmd_scan) { printf ("%s.%s: %04x:%04x Not a Logitech device\n", device->bus->dirname, device->filename, device->descriptor.idVendor, device->descriptor.idProduct); } continue; } /* Do we support this device? If so, list it. */ if ((m = find_mouse (device)) != NULL) { printf ("%s.%s: %04x:%04x %s (%s) Caps: %s%s%s\n", device->bus->dirname, device->filename, device->descriptor.idVendor, device->descriptor.idProduct, m->name, m->model, m->has_csr? "CSR ": "", m->has_res? "RES ": "", m->has_sms? "SMS ": "" ); } else { handle = usb_open (device); ret = usb_get_string_simple( handle, device->descriptor.iProduct, product, sizeof(product)); (void) usb_close (handle); printf ("%s.%s: %04x:%04x Unsupported Logitech device: %s\n", device->bus->dirname, device->filename, device->descriptor.idVendor, device->descriptor.idProduct, ret ? product : "Unknown" ); continue; } /* Run commands */ if (command == cmd_inquire) query (m, device); if (command == cmd_set) configure (m, device); } return 1; } /* * Description: initialize usblib find all busses and devices * afterwards check every device with function "scan_bus()" * * Parameters: no parameter * * Retrun: void */ void run () { struct usb_bus* bus; usb_init(); (void) usb_find_busses(); (void) usb_find_devices(); for (bus = usb_busses; bus != NULL; bus = bus->next) { if (!scan_bus(bus)) { printf ("Exiting happily.\n"); exit (EXIT_SUCCESS); } } } /* * Description: Main function; calls function "cmdline_pars" * of cmdline.c with arguments given to the program * and finally it calls "run" * * Parameters: standard program arguments * * Retrun: 0 on success */ int main (int argc, char **argv) { progname = argv[0]; /* cmdline_parse puts all necessary things in following * variables: * * extern command_t command; * extern int set_res; * extern int set_sms; * extern char *match_bus; * extern char *match_dev; * extern int match_pid; * extern int set_channel; * extern int set_lock; * extern int set_unlock; * extern int set_clear; */ cmdline_parse (argc, argv); run(); return EXIT_SUCCESS; } lomoco-1.0/src/lomoco.h0000644000175000001440000000437510401325475014407 0ustar gladiacusers/* Formerly lmctl.h - Main header file. Copyright (C) 2004 Alexios Chouchoulas lomoco.h - Main header file Copyright (C) 2005 Andreas Schneider Peter Feuerer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __LOMOCO_H #define __LOMOCO_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "cmdline.h" #define __KERNEL__ #define VENDOR_LOGITECH 0x046d #define TIMEOUT 0x1000 #define P6 buf [0] #define P0 buf [1] #define P4 buf [2] #define P5 buf [3] #define P8 buf [4] #define P9 buf [5] #define PB0 buf [6] #define PB1 buf [7] #define max(a,b) ((a) > (b) ? (a) : (b)) /* for debugging perror */ #define perror printf("%s:%d\n",__FILE__,__LINE__);perror /* program name (lomoco) */ extern char *progname; /* * pid Product id * name Mouse name * model Mouse Model * * has_csr Mouse with a receiver * has_res Resolution control * has_ssr Smart Control Reporting * has_sms Smart Control * * is_dual Dual receiver, mouse and keyboard */ typedef struct { ushort pid; /*@null@*/ char *name; /*@null@*/ char *model; int has_csr; int has_res; int has_ssr; int has_sms; int is_dual; } mouse_t; #endif /* __LOMOCO_H */ lomoco-1.0/NEWS0000644000175000001440000000000010401325475012633 0ustar gladiacuserslomoco-1.0/udev/0000755000175000001440000000000010401325611013101 5ustar gladiacuserslomoco-1.0/udev/udev.lomoco0000755000175000001440000000100310401325474015262 0ustar gladiacusers#!/bin/bash case "$DEVPATH" in *usbdev*.*) dev=${DEVPATH##*usbdev} bus=$(printf %03d ${dev%.*}) dev=$(printf %03d ${dev#*.}) . /etc/sysconfig/logitech_mouse options= if [ -n "$LOGITECH_MOUSE_RESOLUTION" ]; then options="--$LOGITECH_MOUSE_RESOLUTION" fi if [ -z "$LOGITECH_MOUSE_DISABLE_CC" -o "$LOGITECH_MOUSE_DISABLE_CC" = yes ]; then options="$options --no-sms" fi if [ -n "$options" ]; then /usr/bin/lomoco -b $bus -d $dev $options fi ;; esac 2>&1 | /bin/logger -t lomoco lomoco-1.0/udev/README0000644000175000001440000000121710401325474013771 0ustar gladiacusers lomoco udev - Logitech Mouse Control with udev http://lomoco.linux-gamers.net UDEV Linux configurable dynamic device naming support 'man udev' for more informations DESCRIPTION toudev.awk awk script to create udev rules (make udev-rules) from the mouse struct in lomoco.c. A file named lomoco.rules will be created, suggested udev rules name is /etc/udev/rules.d/40-lomoco.rules udev.lomoco Shell script to set the resolution or to disable Smart/Cruise control on the logitech mouse. Copy it to /lib/udev/lomoco THANKS Special thanks to Ludwig Nussel and Marco d'Itri for the scripts. lomoco-1.0/udev/toudev.awk0000644000175000001440000000065610401325474015131 0ustar gladiacusers#!/bin/awk -f BEGIN { FS = "," print "ACTION != \"add\", GOTO=\"lomoco_end\"" print "SUBSYSTEM != \"usb\", GOTO=\"lomoco_end\"" print "SYSFS{idVendor} != \"046d\", GOTO=\"lomoco_end\"" print "" } $1 ~ /0xc[a-f0-9][a-f0-9][a-f0-9]/ { print "# " substr($3, index($3, "\"")) ", " $2 print "SYSFS{idProduct}==\"" substr($1, index($1, "x")+1) \ "\", RUN=\"lomoco\"" } END { print "" print "LABEL=\"lomoco_end\"" } lomoco-1.0/configure.scan0000644000175000001440000000120110401325475014767 0ustar gladiacusers# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.59) AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS) AC_CONFIG_SRCDIR([src/cmdline.c]) AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_AWK AC_PROG_CC # Checks for libraries. # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h string.h sys/time.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST # Checks for library functions. AC_CHECK_FUNCS([strdup strspn]) AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT lomoco-1.0/README0000644000175000001440000000163710401325475013035 0ustar gladiacusers lomoco - Logitech Mouse Control for USB mice http://lomoco.linux-gamers.net/ Copyright (C) 2004 Alexios Chouchoulas Copyright (C) 2005 Andreas Schneider, Peter Feuerer, Tobias Schleuss lomoco is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA All comments are welcome. lomoco-1.0/configure.ac0000644000175000001440000000155010401325475014435 0ustar gladiacusers# # lomoco autoconf # # Process this file with autoconf to produce a configure script. AC_INIT() # lomoco version lomoco_VERSION=$(sed -n -e 's/lomoco .\([0-9]*.[0-9]*\)./\1/p' ChangeLog) AM_INIT_AUTOMAKE(lomoco, $lomoco_VERSION) AC_CONFIG_SRCDIR([src/lomoco.c]) AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_AWK AC_PROG_CC # Checks for libraries. AC_CHECK_LIB(usb,usb_init,,AC_MSG_ERROR(libusb not found.)) # Checks for header files. AC_HEADER_STDC AC_CHECK_HEADERS([stdlib.h string.h sys/time.h]) AC_CHECK_HEADER(argp.h,,AC_MSG_ERROR(argp.h not found)) AC_CHECK_HEADER(usb.h,,AC_MSG_ERROR(usb.h not found)) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST # Checks for library functions. AC_CHECK_FUNCS([strdup strspn]) AC_CHECK_FUNCS(usb_control_msg) AC_CONFIG_FILES([Makefile src/Makefile]) AC_OUTPUT lomoco-1.0/autogen.sh0000755000175000001440000000404710401325475014154 0ustar gladiacusers#!/bin/sh # # lomoco autogen script # # Automakeversion AM_1=1 AM_2=7 AM_3=6 # Autoconfversion AC_1=2 AC_2=59 # Check automake version AM_VERSION=`automake --version | sed -n -e 's#[^0-9]* \([0-9]*\)\.\([0-9]*\)\.*\([0-9]*\).*$#\1 \2 \3#p'` AM_V1=`echo $AM_VERSION | awk '{print $1}'` AM_V2=`echo $AM_VERSION | awk '{print $2}'` AM_V3=`echo $AM_VERSION | awk '{print $3}'` if [ "$AM_1" -gt "$AM_V1" ]; then AM_ERROR=1 else if [ "$AM_1" -eq "$AM_V1" ]; then if [ "$AM_2" -gt "$AM_V2" ]; then AM_ERROR=1 else if [ "$AM_2" -eq "$AM_V2" ]; then if [ -n "$AM_V3" -o "$AM_3" -gt "$AM_V3" ]; then AM_ERROR=1 fi fi fi fi fi if [ "$AM_ERROR" = "1" ]; then echo -e '\E[31;m' echo -n "Your automake version `automake --version | sed -n -e 's#[^0-9]* \([0-9]*\.[0-9]*\.[0-9]*\).*#\1#p'`" echo " is older than the suggested one, $AM_1.$AM_2.$AM_3" echo "Go on at your own risk. :-)" echo tput sgr0 fi # Check autoconf version AC_VERSION=`autoconf --version | sed -n -e 's#[^0-9]* \([0-9]*\)\.\([0-9]*\).*$#\1 \2#p'` AC_V1=`echo $AC_VERSION | awk '{print $1}'` AC_V2=`echo $AC_VERSION | awk '{print $2}'` if [ "$AC_1" -gt "$AC_V1" ]; then AC_ERROR=1 else if [ "$AC_1" -eq "$AC_V1" ]; then if [ "$AC_2" -gt "$AC_V2" ]; then AC_ERROR=1 fi fi fi if [ "$AC_ERROR" = "1" ]; then echo -e '\E[31;m' echo -n "Your autoconf version `autoconf --version | sed -n -e 's#[^0-9]* \([0-9]*\.[0-9]*\).*#\1#p'`" echo " is older than the suggested one, $AC_1.$AC_2" echo "Go on at your own risk. :-)" echo tput sgr0 fi if [ "$LT_ERROR" = "1" ]; then echo -e '\E[31;m' echo -n "Your libtool version `libtool --version | sed -n -e 's#[^0-9]* \([0-9]*\.[0-9]*\).*#\1#p'`" echo " is older than the suggested one, $LT_1.$LT_2" echo "Go on at your own risk. :-)" echo tput sgr0 fi echo Configuring build environment for lomoco echo ... aclocal \ && autoheader --force \ && automake --add-missing --foreign --copy \ && autoconf --force \ && echo "Now running configure to configure lomoco" \ && echo "./configure $@" \ && ./configure $@ lomoco-1.0/Makefile.am0000644000175000001440000000042510401325475014203 0ustar gladiacusers# # Automake description for lomoco # SUBDIRS=src EXTRA_DIST = \ AUTHORS \ autogen.sh \ ChangeLog \ COPYING \ INSTALL \ NEWS \ README # Report splint warnings splint: $(MAKE) -C src/ splint udev-rules: $(AWK) -f udev/toudev.awk < src/lomoco.c > udev/lomoco.rules lomoco-1.0/AUTHORS0000644000175000001440000000040610401325475013216 0ustar gladiacusersTobias Schleuss (Developer) Andreas Schneider (Developer) Alexios Chouchoulas (First Developer) Markus Wiesner (MX1000 Laser patch) lomoco-1.0/INSTALL0000644000175000001440000002202410401325475013177 0ustar gladiacusersCopyright 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. lomoco-1.0/ChangeLog0000644000175000001440000000047710401325475013730 0ustar gladiacuserslomoco (1.0) * Update udev rules an script for latest version * Added patch for the MX518, MX510, MX310, MX3100 * Added lomoco.xml manpage template * Updated udev support, thanks to Ludwig Nussel * Fixed memory leaks -- Andreas Schneider Wed Mar 01 15:05:38 CEST 2006 lomoco-1.0/COPYING0000644000175000001440000004311010401325475013200 0ustar gladiacusers GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License.