Com Port issues

Thanks so much for the info.

Are you saying that you see the binary mode output instead of the terminal? That could be a connection to the wrong serial port.

Do you mean that you can’t always connect, or that the connection is interrupted?

If it’s a composite device problem I can remove the binary mode serial port and go back to a shared port like the old Bus Pirate.

I can test if this is a USB descriptor problem by reverting to the stock default PICO SDK descriptors. If the problem persists, we may need to raise an issue with the Raspberry Pi people or the TinyUSB people.

I had a similar problem with the udev rules too.
It seems that the BP5 has 2 serial ports with the same serial code for the same idVendor and idProduct. When you connect to USB the BP5 sometimes picks up the right serial port and sometimes picks up the wrong one.
Not having found a solution (I’m not an udev expert) I configured everything to always work with /dev/ttyACM0
This is how it always works.

2 Likes

Good questions. My tentative summary is “occasional disconnections, but usually can’t connect at all”. Holding the front panel button down during power up does not change that behaviour.

If connections are successful (i.e. show the expected response to “?”), it works as expected for a while. I have seen it lockup after maybe 15 mins, but I’m undecided as to whether that is a comms fault, faulty use of one command in an inappropriate mode, or just my lack of understanding. PEBKAC is a distinct possibility.

Most often the connections are not successful, and all I see is the text shown at the end. Nothing is visible unless I press
^B, which produces the “1ALS”
^D which produces “Bus Pirate 5PIO+DMA!RP2040 62Mhz#���!A”
That feels like the binary/text interface issue mentioned earlier in this thread.

Thus, in my profound ignorance, I wonder whether having two interfaces differing only in the endpoint address (81 vs 83) and only one /dev/buspirate symlink allows the minicom to randomly connect to one interface/endpoint or the other.
Name: cdc_acm
Alternate Number: 0
Class: 02(comm.)
Sub Class: 02
Protocol: 00
Number of Endpoints: 1
Endpoint Address: 81
Direction: in
Attribute: 3
Type: Int.
Max Packet Size: 8
Interval: 16ms
Which feels like the Windows “ambiguity” between the two COM ports mentioned earlier in this thread


Welcome to minicom 2.7.1

OPTIONS: I18n
Compiled on Aug 13 2017, 15:25:34.
Port /dev/buspirate, 09:49:03

Press CTRL-A Z for help on special keys

1ALSBus Pirate 5PIO+DMA!RP2040 62Mhz#���!A

If you see this, you are connected to the wrong serial port. I am not familiar with Linux serial ports, so I don’t know how ambiguous a composite device may be. Under Windows I get two serial ports and the mass storage device controller. The connection is reliable and solid as a rock.

The inability to connect and loss of connection concerns me. Does this also happen on other computers/operating systems? Have you ever had problems connecting other RP2040-based PICO or other RPi boards?

I very rarely use Windows (since MS refused to sell me Win7!), and I find it generally easier to use Linux.

I have tried it on a Windows machine using putty (not teraterm), and usually had the inability to connect. That feels like there is a common Windows/Linux ambiguity as noted here (and elsewhere)

When it did connect, ISTR having a subsequent disconnection, but that is a very weak statement.

Drakelive’s recent message

seems - at first glance - to resolve the connection issue.

I will continue (intermittently) to play with BP5, and see whether that is a solid workaround. Currently I’m hopeful :slight_smile:

I’ll report back only if it is not a solution.

1 Like

Hey,
no idea if this is the right place, but I noticed that plugin the bp5 into my USB-C port of one of my LG displays, an LG device will be recognized

Bus 007 Device 019: ID 043e:9c09 LG Electronics USA, Inc. BillBoard Device

but not the BP itself, plugin it into the laptop directly works.

Bus 003 Device 003: ID 1209:7332 Generic Dangerous Prototypes Bus Pirate Next Gen Logic Analyzer

That is the first time, I couldn’t use the port of the displays, thus, it might be a good idea to advise people with connection problem to try a direct connection and not via a USB-hub.

2 Likes

SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, MODE=“0666”, SYMLINK+=“buspirate”

This udev rule should be adapted to properly differentiate between the binary and text interfaces. Currently the second interface will overwrite the entry of the first. Since this is done in parallel while enumerating the order isn’t predictable.

Usually this can be done by using the interface number property. The usb descriptor info you posted shows that the relevant interface numbers are 1 and 3, but I don’t know which is which.

So what I suggest to do is to change the udev rule like this:

SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, ATTRS{bInterfaceNumber}=="01", MODE=“0666”, SYMLINK+=“buspirate-text”
SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, ATTRS{bInterfaceNumber}=="03", MODE=“0666”, SYMLINK+=“buspirate-binary”

reboot and reconnect the buspirate as an easy way to make sure the udev rules really take.

