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.
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
#!/usr/bin/python from usb.core import find as finddev dev = finddev(idVendor=0x1234, idProduct=0x5678) dev.reset()