2

Wireless mouse write permission in hal (battery status)

view story
linux-howto

http://forums.opensuse.org – Hi there, I have an USB wireless logitech kbd/mouse combo connected to a machine running oS11.1/KDE3.5. In KDE Control Center>Hardware>Mouse>Logitech Support tab, the set is seen as 'Elite Duo Wireless' or something similar, I'm not at that machine ATM. If I do Code: su kcmshell mouse or login as root (once, just to test) the tab shows the battery level and channel selection is enabled, but as normal user they're grayed out. KDE help say that to enable it it's necessary that the user have read/write permissions to the device, and give a long list of changes to do it, but related to hotplug, which I understand was replaced by hal/udev. lshal shown '/dev/input/event0' and 'event1' are related to the logitech device, probably one is the mouse and the other the keyboard. Just in the off-chance it might work I changed permissions on these devices (and '/dev/input/mouse0' and 'mice') to rw for group and others, but nothing happened. I've searched around but could not find any specific instruction to do this. i.e., give the normal user write permission to the mouse. How can I go about this? Thanks. Obs: FWIW this is part of the english text in /opt/kde3/share/doc/HTML/en/kcontrol/mouse. Sorry about the formatting, the nice help pages I have are in pt_BR. HTML Code: <title>Fixing permission problems on Logitech mice</title> <para> Because of the way USB devices work, the code that accesses the current status on Logitech mice needs to be able to write to the mouse. This should be handled by your distribution, but if not, you may need to do some configuration yourself. </para> <para> On a Linux system, you should use the hotplug system to change the ownership and permissions on the mouse entry in <filename>/proc/bus/usb</filename>. One way to do this is to create a short script (<filename>/etc/hotplug/usb/consoleUserPerms</filename>) that changes the ownership and permissions, as shown below: </para> <informalexample> <programlisting> <![CDATA[ #!/bin/bash # # /etc/hotplug/usb/consoleUserPerms # # Sets up newly plugged in USB device so that the user who owns # the console according to pam_console can access it from user space # # Note that for this script to work, you'll need all of the following: # a) a line in the file /etc/hotplug/usb.usermap or another usermap file #    in /etc/hotplug/usb/ that corresponds to the device you are using. # b) a setup using pam_console creates the respective lock files #    containing the name of the respective user. You can check for that #    by executing "echo `cat /var/{run,lock}/console.lock`" and #    verifying the appropriate user is mentioned somewhere there. # c) a Linux kernel supporting hotplug and usbdevfs # d) the hotplug package (http://linux-hotplug.sourceforge.net/) # # In the usermap file, the first field "usb module" should be named # "consoleUserPerms" to invoke this script. # if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ] then # New code, using lock files instead of copying /dev/console permissions # This also works with non-kdm logins (e.g. on a virtual terminal) # Idea and code from Nalin Dahyabhai <[email protected]>     if [ -f /var/run/console.lock ]     then         CONSOLEOWNER=`cat /var/run/console.lock`     elif [ -f /var/lock/console.lock ]     then         CONSOLEOWNER=`cat /var/lock/console.lock`     else         CONSOLEOWNER=     fi     if [ -n "$CONSOLEOWNER" ]     then         chmod 0000 "${DEVICE}"         chown "$CONSOLEOWNER" "${DEVICE}"         chmod 0600 "${DEVICE}"     fi fi ]]> </programlisting> </informalexample> <para> The usermap file that goes with this is <filename>/etc/hotplug/usb/logitechmouse.usermap</filename>, as shown below: </para> <informalexample> <programlisting> <![CDATA[ # script          match_flags idVendor idProduct bcdDevice_lo bcdDevice_hi bDeviceClass bDeviceSubClass bDeviceProtocol bInterfaceClass bInterfaceSubClass bInterfaceProtocol driver_info # Wheel Mouse Optical consoleUserPerms    0x0003      0x046d  0xc00e    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # MouseMan Traveler consoleUserPerms    0x0003      0x046d  0xc00f    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # MouseMan Dual Optical consoleUserPerms    0x0003      0x046d  0xc012    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # MX310 Optical Mouse consoleUserPerms    0x0003      0x046d  0xc01b    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # MX510 Optical Mouse consoleUserPerms    0x0003      0x046d  0xc01d    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # MX300 Optical Mouse consoleUserPerms    0x0003      0x046d  0xc024    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # MX500 Optical Mouse consoleUserPerms    0x0003      0x046d  0xc025    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # iFeel Mouse consoleUserPerms    0x0003      0x046d  0xc031    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # Mouse Receiver consoleUserPerms    0x0003      0x046d  0xc501    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # Dual Receiver consoleUserPerms    0x0003      0x046d  0xc502    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # Cordless Freedom Optical consoleUserPerms    0x0003      0x046d  0xc504    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # Cordless Elite Duo consoleUserPerms    0x0003      0x046d  0xc505    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # MX700 Optical Mouse consoleUserPerms    0x0003      0x046d  0xc506    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # Cordless Optical Trackman consoleUserPerms    0x0003      0x046d  0xc508    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # Cordless MX Duo Receiver consoleUserPerms    0x0003      0x046d  0xc50b    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # MX100 Laser Mouse consoleUserPerms    0x0003      0x046d  0xc50e    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 # Receiver for Cordless Presenter consoleUserPerms    0x0003      0x046d  0xc702    0x0000      0xffff      0x00        0x00            0x00            0x00            0x00              0x00              0x00000000 ]]> </programlisting> </informalexample> <para> That should be all that is needed on Linux - just copy the files into <filename>/etc/hotplug/usb/</filename>, and when the mouse is plugged in, the ownership and permissions should be changed so that the user at the console can access the mouse. (Distributions)