.\" This manpage has been automatically generated by docbook2man .\" from a DocBook document. This tool can be found at: .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . .TH "HAMA-SLIDE-MOUSE-CONTROL" "1" "24 June 2007" "" "" .SH NAME hama-slide-mouse-control \- Control settings of the Hama SLide S1 USB gaming mouse .SH SYNOPSIS \fBhama-slide-mouse-control\fR [ \fB [ -d \fIidVendor:idProduct\fB ] \fI0-OR-MORE-COMMANDS\fB\fI ...\fB \fR | \fB-h\fR | \fB--help\fR | \fB-v\fR | \fB--version\fR ] .SH "DESCRIPTION" .PP This program controls the Hama SLide S1 USB gaming mouse: It allows changing the DPI settings and to switch between three different modes which influence the functionality of the two "thumb buttons". .PP Note: To be able to access the USB mouse, the program must either be run as root, be installed suid root, or udev must have been configured to allow access for normal users. See the section "udev Setup" below. .PP The \fB-d\fR option can be used to specify the USB device that the program should search for. The option argument is a string of the form "056e:001c" (this particular value is also the default), i.e. the USB vendor and product IDs in hexadecimal, separated by a colon. See the output of the \fBlsusb\fR command to find out the IDs of connected devices. .SH "COMMANDS" .PP Zero or more commands can be specified on the command line. If no commands at all are present, the program can be used to check for the presence of a Hama SLide mouse on the machine via its exit status. Otherwise, the commands are executed in the supplied order. If more than one Hama SLide mouse is connected, all commands are executed on all mice. .PP The mouse is a very simple device: You can only write settings to it, the current state of the settings cannot be read from it. .SS "MODE 1: SELECT DPI VIA THUMB BUTTON 1" .PP Command: \fBscroll\fR .PP This is the default mode of the mouse, it is activated immediately after plugging in the device. In this mode, the scroll wheel selects the mouse DPI while thumb button 1 is pressed down. Clicks on thumb button 1 cannot be detected by the OS. Thumb button 2 acts like another right mouse button. The current DPI setting is left unchanged. .SS "MODE 2: FIXED DPI SETTING" .PP Commands: \fB400\fR \fB800\fR \fB1200\fR \fB1600\fR .PP In this mode, the mouse resolution is set to one of four DPI values by specifying that value. Both thumb buttons are available to the OS - by default, they act like another middle and right mouse button. The colour of the scroll wheel indicates the DPI setting: blue (400 dpi), green (800 dpi), cyan (1200 dpi) or red (1600 dpi). .PP Note: The program allows you to specify more than one command. You can use this to select a certain DPI value first, but switch to "scroll" mode again afterwards, e.g. with: \fBhama-slide-mouse-control 400 scroll\fR\&. A small, harmless hardware bug of the mouse exhibits itself in this case: When using the scroll wheel afterwards to select another resolution, the mouse orders the other DPI states as if the program-controlled DPI change had not taken place. .SS "MODE 3: THUMB BUTTONS SWITCH BETWEEN TWO FIXED DPI SETTINGS" .PP Commands: \fB400+800\fR \fB400+1200\fR \fB400+1600\fR \fB800+1200\fR \fB800+1600\fR \fB1200+1600\fR .PP When this mode is used, each of the two thumb buttons selects a certain DPI setting when clicked. Thumb button 1 always selects the lower, thumb button 2 the higher setting. This results in the different combinations above. The current DPI setting is left unchanged. Clicks on either thumb button cannot be detected by the OS in this mode. .SH "RETURN CODES" .PP The program returns 0 if all commands were successfully sent to the device. If no commands are given, it returns 0 if the mouse is plugged in. It returns 1 if no Hama SLide mouse (USB vendor 056e, product ID 001c) is connected to the computer. It returns 2 if there was an error sending commands to the mouse, either because the mouse returned an error in response to a command or because you do not have the access rights to change mouse settings. .SH "UDEV SETUP UNDER LINUX" .SS "EXECUTING HAMA-SLIDE-MOUSE-CONTROL WHEN THE MOUSE IS PLUGGED IN" .PP If you have root access and you are the only user on your machine, use the following udev rule to set up the mouse. The given command will be executed whenever the mouse is plugged in or the computer boots or resumes. Simply create a file named \fI/etc/udev/rules.d/60-hama-slide-mouse-control.rules\fR with the following content. Of course, you can execute the program with parameters of your choice instead of "400": .nf ACTION=="add", SUBSYSTEM=="usb_device", SYSFS{idVendor}=="056e", SYSFS{idProduct}=="001c", RUN+="/root/bin/hama-slide-mouse-control 400" .fi .PP Execute \fBudevcontrol reload_rules\fR as root after any changes to the configuration file. .SS "ALLOWING USERS TO SET UP THE MOUSE ON LOGIN" .PP If several users (possibly with differing wishes about the mouse setup) use the machine, it is possible give all users permission to set up the mouse, instead of only root. Put the following into \fI/etc/udev/rules.d/60-hama-slide-mouse-control.rules\fR: .nf ACTION=="add", SUBSYSTEM=="usb_device", SYSFS{idVendor}=="056e", SYSFS{idProduct}=="001c", MODE="666" .fi .PP Users can then run \fBhama-slide-mouse-control\fR from startup scripts when their Gnome or KDE desktop starts up. It should be noted that this setup will allow remotely logged-in users to annoy the local user by playing around with the settings and letting the mouse flash in all its colours! :-) Of course you can also add both the RUN and MODE keywords to the udev rule. Finally, you can restrict write access to users in a certain group, by using MODE="660", GROUP="hamamouse" or similar. .SH "SETTING HAMA-SLIDE-MOUSE-CONTROL SUID ROOT" .PP It is possible to set the suid bit on the \fBhama-slide-mouse-control\fR to allow ordinary users to change mouse settings even if they do not have access to the USB device. The program has been written with care, using it this way should be fairly safe. \fBHowever, running hama-slide-mouse-control suid root is NOT recommended\fR because suid binaries should be avoided in general! In this particular case, there is even less of a reason to do this, as udev provides a mechanism to allow all users to access the device. .PP The \fB-d\fR option cannot be used if the program is run suid root. .SH "ASSIGNING ACTIONS TO THE THUMB BUTTONS WITH IMWHEEL" .PP The author has been unable to get the thumb buttons to do anything other than act as "clones" of the middle and right mouse button, but at least one web page claims that it is possible to redefine the meaning of the buttons, so here is a short description of how to configure this with \fBimwheel\fR\&. .PP Having installed \fBimwheel\fR, edit \fI/etc/X11/imwheel/startup.conf\fR: Set IMWHEEL_START=1 and IMWHEEL_PARAMS='-b "0 0 8 9"'\&. Next, check the Section "InputDevice" of your \fI/etc/X11/xorg.conf\fR file. It is recommended to use Option "Protocol" "evdev" and to comment out any ZAxisMapping and Buttons settings, as they can cause confusing behaviour with newer imwheel versions. Now configure mappings in your \fI~/.imwheelrc\fR file. For example, two lines "^XMMS" and None, Thumb1, Return will define the (not very useful) action that in any window whose title starts with "XMMS", a click with "none" modifier keys (like Shift) on the Thumb1 button will simulate a keypress of the Return key. Restart X11 to have the new settings loaded. .SH "SEE ALSO" .PP \fBlsusb\fR(8), \fBimwheel\fR(1), \fBxorg.conf\fR(5), \fBmouse\fR(4x), \fBudev\fR(7), \fBudevcontrol\fR(8) .SH "ABOUT THIS PROGRAM" .PP This program and documentation was written by Richard Atterer \&. Copyright 2007 Richard Atterer, released under GPL v2. .PP The USB commands that are sent to the device were obtained by reverse-engineering the protocol used by Hama's control program for Windows. This was done using usbsnoop/Snoopy by Benoit Papillault - many thanks!