quarta-feira, outubro 23, 2019

Restart ttyUSB or linux usb to serial force stop

Simple steps
modprobe -r ch341modprobe -r usbserialmodprobe ch341
---
explanation...

The below seems to solve my problem, but not always.
  1. Find the driver associated to your ttyUSBx device.
    [my-pc]# cat /proc/tty/drivers
    /dev/tty             /dev/tty        5       0 system:/dev/tty
    /dev/console         /dev/console    5       1 system:console
    /dev/ptmx            /dev/ptmx       5       2 system
    /dev/vc/0            /dev/vc/0       4       0 system:vtmaster
    rfcomm               /dev/rfcomm   216 0-255 serial
    usbserial            /dev/ttyUSB   188 0-253 serial
    ttyprintk            /dev/ttyprintk   5       3 console
    serial               /dev/ttyS       4 64-111 serial
    pty_slave            /dev/pts      136 0-1048575 pty:slave
    pty_master           /dev/ptm      128 0-1048575 pty:master
    unknown              /dev/tty        4 1-63 console
    
    You can see that /dev/ttyUSB uses usbserial. Now dig a little further:
    [my-pc]# lsmod | grep usbserial
      usbserial              37173  1 pl2303
    
    In my case, my USB-to-serial converter is a Prolific PL2303. If you have a FTDI adapter, I think you should see ftdi_sio instead of pl2303.
  2. Unload the driver
    sudo modprobe -r pl2303 #or the name that matches your config
    sudo modprobe -r usbserial
  3. Re-load the driver
    sudo modprobe pl2303 #or the name that matches your config
  4. Re-launch your serial communication

Nenhum comentário: