[COLUG] USB to serial converter, udev rule making, one problem
solved
Mark L. Wise
mark at alpha2.com
Tue Dec 18 17:38:31 EST 2007
Charlie,
Now that you have the COM1: -> /dev/COM1 problem solved, adjust your
qbasic program to simply open the COM: port WITHOUT the baud, number of
bits, etc. code. It should default to 9600 baud, full duplex (check
with stty). See if it works then. If so, then the problem is simply
with how, in qbasic, to adjust the stty parameters..
Mark
charles morrison wrote:
> To All:
> Review of problem.
> The initial request for ideas came from my attempt to install a qbasic
> program under dosemu in which I discovered that the dosemu would not
> recognize my serial port which is a USB to serial converter. There are
> actually two problems: the first is that even though our qbasic
> program runs under dosemu, the serial port did not work, and the
> second was that the symlink created using udev rules did not work. I
> have solved the mystery of the second problem.
>
> The reason for using udev was to create a known point to communicate
> to DOS devices using a USB to serial converter. Typically, DOS
> programs use COM1, COM2, etc as devices. They must always be at the
> same device node, or else when plugging and unplugging devices, the
> DOS program cannot search and adjust its node point, so a fixed node
> name is desired. I used udev to create this device name as /dev/COM1
> for this program. Then the /etc/dosemu/dosemu.conf file can be
> adjusted to always look at /dev/COM1 as COM1 for all DOS programs.
> Similarly, a symlink can then be used under WINE in the dosdevices
> directory.
>
> My udev rules worked and created a symlink to a COM1, to which I could
> never send data, even though it worked for the original device node
> and under a dosemu command prompt. The reason was in the manner in
> which udev creates symlinks (which I do not fully understand).
>
> My current and working rule is for a Belkin USB to serial converter:
>
> /SUBSYSTEMS=="usb-serial", DRIVERS=="mct_u232", SYMLINK+="COM1",
> GROUP="dialout", MODE="777"/
>
> This recognizes the USB to serial converter when it is plugged in and
> then adds a symlink to it as /dev/COM1.
> The problem arose due to matching udev parameters, but not at the
> correct level in the hierarchy.
>
> Explanation:
>
> Using the /udevinfo -a -p $(udevinfo -q path -n /dev/ttyUSB0)/ command
> yields:
>
> looking at device '/class/tty/ttyUSB0':
> KERNEL=="ttyUSB0"
> SUBSYSTEM=="tty"
> DRIVER==""
> ATTR{dev}=="188:0"
>
> looking at parent device
> '/devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1:1.0/ttyUSB0':
> KERNELS=="ttyUSB0"
> /SUBSYSTEMS=="usb-serial"/
> /DRIVERS=="mct_u232"/
>
> looking at parent device
> '/devices/pci0000:00/0000:00:13.0/usb1/1-1/1-1:1.0':
> KERNELS=="1-1:1.0"
> SUBSYSTEMS=="usb"
> DRIVERS=="mct_u232"
> ATTRS{modalias}=="usb:v050Dp0109d0102dc00dsc00dp00icFFiscFFipFF"
> ATTRS{bInterfaceProtocol}=="ff"
> ATTRS{bInterfaceSubClass}=="ff"
> ATTRS{bInterfaceClass}=="ff"
> ATTRS{bNumEndpoints}=="03"
> ATTRS{bAlternateSetting}==" 0"
> ATTRS{bInterfaceNumber}=="00"
>
> looking at parent device '/devices/pci0000:00/0000:00:13.0/usb1/1-1':
> KERNELS=="1-1"
> *SUBSYSTEMS=="usb"*
> DRIVERS=="usb"
> ATTRS{serial}=="927135"
> *ATTRS{product}=="Belkin Components"*
> ATTRS{manufacturer}=="Belkin USB PDA Adapter"
> ATTRS{quirks}=="0x0"
> ATTRS{maxchild}=="0"
> ATTRS{version}==" 1.10"
> ATTRS{devnum}=="4"
> ATTRS{busnum}=="1"
> ATTRS{speed}=="12"
> ATTRS{bMaxPacketSize0}=="16"
> ATTRS{bNumConfigurations}=="1"
> ATTRS{bDeviceProtocol}=="00"
> ATTRS{bDeviceSubClass}=="00"
> ATTRS{bDeviceClass}=="00"
> ATTRS{bcdDevice}=="0102"
> ATTRS{idProduct}=="0109"
> .
> .
> .
> .
>
>
> When I used the wrong parameters *
> SUBSYSTEMS=="usb"/ /and*
> *ATTRS{product}=="Belkin Components"
> *I got a symlink which did not work and was of the form: crwxrwxrwx 1
> root dialout 254, 11 2007-12-18 11:16 ./usbdev1.4_ep02, and also did
> not work, since major device 254 is an experimental device node.
>
> When I moved up into the udev description and used
> /SUBSYSTEMS=="usb-serial"/
> /DRIVERS=="mct_u232"
> /the symlink became
> lrwxrwxrwx 1 root root 7 2007-12-18 11:43 COM1 -> ttyUSB0
>
> and it now works just as well as if I were using /dev/ttyUSB0.
>
> This problem is solved, but I still have not gotten my qbasic program
> to use the serial port.
>
> Charlie Morrison
>
> //
>
--
Mark L. Wise
Alpha II Service, Inc.
1312 Epworth Ave
Reynoldsburg, Ohio 43068-2116
USA
Office: (614) 868-5033
Fax: (614) 868-1060
Email: mark at alpha2.com
WEB: www.alpha2.com
More information about the colug432
mailing list