Now try to connect to /dev/buspirate-text and see if that works. If not, switch the bInterfaceNumber condition between the two udev rule entries.

4 Likes

So basically binary interface is for interacting with e.g. flashrom and text is for BP console riiiight?

BTW thanks for the better udev rule @electronic_eel

I’ve tried that, but adding the ATTRS{bInterfaceNumber}==“01” (or 00 or 02 or 03) fails to create the symlink /dev/buspirate-text

Using minicom with /dev/ttyACM0 seems to connect reliably

I don’t have a Bus Pirate 5 myself yet, so I was just guessing from the data you showed. Please try “ENV{ID_USB_INTERFACE_NUM}” instead:

SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, ENV{ID_USB_INTERFACE_NUM}=="01", MODE=“0666”, SYMLINK+=“buspirate-text”
SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, ENV{ID_USB_INTERFACE_NUM}=="03", MODE=“0666”, SYMLINK+=“buspirate-binary”

If this doesn’t work then you should check what properties are actually detected. You can do this by running udevadm monitor while you plug in your Bus Pirate. You can either try to create the rule yourself based on the output or post the whole thing here.

2 Likes

Firstly, thanks for spending your time on my problem!

In many cases I would puzzle this out myself, but I haven’t spotted an idiot’s introduction to USB/udev. Yes, the syntax of the udev rules is fairly obvious, but the semantics of the USB structure and udev aren’t obvious. Besides, as I get older, the desire to learn yet another scrotty little DSL (Domain Scripting Language) exceeds my tolerance :slight_smile:

Having vented that, here’s the udevadm monitor output after the BP5 is inserted, stopping after the “98MB volume” has been mounted.

KERNEL[68.116198] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6 (usb)
KERNEL[68.162121] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.0 (usb)
KERNEL[68.162146] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.1 (usb)
KERNEL[68.165124] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.2 (usb)
KERNEL[68.165152] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.3 (usb)
KERNEL[68.168131] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4 (usb)
KERNEL[68.168160] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6 (usb)
UDEV [68.186142] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6 (usb)
UDEV [68.188449] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.1 (usb)
UDEV [68.188824] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.3 (usb)
KERNEL[68.196027] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.1 (usb)
KERNEL[68.196058] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.0/tty/ttyACM0 (tty)
KERNEL[68.196078] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.0 (usb)
KERNEL[68.198964] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.3 (usb)
KERNEL[68.198999] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.2/tty/ttyACM1 (tty)
KERNEL[68.199021] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.2 (usb)
KERNEL[68.199033] add /bus/usb/drivers/cdc_acm (drivers)
KERNEL[68.199043] add /module/cdc_acm (module)
UDEV [68.199066] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.2 (usb)
UDEV [68.199092] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.0 (usb)
KERNEL[68.199196] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8 (scsi)
KERNEL[68.199226] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/scsi_host/host8 (scsi_host)
KERNEL[68.199255] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4 (usb)
KERNEL[68.199266] add /bus/usb/drivers/usb-storage (drivers)
KERNEL[68.199279] add /module/usb_storage (module)
UDEV [68.199901] add /module/cdc_acm (module)
UDEV [68.199977] add /bus/usb/drivers/usb-storage (drivers)
UDEV [68.200052] add /bus/usb/drivers/cdc_acm (drivers)
UDEV [68.200148] add /module/usb_storage (module)
KERNEL[68.200579] add /bus/usb/drivers/uas (drivers)
KERNEL[68.200589] add /module/uas (module)
UDEV [68.200665] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4 (usb)
UDEV [68.201062] add /module/uas (module)
UDEV [68.201256] add /bus/usb/drivers/uas (drivers)
UDEV [68.201856] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6 (usb)
UDEV [68.203508] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.3 (usb)
UDEV [68.204026] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.1 (usb)
UDEV [68.204219] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.2/tty/ttyACM1 (tty)
UDEV [68.204254] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8 (scsi)
UDEV [68.205390] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.0/tty/ttyACM0 (tty)
UDEV [68.205822] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/scsi_host/host8 (scsi_host)
UDEV [68.206079] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.2 (usb)
UDEV [68.207236] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.0 (usb)
UDEV [68.207269] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4 (usb)
KERNEL[69.233766] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0 (scsi)
KERNEL[69.233798] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0 (scsi)
KERNEL[69.233808] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/scsi_device/8:0:0:0 (scsi_device)
KERNEL[69.233818] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/scsi_disk/8:0:0:0 (scsi_disk)
KERNEL[69.233839] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/scsi_generic/sg1 (scsi_generic)
KERNEL[69.233878] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/bsg/8:0:0:0 (bsg)
UDEV [69.235343] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0 (scsi)
UDEV [69.236526] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0 (scsi)
UDEV [69.237963] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/scsi_device/8:0:0:0 (scsi_device)
UDEV [69.238517] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/scsi_disk/8:0:0:0 (scsi_disk)
UDEV [69.238840] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/bsg/8:0:0:0 (bsg)
UDEV [69.238901] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/scsi_generic/sg1 (scsi_generic)
KERNEL[69.262082] add /devices/virtual/bdi/8:16 (bdi)
UDEV [69.262889] add /devices/virtual/bdi/8:16 (bdi)
KERNEL[69.271856] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/block/sdb (block)
KERNEL[69.271887] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/block/sdb/sdb1 (block)
KERNEL[69.304908] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0 (scsi)
UDEV [70.809420] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/block/sdb (block)
UDEV [72.282942] add /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0/block/sdb/sdb1 (block)
UDEV [72.284096] bind /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-6/1-6:1.4/host8/target8:0:0/8:0:0:0 (scsi)

