I installed a Windows program on my Debian laptop that interfaced with a radio receiver. The purpose of this program was to allow for the reading & writing of the radio's memories. The connection to the radio was through a USB to Serial converter.
First, I installed Wine (originally an acronym for "Wine Is Not an Emulator"), from the Debian Repository. Then, I could install the Windows program from its CD. When the program is first run, it asks for the COM port number. Because there are no COM ports, this is where the challenge began.
I did some searching with Google and found that the first step was to add a link in the Wine subdirectories for the USB to Serial Port device. There were several suggestions on how to locate & identify the device. The simplest method was in a Terminal window and issue the dmesg command right after plugging the device into a USB port.
jerry> dmesg | tail
[ 108.678576] usb 2-1.2: FTDI USB Serial Device converter now attached to ttyUSB0
[ 108.679609] usbcore: registered new interface driver ftdi_sio
[ 108.678613] ftdi_sio: v1.6.0:USB FTDI USB Serial Converters Driver
Note the line that indicates the USB device is "ttyUSB0".
With this device name, I added a link in the Wine subdirectory identifying this device as "COM1"
jerry> ln -s /dev/ttyUSB0 ~/.wine/dosdevices/com1
When I attempted to run the program, it was not able to connect to COM1.
I did some more searching and the answers were of two opinions. Either "it worked for me" or "it doesn't work" with only one person actually noticing what was wrong. The permissions for ttyUSB0 were wrong and the solution involved writing a short script to run which would set ttyUSB0 permissions to allow access.
When I examined ttyUSB0, this is what I saw:
jerry> ls -l /dev/ttyUSB0
crw-rw---T 1 root dialout 4, 6 Nov 18 20:34 ttyUSB0
The device is accessible to only root, the owner and to the "dialout" group, but has no world access. This explained why the one solution required a script to grant access to the device.
However, I realized there was a simpler solution that did not involve running a script every time I wanted to run my program. All I had to do was add my username to the dialout group.
Using a text editor, like vi, you will have to edit the group file, but since it is owned by the root user you will need superuser permission.
jerry> su
Password:
root> vi /etc/group
Locate the line that begins with "dialout":
dialout:x:20:
Add your username to the dialout group:
dialout:x:20:jerry
Save the group file and exit your text editor.
Now, when I run the Windows program and select COM1: I could finally say "this works for me".
No comments:
Post a Comment