0

I am trying to work with raw GPS data from a USB GPS receiver (Delorme LT-20) through /dev/ttyUSB0/.

My program had been working, but today I get this error:

could not open port /dev/ttyUSB0: [Errno 16] Device or resource busy: '/dev/ttyUSB0'

The program is pretty simple:

import serial ser = serial.Serial('/dev/ttyUSB0') 

How do I fix this?

7
  • 1
    To rule out the obvious and assuming you made no other changes did you reboot. Commented Dec 19, 2016 at 5:49
  • What does lsof say? Commented Dec 19, 2016 at 8:08
  • 1
    This never gets old. Commented Dec 19, 2016 at 10:48
  • Steve Robillard- No changes, reboot, power-down & restart, unplug & reinsert the USB device. no change. It had been working during my earlier experiments. Commented Dec 19, 2016 at 15:18
  • Bex- lsof output is here: dropbox.com/s/cqiw9s74n4ah832/lsof.txt?dl=0 I don't see tty or USB anywhere, but I did try gpsd a few days back- could there be a daemon running? (If yes, how do I kill it?) Commented Dec 19, 2016 at 15:30

1 Answer 1

1

I know that this is a rather old question, but since I had the same problem I wanted to share my solution (apart from turning it off and on again, which also helped): list the processes which are using the resource and kill them.

Two options are available for this:

$ fuser /dev/ttyUSB0 

If that returns nothing, try

$ sudo lsof /dev/ttyUSB0 

Then issue a kill using the PID contained in the return-value of the above listed commands.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.