So did you add the “ENV{ID_USB_INTERFACE_NUM}” rules I mentioned above? In the monitor output it looks like it didn’t take.

Sorry that this takes that many steps, it isn’t that easy to do this without being on the actual machine this is connected to.

What you could do to get all attributes of the one of the interfaces is this: connect the Bus Pirate. It looks like it gets /dev/ttyACM0 and /dev/ttyACM1 on your machine.

Then run this: udevadm info -a -n /dev/ttyACM0. It should output the info in attribute-walk format. Then run udevadm info -x -n /dev/ttyACM0. This gives the same info, but in key/value format. This should be enough to puzzle the proper rule together.

1 Like

No apologies necessary, except those from me to you. The combination you being “blind” and my being “ignorant” is not a good combination :frowning:

I’ve tried

 SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, ENV{ID_USB_INTERFACE_NUM}=="00", MODE=“0666”, SYMLINK+=“buspirate-text”
 SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, ENV{ID_USB_INTERFACE_NUM}=="02", MODE=“0666”, SYMLINK+=“buspirate-binary”

and

SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, ATTRS{bInterfaceNumber}=="00", MODE=“0666”, SYMLINK+=“buspirate-text”
SUBSYSTEM==“tty”, ATTRS{idVendor}==“1209”, ATTRS{idProduct}==“7332”, ATTRS{serial}==“123456789012”, ATTRS{bInterfaceNumber}=="02", MODE=“0666”, SYMLINK+=“buspirate-binary”

with

sudo udevadm control --reload-rules && sudo udevadm trigger

and neither “buspirate-binary” nor “buspirate-text” appear in /dev

The apparently “interesting bits” of the udevadm info outputs are given below, where the differences between ttyACM0/1 are indicated (as best I can in this markdown) “<=== …difference”:

  looking at device '/devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-5/1-5:1.0/tty/ttyACM0': <=== ...usb1/1-5/1-5:1.2/tty/ttyACM1'
    KERNEL=="ttyACM0" <=== ... "ttyACM1"
    SUBSYSTEM=="tty"
    DRIVER==""

  looking at parent device '/devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-5/1-5:1.0': <=== ...usb1/1-5/1-5:1.2':
    KERNELS=="1-5:1.0"
    SUBSYSTEMS=="usb"
    DRIVERS=="cdc_acm"
    ATTRS{authorized}=="1"
    ATTRS{bAlternateSetting}==" 0"
    ATTRS{bInterfaceClass}=="02"
    ATTRS{bInterfaceNumber}=="00" <=== ... "02"
    ATTRS{bInterfaceProtocol}=="00"
    ATTRS{bInterfaceSubClass}=="02"
    ATTRS{bNumEndpoints}=="01"
    ATTRS{bmCapabilities}=="2"
    ATTRS{iad_bFirstInterface}=="00" <=== ... "02"
    ATTRS{iad_bFunctionClass}=="02"
    ATTRS{iad_bFunctionProtocol}=="00"
    ATTRS{iad_bFunctionSubClass}=="02"
    ATTRS{iad_bInterfaceCount}=="02"
    ATTRS{interface}=="Bus Pirate CDC"
    ATTRS{supports_autosuspend}=="1"

  looking at parent device '/devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-5':
    KERNELS=="1-5"
  ...
    ATTRS{urbnum}=="724" <=== ... "728"
  

and

