Hello everyone and best wishes for 2023 :)

I have an old Garmin Drive Smart 50 GPS and I want to be able to attach it when it is in preboot mode to a VM hosted by a Debian 11 host.

From what I understand, the preboot mode allows us to flash a firmware before the GPS actually starts (used among other things when the GPS is soft bricked).

When I connect the GPS to the host it gives:

root@host:~# journalctl -kf
# GPS in MTP storage mode (default when reset)
...
janv. 23 23:02:51 host kernel: usb 2-4: New USB device found, idVendor=091e, idProduct=48db, bcdDevice= 0.01
janv. 23 23:02:51 host kernel: usb 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=5
...
# GPS in mass storage mode
...
janv. 23 23:01:29 host kernel: usb 2-4: New USB device found, idVendor=091e, idProduct=28db, bcdDevice= 5.09
janv. 23 23:01:29 host kernel: usb 2-4: New USB device strings: Mfr=0, Product=0, SerialNumber=5
...
# GPS in preboot mode
...
janv. 23 23:09:05 host kernel: usb 2-4: New USB device found, idVendor=091e, idProduct=0003, bcdDevice= 0.01
janv. 23 23:09:05 host kernel: usb 2-4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
janv. 23 23:09:13 host kernel: garmin_gps ttyUSB0: Garmin GPS usb/tty converter now disconnected from ttyUSB0
...

We see that idVendor, idProduct, bcdDevice, Mfr, Product and SerialNumber vary according to the modes. We also see that the GPS is seen as a ttyUSB0 serial device.

I managed to attach the GPS in preboot mode, thanks to a script which waits for the GPS to be detected in this mode (not detailed here so as not to overload, but I can publish it if necessary) and which attaches to a VM in running (successfully tested on Debian 11 and Windows 7 guests).

Here is the code that generates the XML before attaching it :

...
echo    "<serial type='dev'> \
            <source path='"$( \
             ls -1 /dev/tty* | grep -Ev "tty(|S?[0-9]+)$" \
            )"'/> \
            <target type='usb-serial'> \
                <vendor id='0x"$( \
                 echo 091e \
                )"'/> \
                <product id='0x"$( \
                 echo 28db \
                )"'/> \
            </target> \
        </serial>" > serial_device.xml
virsh attach-device vm-bullseye --file serial_device.xml &
...

But once attached, this is what I see in the XML configuration of my VM (from virt-manager) :

<serial type="dev">
  <source path="/dev/ttyUSB1"/>
  <target type="usb-serial" port="1">
    <model name="usb-serial"/>
  </target>
  <alias name="serial1"/>
  <address type="usb" bus="0" port="4"/>
</serial>

We see that libvirt has removed the vendor/product id from the XML.

Also here is what I get from a Debian 11 guest :

root@vm-bullseye:~# journalctl -k -f
...
janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: new full-speed USB device number 2 using uhci_hcd
janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: New USB device found, idVendor=0403, idProduct=6001, bcdDevice= 4.00
janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=4
janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: Product: QEMU USB SERIAL
janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: Manufacturer: QEMU
janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: SerialNumber: 1-0000:00:05.7-4
janv. 23 21:26:22 vm-bullseye kernel: usbcore: registered new interface driver usbserial_generic
janv. 23 21:26:22 vm-bullseye kernel: usbserial: USB Serial support registered for generic
janv. 23 21:26:22 vm-bullseye kernel: usbcore: registered new interface driver ftdi_sio
janv. 23 21:26:22 vm-bullseye kernel: usbserial: USB Serial support registered for FTDI USB Serial Device
janv. 23 21:26:22 vm-bullseye kernel: ftdi_sio 3-2:1.0: FTDI USB Serial Device converter detected
janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: Detected FT232BM
janv. 23 21:26:22 vm-bullseye kernel: usb 3-2: FTDI USB Serial Device converter now attached to ttyUSB0
janv. 23 21:26:25 vm-bullseye kernel: usb 3-2: USB disconnect, device number 2
janv. 23 21:26:25 vm-bullseye kernel: ftdi_sio ttyUSB0: FTDI USB Serial Device converter now disconnected from ttyUSB0
janv. 23 21:26:25 vm-bullseye kernel: ftdi_sio 3-2:1.0: device disconnected
...

The guest sees the GPS well but
idVendor=0403, idProduct=6001, bcdDevice=4.00, Mfr=1, Product=2, SerialNumber=4

... do not correspond to anything, and tools that expect GPS in preboot mode do not see it.


My questions :

Q1 : Is it possible ?

Q2 : Am I doing it the right way ?

Q3 : Is there a method to pass such a device directly (pass-through) ?


Thank you in advance for the time you are going to devote to me :)

With Adelphity,

lnj