Hi all, I encounter a "nearly" infinite loop in libusbx discard_urbs due to a large negative "first" value:
I found that out by extending the function by an additonal log line: static int discard_urbs(struct usbi_transfer *itransfer, int first, int last_plus_one) { struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); struct linux_transfer_priv *tpriv = usbi_transfer_get_os_priv(itransfer); struct linux_device_handle_priv *dpriv = _device_handle_priv(transfer->dev_handle); int i, ret = 0; struct usbfs_urb *urb; for (i = last_plus_one - 1; i >= first; i--) { usbi_dbg("discard URBS in progress %d %d %d",i,last_plus_one - 1,first); if (LIBUSB_TRANSFER_TYPE_ISOCHRONOUS == transfer->type) urb = tpriv->iso_urbs[i]; This results in with a chance of ~ 20% in a LONG loop when removing the device - here a small snippet of the loop output: Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] Device not found for URB --> assuming ready to be reaped Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] discard URBS in progress -25087 3 -1168226879 Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] Device not found for URB --> assuming ready to be reaped Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] discard URBS in progress -25088 3 -1168226879 Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] Device not found for URB --> assuming ready to be reaped Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] discard URBS in progress -25089 3 -1168226879 Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] Device not found for URB --> assuming ready to be reaped Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] discard URBS in progress -25090 3 -1168226879 Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] Device not found for URB --> assuming ready to be reaped Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] discard URBS in progress -25091 3 -1168226879 Nov 13 06:25:21 (none) daemon.debug my_prog: [252.330000] [00005ab9] libusbx: debug [discard_urbs] Device not found for URB --> assuming ready to be reaped Why is the first element that large in the negative area? I would assume that there is something going wrong when the device disappears... Without having too deep knowledge on the deeper usb areas, I would assume that the "first" element should not be negative, and if it is negative - which meaning should this value then have? Thanks. Best regards, Erik ------------------------------------------------------------------------------ CenturyLink Cloud: The Leader in Enterprise Cloud Services. Learn Why More Businesses Are Choosing CenturyLink Cloud For Critical Workloads, Development Environments & Everything In Between. Get a Quote or Start a Free Trial Today. http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk _______________________________________________ libusbx-devel mailing list libusbx-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libusbx-devel