Wireless mouse write permission in hal (battery status)

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

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.

<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 <nalin@redhat.com>
    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.

/lib/udev/rules.d/50-udev-default.rules has the following section:

input

KERNEL==“mouse*|mice|event*”, NAME=“input/%k”, MODE=“0640”
KERNEL==“ts[0-9]|uinput", NAME=“input/%k”, MODE=“0600”
KERNEL=="js[0-9]
”, NAME=“input/%k”, MODE=“0644”, SYMLINK+=“%k”

I think the solution would be to change “0640” to “0666”, but (1) the same file warns:

do not edit this file, it will be overwritten on update

and (2) some devices have extended permissions to allow user access, even if belonging to user root and group root, so it might not be necessary to mess with udev?

Thanks.

brunomcl wrote:
> or login as root (once, just to test) the tab shows the battery level
> and channel selection is enabled

i’ve had a wireless laser Logitech mouse for two (or four) years and
my battery level indicator has always worked perfectly–the indication
i get is: when the batteries run out, the laser light goes out and the
mouse stops working…

prompting me to put in freshly recharged cells…

doing it that way has saved me from tinkering with permissions in
files i don’t understand…but, i’m probably less into experimentation
and more into stability/usability not to mention simplicity (battery
dead? replace, done, next item)…

ymmv


palladium

Thank you for sharing your experience, but indeed my mileage varies. I’ll try to summarize why I want to use this module without expending too much time:

  1. mouse performance deteriorate before red light blinks out, and you don’t know if it’s the battery or the IR receiver or the transmitter or interference, or…
  2. frequency change may avoid interference (wireless phones, etc.)
  3. because it’s there.
  4. learning how to do something better than you did before is (almost) always good.

Now, if someone knows how to change device permissions, I’d be much obliged.

TIA