[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [gpsd-users] gpsd working with two PL2303 serial/USB interface
From: |
Alexander Carver |
Subject: |
Re: [gpsd-users] gpsd working with two PL2303 serial/USB interface |
Date: |
Wed, 16 Nov 2016 08:53:00 -0800 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.4.0 |
On 2016-11-16 02:01, Alain Tribaudot wrote:
> Hi GPSD users
> I am using Ubuntu 16-04 on EEPC.
> I get two adapters connected to my USB ports.
> This is Actisense NMEA2000/NGW1 USB and BU353 GPS. Both are using the
> same driver PL2303 and gpsd recognize them at the first boot.
> It works except when the computer goes to hibernation. When I wake it
> up, the ports are switching from ttyUSB0/ttyUSB1 to ttyUSB1 and nothing
> else, ttyUSB0 is dead.
> The solution I found was to disconnect the device plugged on ttyUSB1 and
> replug it immediately. Then It comes back to ttyUSB0 but the divices are
> inverted.
> The issue is that the actisense is sending back data like HDG, and XTE
> sentences to an automatic pilot, you can imagine the course of the boat
> without data.
> I'd like to block this erratic behaviour but I did not find a solution
> to stop it.
> I did not find a way to distinguish in /lib/udev/rules.d/60-gpsd.rules
> the interfaces because they are using the same chipset prolific.
>
>
>
> # Prolific Technology, Inc. PL2303 Serial Port [linux module: pl2303]
> # rule disabled in Debian as it matches too many other devices
> ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", SYMLINK+="gps%n",
> TAG+="systemd", ENV{SYSTEMD_WANTS}="address@hidden"
>
Use the bus location and add that to the rule with the KERNELS
parameter. The bus location can be found by using udevadm. An example
from my machine:
# udevadm info -q path /dev/ttyUSB0
/devices/platform/soc/20980000.usb/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1.3/1-1.3.1.3:1.0/ttyUSB0/tty/ttyUSB0
Take the last portion right before the designator (in this case ttyUSB0)
and you get the final bus location of 1-1.3.1.3:1.0 (yours will be
different and perhaps shorter, my devices are plugged into an external hub)
Then write a udev rule to take that value and make a symlink to it.
ACTION=="add",KERNEL=="ttyUSB*",SUBSYSTEMS=="usb",KERNELS=="1-1.3.1.3:1.0",SYMLINK+="device1"
After that you can simply use /dev/device1 no matter how it gets
enumerated on the ttys. Its bus location is always fixed as long as
it's plugged into the same physical port.