USB to RS232 (serial port)? - no I need to configure anything?
Linux - HardwareThis forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
USB to RS232 (serial port)? - no I need to configure anything?
Hello,
I bought a usb-to-serial port adapter to use on my Linux Suse 10.2 laptop that does not have a serial port. While using Python to communicate through the serial port, I get errors saying that the "com1" port is not found. Is this because I need to configure the usb-to-serial port communication somehow?
I was able to execute the commands shown on the page, but had to change "mknod /dev/usb/ttyUSB0 c 188 0" etc., to "mknod /dev/bus/usb/ttyUSB0 c 188 0". I did not know what to do with "insmod usb-serial.o vendor=0xVVVV product-0xPPPP", where you need to change the VVVV and PPPP to match your device. I'm not sure where to find those numbers. I have a RadioShack 26-183 usb to serial cable.
One thought is that everything was OK to begin with and I have problems with my Python code. Another thought is that I need to make some kind of aliases. Maybe I need to do something with the "insmod usb-serial.o vendor=0xVVVV product-0xPPPP" command.
Any thoughts on this? I appreciate the feedback.
Note: After posting, I read the top hardware sticky, and typed "dmesg" in the command prompt. The following lines of note were found:
usb 2-1: new full speed USB device using uhci_hcd and address 2
usb 2-1: new device found, idVendor=1452, idProduct=4026
usb 2-1: new device strings: Mfr=1, Product=2, SerialNumber=0
usb 2-1: Product: USB-Serial Controller
usb 2-1: Manufacturer: Prolific Technology Inc.
usb 2-1: configuration #1 chosen from 1 choice
pl2303 2-1:1.0: pl2301 converter detected
usb 2-1: pl2303 converter now attached to ttyUSB0
still having the Python errors. Any way to make an alias or fix to fool Python into thinking it is looking at "com1"? This may be a Python question? I will ask around.
Note 2: Akk, I can change the port name in my script e.g. "com1". Changing it to "ttyUSB0" produces the same errors.
Sounds like your Python script was intended for Windows.
You might get some joy using '/dev/ttyUSB0' instead of 'com1', but I wouldn't bet the rent on it.
It looks like there is already a ttyS0 to ttyS7 under /dev. I wonder if I messed something up when I executed the 16 commands from my first post. Would it make sense to delete my ttyS0, then do what you mentioned above? Or would it make sense to delete what I did in my first post, then run the dmesg command again?
ser = serial.Serial('/dev/ttyS1', 9600, timeout=0)
or something. I don't know the details of pySerial (or Python, to be honest), but this page: http://pyserial.sourceforge.net/
seems to indicate that you can specify the device to use in the serial.Serial call manually.
You're right. I was playing around with that. Still the same error message only with other things I specify like /dev/ttyUSB0. I also tried backing up the ttyS0 file, linking a new one, and that did not work as well. hmmmph.
I'm still experimenting. I'm sure there is a solution around the corner.
Oh! If I log in as root and run the code using 0 or /dev/ttyUSB0 as the argument, I don't get an error message!
I think 0 works because of that new link. I was also able to make it work for non-root by changing the permissions of /dev/ttyS0 and /dev/bus/usb/ttyUSB0.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.