3

I made a harmonograph (Drawing machine to draw Lissajous curves). Its an analog machine with a digital component. The analog portion is non interruptible. the digital component is a drawing tablet, connected via usb to an Ubuntu server. An Arduino sends keystrokes to the server for creating new files, and for saving old ones. The issue is that in the ~100ms that file operations take, the drawing program continues to read the drawing tablet, but not log the current position. When the file IO returns, the new coordinate is interpolated with the last known coordinate. This generates a line in the resulting image. See image, pictures on right, where said line is especially noticeable: Appalling lines

I don't want to kill the process. I want to stop listening to the USB drawing tablet momentarily. akin to unplugging it. (I can build a circuit to do that if I have to, the previous version worked that way)

from

 $lsusb
...
  Bus 001 Device 005: ID 056a:00de Wacom Co., Ltd CTH-470 [Bamboo Fun Pen & Touch]
....

The server webpage (gallery) is generated with a bash script. A suitable bash command to stop and start the USB tablet is what I'm after.

j0h
  • 14,825

1 Answers1

1

You can unbind an USB. You need to know the USB digits for that.

echo '{usbid}' |sudo tee /sys/bus/usb/drivers/usb/unbind

where {usbid} consist of a bus and port for a specific USB.

lsusb or lsusb -t will list the details. For instance:

$ lsusb
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 003: ID 27c6:6a94 Shenzhen Goodix Technology Co.,Ltd. Goodix USB2.0 MISC
Bus 003 Device 002: ID 0bda:5641 Realtek Semiconductor Corp. LG Camera
Bus 003 Device 004: ID 8087:0026 Intel Corp. AX201 Bluetooth
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

or

$ lsusb -t
/:  Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 10000M
/:  Bus 03.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/12p, 480M
    |__ Port 2: Dev 2, If 0, Class=Video, Driver=uvcvideo, 480M
    |__ Port 2: Dev 2, If 1, Class=Video, Driver=uvcvideo, 480M
    |__ Port 7: Dev 3, If 0, Class=Vendor Specific Class, Driver=, 12M
    |__ Port 10: Dev 4, If 0, Class=Wireless, Driver=btusb, 12M
    |__ Port 10: Dev 4, If 1, Class=Wireless, Driver=btusb, 12M
/:  Bus 02.Port 1: Dev 1, Class=roo

t_hub, Driver=xhci_hcd/4p, 10000M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/1p, 480

or just a list:

$ ls /sys/bus/usb/devices
1-0:1.0  3-0:1.0  3-10:1.0  3-2      3-2:1.1  3-7:1.0  usb1  usb3
2-0:1.0  3-10     3-10:1.1  3-2:1.0  3-7      4-0:1.0  usb2  usb4

===

Bus 001 Device 005: ID 056a:00de Wacom Co., Ltd CTH-470 [Bamboo Fun Pen & Touch]

wouldb e 1-0:5.0 but you can confirm the "minor" numbers with the commands above (it could also be 1-0:5 or 1-1:5)

Rinzwind
  • 299,756