P: /devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-5/1-5:1.0/tty/ttyACM0 <=== ... usb1/1-5/1-5:1.2/tty/ttyACM1
N: ttyACM0  <=== ... ttyACM1
S: serial/by-id/usb-Bus_Pirate_Bus_Pirate_5_123456789012-if00 <=== ... -if02
S: serial/by-path/pci-0000:05:00.1-usb-0:5:1.0 <=== ... -usb-0:5:1.2
E: DEVLINKS=/dev/serial/by-id/usb-Bus_Pirate_Bus_Pirate_5_123456789012-if00 /dev/serial/by-path/pci-0000:05:00.1-usb-0:5:1.0 <=== ...if02 and ... usb-0:5:1.2
E: DEVNAME=/dev/ttyACM0 <=== ...  ttyACM01
E: DEVPATH=/devices/pci0000:00/0000:00:01.2/0000:02:00.0/0000:03:08.0/0000:05:00.1/usb1/1-5/1-5:1.0/tty/ttyACM0 <=== ...  usb1/1-5/1-5:1.2/tty/ttyACM1
E: ID_BUS=usb
E: ID_MM_CANDIDATE=1
E: ID_MODEL=Bus_Pirate_5
E: ID_MODEL_ENC=Bus\x20Pirate\x205
E: ID_MODEL_ID=7332
E: ID_PATH=pci-0000:05:00.1-usb-0:5:1.0
E: ID_PATH_TAG=pci-0000_05_00_1-usb-0_5_1_0
E: ID_PCI_CLASS_FROM_DATABASE=Serial bus controller
E: ID_PCI_INTERFACE_FROM_DATABASE=XHCI
E: ID_PCI_SUBCLASS_FROM_DATABASE=USB controller
E: ID_REVISION=0101
E: ID_SERIAL=Bus_Pirate_Bus_Pirate_5_123456789012
E: ID_SERIAL_SHORT=123456789012
E: ID_TYPE=generic
E: ID_USB_CLASS_FROM_DATABASE=Miscellaneous Device
E: ID_USB_DRIVER=cdc_acm
E: ID_USB_INTERFACES=:020200:0a0000:080650:
E: ID_USB_INTERFACE_NUM=00 <=== ... 02
E: ID_USB_PROTOCOL_FROM_DATABASE=Interface Association
E: ID_VENDOR=Bus_Pirate
E: ID_VENDOR_ENC=Bus\x20Pirate
E: ID_VENDOR_FROM_DATABASE=InterBiometrics
E: ID_VENDOR_ID=1209
E: MAJOR=166
E: MINOR=0 <=== ...1
E: SUBSYSTEM=tty
E: TAGS=:systemd:

One of the problems for identifying the proper CDC port is that both ports share the same descriptor string. (usb_descriptors.c:170,173) I propose to add another descriptor string at the end of the string_desc_arr array like:
usb_descriptors.c:273
“Bus Pirate BIN” // 6: Binary CDC Interface
and using it in line usb_descriptors.c:173

1 Like

It seems sensible to have a separate strings for each port.

I’m not qualified to comment on whether that proposed change is correct or sufficient.

I imagine modifying the FS descriptor is sufficient, and that the HS descriptor (line 184) is irrelevant.

What matters in the end is a clear and simple specification of the necessary and sufficient clauses in the udev rules file.

Thanks for your attention to this problem!

Where is this port descriptor string actually shown?

Like does it show up in the device manager in Windows? Then this change would make sense. But if it can only be seen in some debuggig info (like lsusb -v -v -v) then I don’t see the point.

I think I know where the problem is:
http://www.reactivated.net/writing_udev_rules.html#udevinfo
You can’t match attributes from different parent entries of the device within the same udev rule. The ATTRS{idVendor} is from the root usb device while the ATTRS{bInterfaceNumber} is from the CDC device which is one level below.

So I think the solution is to completely switch away from ATTRS and only use ENV, because there this doesn’t matter.

This would mean:

SUBSYSTEM==“tty”, ENV{ID_VENDOR_ID}==“1209”, ENV{ID_MODEL_ID}==“7332”, ENV{ID_SERIAL_SHORT}==“123456789012”, ENV{ID_USB_INTERFACE_NUM}=="00", MODE=“0666”, SYMLINK+=“buspirate-text”
SUBSYSTEM==“tty”, ENV{ID_VENDOR_ID}==“1209”, ENV{ID_MODEL_ID}==“7332”, ENV{ID_SERIAL_SHORT}==“123456789012”, ENV{ID_USB_INTERFACE_NUM}=="02", MODE=“0666”, SYMLINK+=“buspirate-binary”

Please try that.

No luck, I’m afraid.

Not even successively removing clauses until this is left

SUBSYSTEM==“tty”, ENV{ID_VENDOR_ID}==“1209”, ENV{ID_MODEL_ID}==“7332”,  MODE=“0666”, SYMLINK+=“buspirate-text”

Yes, it should show on the device manager and other tools like Zadig.
Screenshot 2024-03-25 165552

Just my to bobs worth, this may be a little old school thinking but I have always use dmesg to find the serial ports of devices (as well as media) then direct connect to the device.

ie.