CINXE.COM

Control a Hama SLide USB mouse under Linux | Richard Atterer

<!DOCTYPE html> <html lang="en" dir="ltr"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Control a Hama SLide USB mouse under Linux | Richard Atterer</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <link rel="shortcut icon" href="/sites/all/themes/canvas_spring/favicon.ico" type="image/x-icon" /> <meta name="viewport" content="width=device-width; initial-scale=0.6666; maximum-scale=1.5; minimum-scale=0.25;" /> <link type="text/css" rel="stylesheet" media="all" href="/sites/atterer/files/css/css_20e2e973af54425b6c8758b72a0b4e9d.css" /> </head> <body class="not-front not-logged-in page-node node-type-page no-sidebars"> <div id="page"><div id="page-inner"> <a name="top" id="navigation-top"></a> <div id="skip-to-nav"><a href="#navigation">Skip to Navigation</a></div> <div id="header"><div id="header-inner" class="clear-block"> <div id="header-background"></div> <div id="logo-title"> <div id="logo"><a href="/" title="Home" rel="home"></a></div> </div> <!-- /#logo-title --> <div id="header-blocks" class="region region-header"> <div id="block-user-0" class="block block-user"> <h2>User login</h2> <div class="content"> <form action="/hama-slide-mouse-control?destination=node%2F22" accept-charset="UTF-8" method="post" id="user-login-form"> <div><div class="form-item" id="edit-name-wrapper"> <label for="edit-name">Username: <span class="form-required" title="This field is required.">*</span></label> <input type="text" maxlength="60" name="name" id="edit-name" size="15" value="" class="form-text required" /> </div> <div class="form-item" id="edit-pass-wrapper"> <label for="edit-pass">Password: <span class="form-required" title="This field is required.">*</span></label> <input type="password" name="pass" id="edit-pass" maxlength="60" size="15" class="form-text required" /> </div> <input type="submit" name="op" id="edit-submit" value="Log in" class="form-submit" /> <div class="item-list"><ul><li class="first last"><a href="/user/password" title="Request new password via e-mail.">Request new password</a></li> </ul></div><input type="hidden" name="form_build_id" id="form--fYeqW9ZwCRB1yjTRRYbdCCP1J4ccHTs5XHp2KVHIBk" value="form--fYeqW9ZwCRB1yjTRRYbdCCP1J4ccHTs5XHp2KVHIBk" /> <input type="hidden" name="form_id" id="edit-user-login-block" value="user_login_block" /> </div></form> </div> </div> </div> <!-- /#header-blocks --> </div></div> <!-- /#header-inner, /#header --> <div id="main"><div id="main-inner" class="clear-block with-navbar"> <div id="content"><div id="content-inner"> <div id="content-header"> <div class="breadcrumb"><a href="/">Home</a> &#8250; <a href="/hama-slide-mouse-control" class="active">hama-slide-mouse-control</a></div> <h1 class="title">Control a Hama SLide USB mouse under Linux</h1> </div> <!-- /#content-header --> <div id="content-area"> <div id="node-22" class="node clear-block"> <div class="meta"> <span class="submitted">Last update by Admin on 2010-04-25</span> <div class="terms terms-inline"><ul class="links inline"><li class="taxonomy_term_3 first last"><a href="/taxonomy/term/3" rel="tag" title="">software</a></li> </ul></div> </div> <div class="content"> <div class="sidebar-right center"> <img src="/sites/atterer/files/2009-09/hama-slide-mouse-control/hama-slide-s1-gaming-mouse-blue-lightning.gif" alt="[Hama SLide S1 Gaming Mouse Blue Lightning]" width="230" height="230 "/> </div> <p><strong>Change the DPI setting and thumb button function of a Hama SLide S1 gaming mouse under Linux!</strong><br/>USB-Maus unter Linux</p> <p>This command-line program allows you to control a Hama SLide S1 mouse connected to the USB port. You can switch between its three modes: Either thumb button 1 and the scroll wheel select the DPI setting, or a fixed DPI setting is used, or the two thumb buttons toggle between two DPI settings. The colour of the mouse changes according to the current setting. This package also aids you in configuring udev to apply your favourite settings whenever the mouse is plugged in or the machine boots.</p> <p><strong>Download: <a href="/sites/atterer/files/2009-09/hama-slide-mouse-control/hama-slide-mouse-control-1.0.tar.gz">hama-slide-mouse-control-1.0.tar.gz</a></strong><br> Open source, released under GPL v2.</p> <p>This was tested with Hama SLide S1 only, please tell me about your experiences with Hama SLide S2.</p> <?php hr(); ?> <h1><a name="AEN1" id="AEN1"></a>hama-slide-mouse-control</h1> <div class="REFNAMEDIV"><a name="AEN14" id="AEN14"></a> <h2>Name</h2> hama-slide-mouse-control&nbsp;--&nbsp;Control settings of the Hama SLide S1 USB gaming mouse</div> <div class="REFSYNOPSISDIV"><a name="AEN17" id="AEN17"></a> <h2>Synopsis</h2> <p><b class="COMMAND">hama-slide-mouse-control</b> [ [<code class= "OPTION">-d</code> <tt class= "REPLACEABLE"><i>idVendor:idProduct</i></tt>] {<tt class= "REPLACEABLE"><i>0-OR-MORE-COMMANDS</i></tt>...}<br> | <code class="OPTION">-h</code> | <code class= "OPTION">--help</code> | <code class="OPTION">-v</code> | <code class="OPTION">--version</code>]</p> </div> <div class="REFSECT1"><a name="DESCRIPTION" id="DESCRIPTION"></a> <h2>Description</h2> <p>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".</p> <p>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 "<a href="#UDEV">udev Setup</a>" below.</p> <p>The <code class="OPTION">-d</code> option can be used to specify the USB device that the program should search for. The option argument is a string of the form <tt class= "LITERAL">"056e:001c"</tt> (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 <b class= "COMMAND">lsusb</b> command to find out the IDs of connected devices.</p> </div> <div class="REFSECT1"><a name="COMMANDS" id="COMMANDS"></a> <h2>Commands</h2> <p>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.</p> <p>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.</p> <div class="REFSECT2"><a name="MODE1" id="MODE1"></a> <h3>Mode 1: Select DPI via Thumb Button 1</h3> <p>Command: <b class="COMMAND">scroll</b></p> <p>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.</p> </div> <div class="REFSECT2"><a name="MODE2" id="MODE2"></a> <h3>Mode 2: Fixed DPI Setting</h3> <p>Commands: <b class="COMMAND">400</b> <b class="COMMAND">800</b> <b class="COMMAND">1200</b> <b class="COMMAND">1600</b></p> <p>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).</p> <p>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: <b class= "COMMAND">hama-slide-mouse-control 400 scroll</b>. 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.</p> </div> <div class="REFSECT2"><a name="MODE3" id="MODE3"></a> <h3>MODE 3: Thumb Buttons Switch Between Two Fixed DPI Settings</h3> <p>Commands: <b class="COMMAND">400+800</b> <b class= "COMMAND">400+1200</b> <b class="COMMAND">400+1600</b> <b class= "COMMAND">800+1200</b> <b class="COMMAND">800+1600</b> <b class= "COMMAND">1200+1600</b></p> <p>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.</p> </div> </div> <div class="REFSECT1"><a name="RETURN" id="RETURN"></a> <h2>Return Codes</h2> <p>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.</p> </div> <div class="REFSECT1"><a name="UDEV" id="UDEV"></a> <h2>udev Setup under Linux</h2> <div class="REFSECT2"><a name="UDEV-PLUG" id="UDEV-PLUG"></a> <h3>Executing <b class="COMMAND">hama-slide-mouse-control</b> when the mouse is plugged in</h3> <p>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 <tt class= "FILENAME">/etc/udev/rules.d/60-hama-slide-mouse-control.rules</tt> with the following content. Of course, you can execute the program with parameters of your choice instead of "400":</p> <tt class="PROGRAMLISTING"> ACTION=="add", SUBSYSTEM=="usb_device", SYSFS{idVendor}=="056e", SYSFS{idProduct}=="001c", RUN+="/root/bin/hama-slide-mouse-control 400" </tt> <p>Execute <b class="COMMAND">udevcontrol reload_rules</b> as root after any changes to the configuration file.</p> </div> <div class="REFSECT2"><a name="UDEV-ANYUSER" id="UDEV-ANYUSER"></a> <h3>Allowing users to set up the mouse on login</h3> <p>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 <tt class= "FILENAME">/etc/udev/rules.d/60-hama-slide-mouse-control.rules</tt>:</p> <tt class="PROGRAMLISTING"> ACTION=="add", SUBSYSTEM=="usb_device", SYSFS{idVendor}=="056e", SYSFS{idProduct}=="001c", MODE="666" </tt> <p>Users can then run <b class= "COMMAND">hama-slide-mouse-control</b> 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 <tt class= "LITERAL">RUN</tt> and <tt class="LITERAL">MODE</tt> keywords to the udev rule. Finally, you can restrict write access to users in a certain group, by using <tt class="LITERAL">MODE="660", GROUP="hamamouse"</tt> or similar.</p> </div> </div> <div class="REFSECT1"><a name="SUID" id="SUID"></a> <h2>Setting <b class="COMMAND">hama-slide-mouse-control</b> suid root</h2> <p>It is possible to set the suid bit on the <b class= "COMMAND">hama-slide-mouse-control</b> 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. <span class="emphasis"><i class= "EMPHASIS">However, running <b class= "COMMAND">hama-slide-mouse-control</b> suid root is NOT recommended</i></span> 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.</p> <p>The <code class="OPTION">-d</code> option cannot be used if the program is run suid root.</p> </div> <div class="REFSECT1"><a name="IMWHEEL" id="IMWHEEL"></a> <h2>Assigning Actions to the Thumb Buttons With imwheel</h2> <p>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 <a href="http://wiki.ubuntuusers.de/evdev" target="_top">at least one web page</a> claims that it is possible to redefine the meaning of the buttons, so here is a short description of how to configure this with <b class= "COMMAND">imwheel</b>.</p> <p>Having installed <b class="COMMAND">imwheel</b>, edit <tt class= "FILENAME">/etc/X11/imwheel/startup.conf</tt>: Set <tt class= "LITERAL">IMWHEEL_START=1</tt> and <tt class= "LITERAL">IMWHEEL_PARAMS='-b "0 0 8 9"'</tt>. Next, check the <tt class="LITERAL">Section "InputDevice"</tt> of your <tt class= "FILENAME">/etc/X11/xorg.conf</tt> file. It is recommended to use <tt class="LITERAL">Option "Protocol" "evdev"</tt> and to comment out any <tt class="LITERAL">ZAxisMapping</tt> and <tt class= "LITERAL">Buttons</tt> settings, as they can cause confusing behaviour with newer imwheel versions. Now configure mappings in your <tt class="FILENAME">~/.imwheelrc</tt> file. For example, two lines <tt class="LITERAL">"^XMMS"</tt> and <tt class= "LITERAL">None, Thumb1, Return</tt> 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.</p> </div> <div class="REFSECT1"><a name="SEEALSO" id="SEEALSO"></a> <h2>See Also</h2> <p><span class="CITEREFENTRY"><span class= "REFENTRYTITLE">lsusb</span>(8)</span>, <span class= "CITEREFENTRY"><span class= "REFENTRYTITLE">imwheel</span>(1)</span>, <span class= "CITEREFENTRY"><span class= "REFENTRYTITLE">xorg.conf</span>(5)</span>, <span class= "CITEREFENTRY"><span class="REFENTRYTITLE">mouse</span>(4x)</span>, <span class="CITEREFENTRY"><span class= "REFENTRYTITLE">udev</span>(7)</span>, <span class= "CITEREFENTRY"><span class= "REFENTRYTITLE">udevcontrol</span>(8)</span></p> </div> <div class="REFSECT1"><a name="AUTHOR" id="AUTHOR"></a> <h2>About This Program</h2> <p>This program and documentation was written by <a href= "http://atterer.net" target="_top">Richard Atterer</a>. Copyright 2007 Richard Atterer, released under GPL v2.</p> <p>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 <a href= "http://benoit.papillault.free.fr/usbsnoop/" target= "_top">usbsnoop/Snoopy</a> by Benoit Papillault - many thanks!</p> </div> </div> <ul class="links inline"><li class="comment_add first last"><a href="/comment/reply/22#comment-form" title="Share your thoughts and opinions related to this posting.">Add new comment</a></li> </ul></div> </div> </div></div> <!-- /#content-inner, /#content --> <div id="navbar"><div id="navbar-inner" class="clear-block region region-navbar"> <a name="navigation" id="navigation"></a> <div id="search-box"> <form action="/hama-slide-mouse-control" accept-charset="UTF-8" method="post" id="search-theme-form"> <div><div id="search" class="container-inline"> <div class="form-item" id="edit-search-theme-form-1-wrapper"> <input type="text" maxlength="128" name="search_theme_form" id="edit-search-theme-form-1" size="15" value="Search" title="Enter the terms you wish to search for." class="form-text" /> </div> <input type="hidden" name="form_build_id" id="form-ZOzV7bJfFxaMf-RslXy6WK63cCwUAVxegbGBBgzfN94" value="form-ZOzV7bJfFxaMf-RslXy6WK63cCwUAVxegbGBBgzfN94" /> <input type="hidden" name="form_id" id="edit-search-theme-form" value="search_theme_form" /> </div> </div></form> </div> <!-- /#search-box --> <div id="primary"> <ul class="links"><li class="menu-344 first"><a href="/photo" title="">Photography</a></li> <li class="menu-362"><a href="/software" title="">Software</a></li> <li class="menu-190"><a href="/jigdo" title="jigdo (Jigsaw Download) - a download manager for CD/DVD images">jigdo</a></li> <li class="menu-376"><a href="/research" title="">Research</a></li> <li class="menu-193 last"><a href="/about" title="About">About</a></li> </ul> </div> <!-- /#primary --> </div></div> <!-- /#navbar-inner, /#navbar --> </div></div> <!-- /#main-inner, /#main --> <div id="footer"><div id="footer-inner" class="region region-footer"> <div id="footer-message"><div class="aller"><i>漏 Copyright 2014 Richard Atterer</i></div> <div class="breadcrumb"> <a href="#page">&nbsp;Top of page&nbsp;</a> &#8226; <a href="/">&nbsp;Home&nbsp;</a> &#8226; <a href="/sitemap">&nbsp;Sitemap&nbsp;</a> &#8226; <a href="/contact">&nbsp;Contact&nbsp;</a> &#8226; <a href="/about">&nbsp;About&nbsp;</a></div></div> </div></div> <!-- /#footer-inner, /#footer --> </div></div> <!-- /#page-inner, /#page --> <script type="text/javascript" src="/sites/atterer/files/js/js_b0b21dfadec5927599caf5b21dcf2041.js"></script> <script type="text/javascript"> <!--//--><![CDATA[//><!-- jQuery.extend(Drupal.settings, { "basePath": "/", "spamspan": { "m": "spamspan", "u": "u", "d": "d", "h": "h", "t": "t" } }); //--><!]]> </script> </body> </html>

Pages: 1 2 3 4 5 6 7 8 9 10