Re: Number of USB devices limited?

From: Brian McGovern (bmcgover) <bmcgover_at_cisco.com>
Date: Wed, 20 Apr 2022 12:30:55 UTC
> At the dayjob I will say that we’ve had good success using usb-to-8-port or usb-to-16 port devices that sidestep the issue of single discrete FTDI cables.

A reference/link would be interesting. Always looking for alternatives. Right now, I'm running two Sedna 13-port hubs from the various systems (and fortunately I stocked up because the prices are popping) https://www.amazon.com/Port-USB-3-1-Gen-5Gbps/dp/B07G2L3QY3/ref=sr_1_4?crid=1271B15DMH9ET&keywords=sedna+13+port+hub&qid=1650457431&sprefix=sedna+13+port+hubs%2Caps%2C97&sr=8-4

> That said, if you have multiple boxes, the order in which they enumerate can sometimes be non-deterministic, based on which USB port the thing is plugged into,
> which probes first, and the phase of the moon.

That is _always_ a problem with USB, since they're hot pluggable. Some nice folks here on the mailing list put some devd scripts together to map the FTDI cable's serial number in to the device name, so while the /dev/cuaU_X_ names still come up not-quite-randomly, I also get /dev/cu.ABCDEFG, where ABCDEFG = The serial number of the cable, which is consistent as long as you don't change the cable.

At this point, the only headache is that I start getting the errors in the low 20s of ports, and I'm trying to avoid two hosts/rack.

      -Brian
________________________________
From: Dan Mahoney (Ports) <freebsd@gushi.org>
Sent: Tuesday, April 19, 2022 11:39 PM
To: Chris Hill <chris@monochrome.org>
Cc: Brian McGovern (bmcgover) <bmcgover@cisco.com>; freebsd-questions@freebsd.org <freebsd-questions@freebsd.org>
Subject: Re: Number of USB devices limited?

At the dayjob I will say that we’ve had good success using usb-to-8-port or usb-to-16 port devices that sidestep the issue of single discrete FTDI cables.

That said, if you have multiple boxes, the order in which they enumerate can sometimes be non-deterministic, based on which USB port the thing is plugged into, which probes first, and the phase of the moon.

-Dan

> On Apr 19, 2022, at 8:09 PM, Chris Hill <chris@monochrome.org> wrote:
>
> Not specific to FreeBSD, but to the USB standard itself (I think). There is a limit to the number of endpoints, as you describe, but there is also a limit to the number of hubs you can cascade. The number is low; I think it's 7. If you have more than $NUMBER of hubs in a row, you will get erratic behavior from your USB endpoints. And many things count as a "hub" - your computer probably takes up two, for example.
>
>
> On Tue, 19 Apr 2022, Brian McGovern (bmcgover) wrote:
>
>> Looking at the FreeBSD handbook, Chapter 13, it looks like the expectation is that I should be able to attach "the maximum of 126 devices". Unfortunately, it seems I'm getting in the low 20s (21 FTDI serial cables, USB keyboard, and mouse), after which I start getting the following in the logs:
>>
>> "Error initializing deviceusb_alloc_device: device init 34 failed (USB_ERR_IOERROR, ignored)"
>>
>> and
>>
>> "uhub_reattach_port: could not allocate new device".
>>
>>
>> If I look at /dev/ugen*, there are the ugen devices for 0.1->0.33; so its feeling like there may be limit in the serial port driver for the number of /dev/cua* devices, which presently only number cuaU0->cuaU20. So, I'm assuming this may not be a "USB" issue as much as the number of USB serial ports (ucom?) that can be connected.
>>
>> Before I go on a code crawl to figure out how this is failing and if it can be scaled up, I'm curious if anyone is aware of a coded limit for the number of USB serial devices (or USB devices in general) that can be connected before running in to this? I'm looking to push upwards to _maybe_ 40 FTDI devices.
>>
>>         -Brian
>>
>
> --
> Chris Hill               chris@monochrome.org