I am using a USB IR Toy v2 and using this excellent https://github.com/crleblanc/PyIrToy python library to get it working after failing to get things going with LIRC. However, while it works once, repeated usage results in failure because of some sort of "buffer underrun" as detailed by the developer here https://github.com/crleblanc/PyIrToy/issues/2. Since the only solution seems is to perform a replug, can't we use a dirty hack of programatically reset (equivalent to manual unplugging and replugging) the /dev/ttyACM0 device.
2 Answers
I had an error with a printer doing this occationally. I found an answer back then on an Ubuntu (also Debian basded) forum.
$ cc usbreset.c -o usbreset
$ lsusb
Bus 002 Device 003: ID 0fe9:9010 DVICO
$ chmod +x usbreset
$ sudo ./usbreset /dev/bus/usb/002/003
-
2
-
I already tried that but it errors :
./usbreset /sys/bus/usb/devices/1-1.3/ Error opening output file: Is a directory
Or ` ./usbreset /dev/ttyACM0 Resetting USB device /dev/ttyACM0 Error in ioctl: Invalid argument ` Commented Jul 16, 2013 at 2:43 -
1@lenik you can get usbreset from - marc.info/?l=linux-usb&m=121459435621262&w=2 Commented Jul 16, 2013 at 2:47
-
Looks like they beat me to it. That's exactly where I got it from. Commented Jul 16, 2013 at 14:54
#!/usr/bin/python
from usb.core import find as finddev
dev = finddev(idVendor=0x1234, idProduct=0x5678)
dev.reset()
-
1In future do not post duplicate answers the system flags these and they will be deleted. Rather you should flag the older one as a duplicate and a moderator will close one and link to the other. Commented Dec 25, 2016 at 22:48