cp210x.ko hangs on open attempt

Rick Stevens ricks at nerd.com
Wed Sep 29 16:10:35 UTC 2010


On 09/29/2010 08:55 AM, Roger K. Wells wrote:
>
>    I have a RS485 serial device (Quatech SSU2-300) that when plugged
> into a USB (2.0) port appears to be recognized correctly. dmesg yields:
>
> cp210x 3-1:1.0: cp210x converter detected
> usb 3-1: reset full speed USB device using uhci_hcd and address 8
> usb 3-1: cp210x converter now attached to ttyUSB0
>
> A "C" language program attempting to use this port hangs at the
> open call.
>
> This same program with the same device worked on a Centos 5.5
> install on the same computer.
>
> uname -r : 2.6.34.7-56.fc13.x86_64
>
> The USB device works in Windows XP so I don't think there is a defect
> there.
>
> Any thoughts will be appreciated.

Check the permissions on /dev/ttyUSB0 and make sure the user you're 
running the C program as has permissions.  You might also have a
look to see if there's an SELinux denial associated with the attempt.
It's not uncommon for udev and/or packagekit and/or SELinux to set up
incorrect permissions or not have a context rule--especially on a
device few people have around to test with (and I doubt a lot of us
have a USB<-->RS485 adapter).  :-)

If you have the source to the program you could change the open call to
a non-blocking open and print out the resulting error code:

	#include <string.h>
	#include <errno.h>

	extern int errno;
	if ((fdc = open("/dev/ttyUSB0", O_RW | O_NONBLOCK)) < 0)
		printf("Can't open ttyUSB0: %s\n", strerror(errno));

You get the idea.
----------------------------------------------------------------------
- Rick Stevens, Systems Engineer, C2 Hosting          ricks at nerd.com -
- AIM/Skype: therps2        ICQ: 22643734            Yahoo: origrps2 -
-                                                                    -
-      Cuteness can be overcome through sufficient bastardry         -
-                                         --Mark 'Kamikaze' Hughes   -
----------------------------------------------------------------------


More information about the users mailing list