LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (http://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   How to control LEDs from USB Webcam? (http://www.linuxquestions.org/questions/linux-hardware-18/how-to-control-leds-from-usb-webcam-4175443370/)

aurium 12-29-2012 10:55 AM

How to control LEDs from USB Webcam?
 
I have a new chinese webcam plugable by USB, with 6 LEDs to help night talks. However the lights do not turn on. Never! The cam has no buttons and the box says that is compatible with Linux.

I try the cam with Cheese and GUVCViewer. The cam works with no changes on LEDs and the mic do not works. (forgot the mic by now...)

Code:

$ lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
...
Bus 001 Device 009: ID 0c45:62c0 Microdia Sonix USB 2.0 Camera

Looks ok.

As i know, we can directly change some hardware configurations, writing on /sys, so first i found camera path:
Code:

# dmesg | grep -i camera
...
[66449.007123] input: USB 2.0 Camera as /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0/input/input14

Second, search for *led*:
Code:

# ls /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14
capabilities  device  event10  id  modalias  name  phys  power        properties  subsystem  uevent  uniq
# ls /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14/capabilities/
abs  ev  ff  key  led  msc  rel  snd  sw

Found!

Code:

# cat /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14/capabilities/led
0

hummm... may changing to 1 that will turn on.

Code:

# ls -l /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14/capabilities/led
-r--r--r-- 1 root root 4096 Dez 29 12:34 /sys/devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0/input/input14/capabilities/led

Code:

# chmod +w /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14/capabilities/led
Ok! That is -rw-r--r-- now.

Code:

# echo 1 > /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14/capabilities/led
-bash: echo: write error: Input/output error

WTF?

Trying another way... The uevent special file looks promising:
Code:

# cat /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14/uevent
PRODUCT=3/c45/62c0/100
NAME="USB 2.0 Camera"
PHYS="usb-0000:00:1d.7-3/button"
PROP=0
EV=3
KEY=100000 0 0 0 0 0 0
MODALIAS=input:b0003v0C45p62C0e0100-e0,1,kD4,ramlsfw

Code:

# echo LED=1 >> /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14/uevent
No fail!

Code:

# cat /sys/devices/pci0000\:00/0000\:00\:1d.7/usb1/1-3/1-3\:1.0/input/input14/uevent
PRODUCT=3/c45/62c0/100
NAME="USB 2.0 Camera"
PHYS="usb-0000:00:1d.7-3/button"
PROP=0
EV=3
KEY=100000 0 0 0 0 0 0
MODALIAS=input:b0003v0C45p62C0e0100-e0,1,kD4,ramlsfw

But no change too. :(

That is wrong? There is another way?
I only want to turn on the webcam lights.

roreilly 01-03-2013 07:41 AM

What model of camera? Do you have a link to the product page?

Any chance those led's are infrared? If so, you won't see when they are on, but the camera's sensors
will be able to.

aurium 01-03-2013 08:31 PM

The cam looks exactly like that: http://sell.lulusoso.com/selling-lea...mera-k038.html ... but that is a common design for webcams.

The box has no reference to the manufacturer or any product detail. The only useful thing on the box is: "driveless camera" and "Support Windows, MacOS and Linux". The cam itself has no number, code or anything written on that.

The LEDs are not infrared. That was my first try. :(


All times are GMT -5. The time now is 08:26 AM.