> The biggest problem to me is the usb code.
> 
> First I'm using a kvm switch so there are a lot of attachments-detachments.
> At a certain point it will end with "No slots available" and the
> usb will became unusable. For me is a labyrinth, but I'm pretty sure
> someone with more experience with the system could fix it.

I found how 9front fixed this:

--- /n/sources/contrib/miller/9/bcm/devusb.c    Wed Sep 18 16:02:39 2019
+++ devusb.c    Sun Jun 13 16:21:28 2021
@@ -389,6 +389,10 @@
                if(ep->ep0 != ep){
                        putep(ep->ep0);
                        ep->ep0 = nil;
+               } else if(d != nil){
+                       if(d->free != nil)
+                               (*d->free)(d->aux);
+                       free(d);
                }
                free(ep->info);
                free(ep->name);

I can't understand the code yet, but my impression is that the
original intention was to not free the slot by default when a device
is detached, not allocate a new one if the same device is reconnected
but reused the old one, and free the unused slots when some time
has passed or if there is no one available.  But what the code is
doing is allocating a new slot every time a new device is attached
and what this hack does is free the corresponded slot every time
a device is detached.

Regards,
adr.

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/Tc5dcd85d69518168-M5713a1f8ec63663d9aeae58e
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to