Multiple serial ports

I didn’t want to bump this and that, or this

But the documentation seems to suggest that you can either specify the path to /dev/serial/by-id/ OR do as above and specify the vendor and device id.
Firstly is this valid?
Secondly, are there other udev attributes are available for distinguishing a device.

I cannot get the slot in the gadget to come up at all from snap interfaces command e.g. in the gadget snap:

 slots:
       device1-port:
          interface: serial-port
          path: /dev/serial/by-id/usb--if02
       device2-port:
          interface: serial-port
          path: /dev/serial/by-id/usb--if00

should these turn up in as separate slots in the snap interfaces? From @kyrofa’s great tutorials, it appears they should. These paths exist btw.

Actually solved this by not using the /dev/serial/by-id path which is actually a simlink to the actual dev file. I ended up using the /dev/ttyACM0 as the path which was the target of the simlink, and surprise, the interfaces appeared!

1 Like

Which tutorial are you referencing? Your slots look a bit different than those used in this one, for example (notice the /dev/serial-port-<whatever> pattern):

slots:
  kobuki:
    interface: serial-port
    path: /dev/serial-port-kobuki
    usb-vendor: 0x0403
    usb-product: 0x6001

What did your gadget rules end up being for your solution, then?

The slots below worked, which are where the simlinks in /dev/serial/by-id/* pointed to. Unfortunately I expect to run into issues with getting the devices correct.

slots:
   encoder-port:
      interface: serial-port
      path: /dev/ttyACM1
  imu-port:
      interface: serial-port
      path: /dev/ttyACM0

Its a problem with our usb setup, in that multiple ports are comming from the single usb device, such that the product-id, vendor-id, and usb-id are all the same. The only difference between devices is the ATTR{bInterfaceNumber}, which is why I was hoping that any general usb-attribute could be used in declaring slots.

@niemeyer do you have any thoughts on this matter? Would be nice to have a good way to do this.