Kill process that raises Device or resource busy: '/dev/ttyUSB0'?

前端 未结 3 660
时光说笑
时光说笑 2021-02-18 22:42

I connect to my Arduino board with the following Python code.

device=glob.glob(\"/dev/ttyUSB*\")[0]
time.sleep(1)
arduino = serial.Serial(device, 115200, timeout         


        
3条回答
  •  隐瞒了意图╮
    2021-02-18 23:38

    In my case

    $ fuser /dev/ttyUSB0
    

    was not working (it showed nothing).

    What was working, however, was the following:

    $ sudo lsof /dev/ttyUSB0
    

    This gave me a list of the processes that were using my serial port and I could simply kill them using the PID (corresponding to the second column in the list).

提交回复
热议问题