On Wed, 4 Jan 2023 14:39:51 -0500 Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > On Wed, Jan 04, 2023 at 06:27:50PM +0100, Petr Tesařík wrote: > > On Wed, 4 Jan 2023 12:04:22 -0500 > > Alan Stern <stern@xxxxxxxxxxxxxxxxxxx> wrote: > > > At this point the host sends a Get-Device-Status request to the device > > > (not shown in the log). > > > > > > [...] > > > > > > The fact that the host is retrying means that the status request got an > > > error. Unfortunately the log message doesn't say sort of error > > > occurred. > > > > OK, I see. The URB indicates success, but there is no data: > > > > 45 0.432232 host 1.50.0 USB 64 GET STATUS Request > > 46 0.432659 1.50.0 host USB 64 GET STATUS Response > > > > Frame 46: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface usbmon1, id 0 > > USB URB > > [Source: 1.50.0] > > [Destination: host] > > URB id: 0xffff98b4383c8d80 > > URB type: URB_COMPLETE ('C') > > URB transfer type: URB_CONTROL (0x02) > > Endpoint: 0x80, Direction: IN > > Device: 50 > > URB bus id: 1 > > Device setup request: not relevant ('-') > > Data: present ('\0') > > URB sec: 1672851450 > > URB usec: 569060 > > URB status: Success (0) > > URB length [bytes]: 0 > > Data length [bytes]: 0 > > -------------------------^ > > This should be 2, and the device should send a 16-bit status word. Hm. > > > > [Request in: 45] > > [Time from request: 0.000427000 seconds] > > Unused Setup Header > > Interval: 0 > > Start frame: 0 > > Copy of Transfer Flags: 0x00000200, Dir IN > > Number of ISO descriptors: 0 > > > > While I do agree that the Samsung phone download mode USB stack > > implementation is crappy, multiple models and many users are affected. I > > wonder what would be a sensible workaround in heimdall and/or libusb... > > > > Setting a global module parameter does not sound great. > > Another option would be to create a short udev script that would write > "on" to the power/control attribute file (thereby turning autosuspend > off) whenever it sees a new USB device with the vendor and product IDs > of your phone. That seems like a very practical solution. Yes, that sounds good, because autosuspend is usually not set to zero. Thank you! FWIW it works for me, and I have also proposed this solution in the heimdall GitHub issue. They install their own udev rules file already, so the patch is a one-liner. BTW manufacturing broken USB devices in large quantities should become a crime and a federal felony... ;-) Petr T