I'm trying to get a USB serial device ( a GlobalSat BU-353N5 USB GPS ) up and working on an Ubuntu 18.04 PC running as a VMWare VM. I have USB pass thru enabled and I can see the device appear and disappear when I plug and unplug it after running lsusb each time.
The Ubuntu 18.04 VM has kernel version : 5.4.0-84-generic
When I run dmesg however, it wont list any ttyUSB0 devices and it wont create a /dev/ttyUSB0 when I plug the device in. On another ubuntu PC with similar kernel version, it works fine.
So when I run my python script ( that works fine on my home PC ) I get this error :
import serial
from decimal import Decimal
ser = serial.Serial('/dev/ttyUSB0',4800,timeout=5)
while 1:
line = ser.readline().decode()
break
Script output :
Traceback (most recent call last):
File "/home/xx/.local/lib/python3.6/site-packages/serial/serialposix.py", line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
FileNotFoundError: [Errno 2] No such file or directory: '/dev/ttyUSB0'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run_gps.py", line 4, in <module>
ser = serial.Serial('/dev/ttyUSB0',4800,timeout=5)
File "/home/xx/.local/lib/python3.6/site-packages/serial/serialutil.py", line 244, in __init__
self.open()
File "/home/xx/.local/lib/python3.6/site-packages/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 2] could not open port /dev/ttyUSB0: [Errno 2] No such file or directory: '/dev/ttyUSB0'
So wanted to make sure we had the correct drivers ( usbserial and pl2303 ) installed using this method :
$ apt list linux-modules-extra-5.4.0-84-generic
linux-modules-extra-5.4.0-84-generic/disco-updates,disco-security,now 5.4.0-84 amd64 [installed,automatic]
Then verify that the module is included in this installed package.
$ dpkg -L linux-modules-extra-5.4.0-84-generic | grep usbserial
/lib/modules/5.4.0-84-generic-generic/kernel/drivers/usb/serial/usbserial.ko
$ dpkg -L linux-modules-extra-5.4.0-84-generic | grep pl2303
/lib/modules/5.4.0-84-generic/kernel/drivers/usb/serial/pl2303.ko
Now install the kernel modules (drivers):
$ sudo modprobe usbserial
$ sudo modprobe pl2303
So now when I run lsmod, I can see the drivers in use.
testuser@ubuntu18:~/Documents# sudo lsmod
Module Size Used by
pl2303 24576 0
usbserial 49152 1 pl2303
rfcomm 81920 4
binfmt_misc 24576 1
bnep 24576 2
vmw_vsock_vmci_transport 32768 2
vsock 36864 3 vmw_vsock_vmci_transport
intel_rapl_msr 20480 0
intel_rapl_common 24576 1 intel_rapl_msr
crct10dif_pclmul 16384 1
How do I confirm all components needed are in place for a connection to exist between the USB device and the linux OS e.g. need drivers, possibly a udev script, anything else?
I have seen some people working with files in /etc/udev/rules.d/ , but I am not sure if we need to modify these files manually and if so how could you build a basic script to test end to end functionality.
I'm not that experienced with linux, so need help to try and work out what's either missing and/or misconfigured. Sometimes you just don't know what you don't know. I'm not lazy, rather just absolutely flat out not sure what's broken or missing. I've spend close to 20 hours of research so far building VMs and trying ideas but so far no joy.
Any ideas appreciated.
Update 1
dmesg for faulty/not working PC:
[ 272.061687] usb 2-2.2: new full-speed USB device number 5 using uhci_hcd
[ 272.395020] usb 2-2.2: New USB device found, idVendor=067b, idProduct=23a3, bcdDevice= 1.05
[ 272.395030] usb 2-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 272.395092] usb 2-2.2: Product: USB-Serial Controller
[ 272.395100] usb 2-2.2: Manufacturer: Prolific Technology Inc.
[ 272.395104] usb 2-2.2: SerialNumber: BGDGb115819
dmesg for working PC:
[552777.274363] usb 1-12: new full-speed USB device number 23 using xhci_hcd
[552777.423614] usb 1-12: New USB device found, idVendor=067b, idProduct=23a3, bcdDevice= 1.05
[552777.423620] usb 1-12: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[552777.423623] usb 1-12: Product: USB-Serial Controller
[552777.423627] usb 1-12: Manufacturer: Prolific Technology Inc.
[552777.423629] usb 1-12: SerialNumber: BGDGb115819
[552777.425292] pl2303 1-12:1.0: pl2303 converter detected
[552777.425659] usb 1-12: pl2303 converter now attached to ttyUSB0
Update 2
Output from dmesg just now for faulty/not working PC:
[ 723.726923] usb 2-2.2: new full-speed USB device number 7 using uhci_hcd
[ 724.063701] usb 2-2.2: New USB device found, idVendor=067b, idProduct=23a3, bcdDevice= 1.05
[ 724.063712] usb 2-2.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 724.063718] usb 2-2.2: Product: USB-Serial Controller
[ 724.063723] usb 2-2.2: Manufacturer: Prolific Technology Inc.
[ 724.063727] usb 2-2.2: SerialNumber: BGDGb115819