PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : evdev und MS Lifecam HD-5000


noid
2017-06-19, 22:28:27
Bug oder Feature?

Ich habe eine lokale Kamera, um Katzen anzuschauen. Jetzt wollte ich den motion service per Knopf auf der Kamera an und ausschalten, anstatt das per cron (was geht) oder per console zu machen.

Dummerweise geht der Knopf unter evdev (python) nur zu erkennen, wenn die Kamera "aktiv" ist. Wie bekomme ich ohne aktive Kamera den Button event mit?


pi@raspberrypi3:~ $ python3 kittycambutton.py
device /dev/input/event0, name "Microsoft® LifeCam HD-5000", phys "usb-3f980000.usb-1.3/button"
{('EV_KEY', 1): [('KEY_CAMERA', 212)], ('EV_SYN', 0): [('SYN_REPORT', 0), ('SYN_CONFIG', 1)]}
^CTraceback (most recent call last):
File "kittycambutton.py", line 9, in <module>
for event in dev.read_loop():
File "/usr/local/lib/python3.4/dist-packages/evdev/eventio.py", line 41, in read_loop
r, w, x = select.select([self.fd], [], [])
KeyboardInterrupt
pi@raspberrypi3:~ $
pi@raspberrypi3:~ $
pi@raspberrypi3:~ $ sudo service motion start
pi@raspberrypi3:~ $
pi@raspberrypi3:~ $
pi@raspberrypi3:~ $ python3 kittycambutton.py
device /dev/input/event0, name "Microsoft® LifeCam HD-5000", phys "usb-3f980000.usb-1.3/button"
{('EV_SYN', 0): [('SYN_REPORT', 0), ('SYN_CONFIG', 1)], ('EV_KEY', 1): [('KEY_CAMERA', 212)]}
key event at 1497903515.850934, 212 (KEY_CAMERA), down
synchronization event at 1497903515.850934, SYN_REPORT
key event at 1497903516.811692, 212 (KEY_CAMERA), up
synchronization event at 1497903516.811692, SYN_REPORT
key event at 1497903517.995828, 212 (KEY_CAMERA), down
synchronization event at 1497903517.995828, SYN_REPORT
key event at 1497903519.211679, 212 (KEY_CAMERA), up
synchronization event at 1497903519.211679, SYN_REPORT
key event at 1497903520.283679, 212 (KEY_CAMERA), down
synchronization event at 1497903520.283679, SYN_REPORT
key event at 1497903521.499611, 212 (KEY_CAMERA), up
synchronization event at 1497903521.499611, SYN_REPORT
key event at 1497903551.259635, 212 (KEY_CAMERA), down
synchronization event at 1497903551.259635, SYN_REPORT
key event at 1497903551.499508, 212 (KEY_CAMERA), up
synchronization event at 1497903551.499508, SYN_REPORT
^CTraceback (most recent call last):
File "kittycambutton.py", line 9, in <module>
for event in dev.read_loop():
File "/usr/local/lib/python3.4/dist-packages/evdev/eventio.py", line 41, in read_loop
r, w, x = select.select([self.fd], [], [])
KeyboardInterrupt
pi@raspberrypi3:~ $ sudo service motion stop
pi@raspberrypi3:~ $ python3 kittycambutton.py
device /dev/input/event0, name "Microsoft® LifeCam HD-5000", phys "usb-3f980000.usb-1.3/button"
{('EV_SYN', 0): [('SYN_REPORT', 0), ('SYN_CONFIG', 1)], ('EV_KEY', 1): [('KEY_CAMERA', 212)]}