Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Script to control Kinect led + hook #376

Closed
oeildefeu opened this Issue Jan 19, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@oeildefeu
Copy link

oeildefeu commented Jan 19, 2017

Hi,
I just want to share my script (adapted from somewhere else allowing to change the led status of the kinect

#! /usr/bin/env python
import usb.core
import usb.util
import sys

find our device

dev = usb.core.find(idVendor=0x045e, idProduct=0x02B0)

was it found?

if dev is None:
raise ValueError('Device not found')

set the active configuration. With no arguments, the first configuration will be the active one

dev.set_configuration()

if sys.argv[1] == 'off':
led_value = 0x0
elif sys.argv[1] == 'green':
led_value = 0x1
elif sys.argv[1] == 'red':
led_value = 0x2
elif sys.argv[1] == 'orange':
led_value = 0x3
elif sys.argv[1] == 'blink_yellow':
led_value = 0x4
elif sys.argv[1] == 'blink_green':
led_value = 0x5
elif sys.argv[1] == 'blink_red_yellow':
led_value = 0x6
else:
led_value = 0x4

ret = dev.ctrl_transfer(0x40, 0x6, led_value, 0, [])
#print ret

then, you can create hook
on startup: /home/path/to/led_kinect.py green
on exit: /home/path/to/led_kinect.py off
on command : /home/path/to/led_kinect.py orange
etc...

all the colors are not working on my kinect (blinking orange for instance...) but this can give you a visual aspect of what is going on

@oeildefeu oeildefeu closed this Jan 21, 2017

@oeildefeu oeildefeu reopened this Jan 21, 2017

@alexylem

This comment has been minimized.

Copy link
Owner

alexylem commented Jan 26, 2017

Merci, c'est maintenant référencé sur le site:
http://domotiquefacile.fr/jarvis/content/hooks
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.