Hotplug mods

This text is copied from and describes how to set up hotplug so that the logged in user has ownership of the USB device associated with the REB-1100.

Begin Copied Text

There is a command line program that will let you use the RCA REB1100 eBook reader with Linux. The program is called rebcomm and you can download it from The only problem is that only root can use the program. Because I hate running programs as root, and don't like to suid programs if I don't have to, I worked out how to let the user logged in at the console do it.

Here is what I did. First, I looked in /proc/bus/usb/devices to get the Vendor and Product IDs for the device. They are Vendor=0993 ProdID=0001. I used these to create an entry in /etc/hotplug/usb.usermap for the reader.

rebcomm 0x0003 0x0993 0x0001 0x0000 0x0000 0x00 0x00 0x00 0x00 0x00

I then changed to the /etc/hotplug/usb directory. Here I created the rebcomm script based on the usbcam script from gphoto2.

# /etc/hotplug/usb/rebcomm
# Script to set permissions for the REB-1100
# In the usermap file, the first field "usb module" should be named
# "rebcomm" like this script.

if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
    # New code, using lock files instead of copying /dev/console permissions
    # This also works with non-gdm logins (e.g. on a virtual terminal)
    # Idea and code from Nalin Dahyabhai <>
    if [ -f /var/run/console.lock ]
        CONSOLEOWNER=`cat /var/run/console.lock`
    elif [ -f /var/lock/console.lock ]
        CONSOLEOWNER=`cat /var/lock/console.lock`
    if [ -n "$CONSOLEOWNER" ]
        chmod 0000 "${DEVICE}"
        chown "$CONSOLEOWNER" "${DEVICE}"
        chmod 0600 "${DEVICE}"

Now, when you plug in the reader, the ownership of the device is changed to the user logged in at the console. If you wanted to, you could change the script so anyone could access the reader. But I don't know what would happen if more then one person tried to access it at the same time…

This was tested with 10.2, but it should work fine with 10.1 as well.

– MikkelEllertson - 27 Jun 2005

End Copied Text

Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki