blinkstick-python icon indicating copy to clipboard operation
blinkstick-python copied to clipboard

Blinkstick Flex on Windows crashes on get_led_count()

Open dramamine opened this issue 9 years ago • 8 comments

This function is working for me on OSX but not on Windows. count = stick.get_led_count() File "C:\Python27\lib\site-packages\blinkstick\blinkstick.py", line 539, in get_led_count device_bytes = self._usb_ctrl_transfer(0x80 | 0x20, 0x1, 0x81, 0, 2) File "C:\Python27\lib\site-packages\blinkstick\blinkstick.py", line 235, in _usb_ctrl_transfer return self.reports[wValue - 1].get() IndexError: list index out of range

Was debugging a bit, and in this case wValue is 129. I tried hacking at the code but to me it looks like self.reports only has 4 entries, so wValue is way out there. Happy to help debug a bit if you're missing the hardware. As a hacky fix I just changed get_led_count to "return 32" but that's not something I should share with anyone! Basically all the other stuff I'm trying to do with the SDK works fine.

dramamine avatar Jan 15 '17 21:01 dramamine

Try to change line 539 like this: device_bytes = self._usb_ctrl_transfer(0x80 | 0x20, 0x1, 0xA, 0, 2)

p0ke234 avatar Jan 17 '17 20:01 p0ke234

Yep, that did the trick! What's happening there?

dramamine avatar Jan 18 '17 06:01 dramamine

This wont work for me on Windows10 am i doing something wrong? File "C:/Blinkstick-stuff/blinkpulse-visualizer-master-3616d2d2eadc92607fc0fd2077aa8c2aa6389392/blinkpulse.py", line 41, in count = stick.get_led_count() File "C:\Users\DJ-Lucas\AppData\Local\Programs\Python\Python36-32\lib\site-packages\blinkstick\blinkstick.py", line 513, in get_led_count device_bytes = self._usb_ctrl_transfer(0x80 | 0x20, 0x1, 0x81, 0, 2) File "C:\Users\DJ-Lucas\AppData\Local\Programs\Python\Python36-32\lib\site-packages\blinkstick\blinkstick.py", line 235, in _usb_ctrl_transfer return self.reports[wValue - 1].get() IndexError: list index out of range

dj-lucas avatar Oct 25 '17 21:10 dj-lucas

As you can see in your error message you did not change the regarding line in your blinkstick.py. The line number means to me that you´ve changed something more in your blinkstick.py as the line must be somewhere at 538/539.

p0ke234 avatar Oct 26 '17 08:10 p0ke234

i have reloaded the original blinkstick.py. and im getting this now: Traceback (most recent call last): File "C:/Blinkstick-stuff/blinkpulse-visualizer-master-3616d2d2eadc92607fc0fd2077aa8c2aa6389392/blinkpulse.py", line 41, in count = stick.get_led_count() File "C:\Users\DJ-Lucas\AppData\Local\Programs\Python\Python36-32\lib\site-packages\blinkstick\blinkstick.py", line 538, in get_led_count device_bytes = self._usb_ctrl_transfer(0x80 | 0x20, 0x1, 0x81, 0, 2) File "C:\Users\DJ-Lucas\AppData\Local\Programs\Python\Python36-32\lib\site-packages\blinkstick\blinkstick.py", line 235, in _usb_ctrl_transfer return self.reports[wValue - 1].get() IndexError: list index out of range

dj-lucas avatar Oct 26 '17 14:10 dj-lucas

Hey Lucas, still no change at the regarding line. As stated in the workaround above: Try to change line 538 in blinkstick.py like this: device_bytes = self._usb_ctrl_transfer(0x80 | 0x20, 0x1, 0xA, 0, 2)

p0ke234 avatar Oct 26 '17 20:10 p0ke234

I have tried that but it didn't work for me. I have given up on trying to use the "get_led_count()" function because everything else is working fine so far.

dj-lucas avatar Oct 26 '17 20:10 dj-lucas

Hey, I can fix that the change you suggested is working, could this please be released in the package?

mitom avatar Sep 16 '18 09:09 mitom