Hello,
in my article sispmctl I worked as root all the time. I would prefer to use “sispmctl” as normal user (and without sudo). My solution is to change the group of the entry for the power outlet in /dev/usbdev* to “plugdev”.
(By the way, this “hack” was created and tested on a Debian Lenny system.)
Check if the user is a member of the group plugdev:
crissa@unseen:~$ grep crissa /etc/group [...] plugdev:x:46:crissa [...]
If your user isn’t a member of the group “plugdev” you can add him with “adduser
Get more information about the power outlet:
unseen:~# lsusb -v [...] Bus 001 Device 027: ID 04b4:fd13 Cypress Semiconductor Corp. Device Descriptor: bLength 18 bDescriptorType 1 bcdUSB 1.10 bDeviceClass 0 (Defined at Interface level) bDeviceSubClass 0 bDeviceProtocol 0 bMaxPacketSize0 8 idVendor 0x04b4 Cypress Semiconductor Corp. idProduct 0xfd13 bcdDevice 1.01 iManufacturer 1 Gembird Electronics iProduct 2 Gembird Silver Shield PM [...]
The ipVendor and idProduct can be used to identify the power outlet.
Add an entry to the file local.rules in the directory /etc/udev/rules.d:
# 20110105 crissa sispmctl SYSTEM=="usb", ATTRS{idVendor}=="04b4", ATTRS{idProduct}=="fd13", GROUP="plugdev" # eof
I prefer to create an extra file for my own entries.
Restart udev to load the new udev rules:
unseen:~# /etc/init.d/udev restart Stopping the hotplug events dispatcher: udevd. Starting the hotplug events dispatcher: udevd.
Check /dev/usbdev* for a plugdev entry:
unseen:~# ls -l /dev/usbdev* | grep plugdev
Plug in the power outlet and check again:
unseen:~# ls -l /dev/usbdev* | grep plugdev crw-rw---- 1 root plugdev 252, 8 2011-01-05 22:22 /dev/usbdev1.28_ep00
The final test as (non root) user:
crissa@unseen:~$ sispmctl -m all Accessing Gembird #0 USB device 028 Power supply status is: off Power supply status is: off Power supply status is: off Power supply status is: off crissa@unseen:~$ sispmctl -o 1 Accessing Gembird #0 USB device 028 Switched outlet 1 on crissa@unseen:~$ sispmctl -m all Accessing Gembird #0 USB device 028 Power supply status is: on Power supply status is: off Power supply status is: off Power supply status is: off
Feel free to create a new group (maybe “sispmctl”) for the power outlet user. I don’t need an extra group so the group “plugdev” is fine with me, at least for now.
Bye, Tore