Serial-/USB-Devices at COM-Port

Questions about Wine on Linux
Locked
Zucchero
Newbie
Newbie
Posts: 1
Joined: Mon Oct 08, 2018 10:06 am

Serial-/USB-Devices at COM-Port

Post by Zucchero »

Hello everyone,

I have a shooting chronograph with a RS232-Port and a Software for Win and want to run it with Linux Mint 19 64bit. But I cant get a connection to the device. What have I done?

I'm using Wine 3.0.3 and mapped the COM-Port to USB, as shown here:
https://wiki.winehq.org/Wine_User%27s_G ... llel_Ports
Also my User is in the groups sys and dialout.
I tried formerly a simple adapter-cable, now a FTDI-Converter, which Driver shall be included in the Kernel.
The Software runs fine with Wine, but I cant get any connection.

What can I do to find the failure or a solution for this?

Hope to find any help here and looking forward to hear from you. Many thanks in advance from Germany. :)

Greets,
Zucchero
lahmbi5678
Level 7
Level 7
Posts: 823
Joined: Thu Aug 27, 2009 6:23 am

Re: Serial-/USB-Devices at COM-Port

Post by lahmbi5678 »

This whole COM/USB-Stuff can be very tricky. It won't work at all, if your software needs to install windows hardware drivers, they are not supported in wine. You should make sure, that you mapped the right port, see e.g. https://forum.mxlinux.org/viewtopic.php?t=42220 how to do this.
ldkraemer
Level 1
Level 1
Posts: 6
Joined: Sat Oct 20, 2018 12:19 pm

Re: Serial-/USB-Devices at COM-Port

Post by ldkraemer »

DETECT THE DEVICE - USB

Open a Linux Terminal window and cut/paste the following commands with the USB to Serial Adapter unplugged from
a USB port.

Code: Select all

dmesg | tail
lsusb
larry@ubuntu:~$ dmesg | tail
[10797.964432] domain 0: span 03
[10797.964434] groups: 01 02
[10797.964436] domain 1: span 03
[10797.964438] groups: 03
[10797.964440] CPU1 attaching sched-domain:
[10797.964441] domain 0: span 03
[10797.964443] groups: 02 01
[10797.964446] domain 1: span 03
[10797.964447] groups: 03
[12071.044928] usb 6-1: USB disconnect, address 3

larry@ubuntu:~$ lsusb
Bus 008 Device 001: ID 0000:0000
Bus 007 Device 003: ID 04f2:b091 Chicony Electronics Co., Ltd
Bus 007 Device 002: ID 0bda:0158 Realtek Semiconductor Corp.
Bus 007 Device 001: ID 0000:0000
Bus 006 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Then plug in the USB-Serial Port adaptor to one of your USB ports. (REMEMBER to ALWAYS use this
same port for when using your Device). Wait for about 10 seconds, then cut and paste the following
command in your Linux Terminal Window:

Code: Select all

dmesg | tail
lsusb
You should see these messages:
larry@ubuntu:~$ dmesg | tail
[10797.964440] CPU1 attaching sched-domain:
[10797.964441] domain 0: span 03
[10797.964443] groups: 02 01
[10797.964446] domain 1: span 03
[10797.964447] groups: 03
[12071.044928] usb 6-1: USB disconnect, address 3
[12091.200574] usb 6-1: new full speed USB device using uhci_hcd and address 4
[12091.358706] usb 6-1: configuration #1 chosen from 1 choice
[12091.363887] /build/buildd/linux-2.6.24/drivers/usb/class/cdc-acm.c: This
device cannot do calls on its own. It is no modem.
[12091.363914] cdc_acm 6-1:1.0: ttyACM0: USB ACM device
My device is /dev/ttyACM0
larry@ubuntu:~$ lsusb
Bus 008 Device 001: ID 0000:0000
Bus 007 Device 003: ID 04f2:b091 Chicony Electronics Co., Ltd
Bus 007 Device 002: ID 0bda:0158 Realtek Semiconductor Corp.
Bus 007 Device 001: ID 0000:0000
Bus 006 Device 003: ID 058f:9720 Alcor Micro Corp. USB-Serial Adapter
Bus 006 Device 001: ID 0000:0000
Bus 005 Device 001: ID 0000:0000
Bus 004 Device 001: ID 0000:0000
Bus 003 Device 001: ID 0000:0000
Bus 002 Device 001: ID 0000:0000
Bus 001 Device 001: ID 0000:0000
Now, cut and paste the following command in your Linux Terminal Window:

Code: Select all

lsusb -v -d 058f:9720
The 058f:9720 is the Device ID.
Bus 006 Device 003: ID 058f:9720 Alcor Micro Corp.
USB-Serial Adapter Device Descriptor:
bLength 18
bDescriptorType 1
bcdUSB 1.10
bDeviceClass 2 Communications
bDeviceSubClass 0
bDeviceProtocol 0
bMaxPacketSize0 8
idVendor 0x058f Alcor Micro Corp.
idProduct 0x9720 USB-Serial Adapter
bcdDevice 0.00

LINKING the COMM PORT: SYMBOLIC vs HARD

To locate the possible COMM PORTS in Linux, cut and paste the following commands with the
USB to RS-232C Adapter plugged in.:

Code: Select all

ls -l /dev/ttyS*
ls -l /dev/ttyU*
Notice that ttyS0 through ttyS3 are detected as shown. You may have /dev/ttyUSB0 if it was properly
detected. Mine was NOT, because it was a Sabrent SBT-USC1M USB to Serial Converter..
crw-rw---- 1 root dialout 4, 64 2009-11-27 15:26 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 2009-11-27 15:26 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 2009-11-27 15:26 /dev/ttyS2
crw-rw---- 1 root dialout 4, 67 2009-11-27 15:26 /dev/ttyS3
Note that user is a member of dialout and has permissions of 6 (rw) to be able to use the Port.
The Baud, Bits per Char, Stop Bits, and Parity are yet to be defined.

I couldn't make a symbolic link work, so I decided to create a hard link, replacing /dev/ttyS3.
First remove /dev/ttyS3:

Code: Select all

sudo rm /dev/ttyS3
sudo ln /dev/ttyACM0 /dev/ttyS3
Running the command again:

Code: Select all

ls -l /dev/ttyS*
gives:
crw-rw---- 1 root dialout 4, 64 2010-11-10 11:59 /dev/ttyS0
crw-rw---- 1 root dialout 4, 65 2010-11-10 11:59 /dev/ttyS1
crw-rw---- 1 root dialout 4, 66 2010-11-10 11:59 /dev/ttyS2
crw-rw---- 2 root dialout 166, 0 2010-11-10 12:59 /dev/ttyS3
If you don't have rw priviledges remove /dev/ttyS3 and create it again.

We can determine the Baud rate of the Port:

Code: Select all

stty -F /dev/ttyS3 -a
and to change it to 9600:

Code: Select all

man stty
stty -F /dev/ttyS3 9600
stty -F /dev/ttyS3 -a
If you connect to a modem for testing you can transmit out an "ATZ" causing the Modem to flash the
lights and reset with:

Code: Select all

echo ATZ > /dev/ttyS3
Which proves characters routed to /dev/ttyS3 get sent to /dev/ttyACM0, the USB to Serial Converter.

You may also need to fiddle in the Wine Registry to get the Software to to access the Serial Port.
All that remains is to connect the Serial Cable to the Device, and run the Application Software.

Thanks.

Larry
Locked