diff mbox

Request for information how to disable USB bulk endpoint transfer validation

Message ID 93d5aeb4-f1c7-9342-7bc5-4b277b4ec55e@veikia.lt (mailing list archive)
State New, archived
Headers show

Commit Message

Elvinas April 23, 2018, 7:50 p.m. UTC
Hello,

I have a somewhat strange request: how to break Linux USB support and disable some 
validation.

Recently I have become a "lucky" owner of the badly designed hardware (ZWO 120MM astronomy 
  camera to be specific) and stumbled upon classic issue: hardware was designed not 
according to specifications, but to work on Windows. From what I was able to dig on ZWO 
forums , camera uses bulk transfer mode, but uses incorrect packet size of 1024 bytes. 
Windows ignores that, Linux - does not. As a result camera does not work in Linux.

There are repeated messages in kern.log "usb 1-1: reset high-speed USB device number 8 
using ehci_hcd" and "usb usb1-port1: disabled by hub (EMI?), re-enabling..." each time I 
attempted to use camera.

In ZWO forums there was a suggestion to revert USB packet validation by applying a "break" 
to Linux kernel. With some changes to line locations I have applied the patch below and 
camera started to work on a desktop with USB 2.0 host. However this patch does not help if 
camera is attached to a laptop with USB 3.0 host. Each time I try to use camera, I see 
similar error messages, but now originating from xhci_hcd.

Question: can anyone point what lines should be commented out to ignore packet sizes for 
USB 2.0 device, when attached to USB 3.0 host?

As I am not much of C programmer I have not been able to locate those myself and did not 
want to play "whack a mole" by commenting out some random line, wait ~1 hour to compile 
kernel and see that nothing good happens.

-------------------- CUT LINE -------------------
PS I know that not the ideal way to solve the problem, but booting customized kernel just 
for the imaging sessions for me seems to be a good trade off.

Thank you
diff mbox

Patch

--- config.c.ORIG   2018-03-14 19:48:11.000000000 +0200
+++ config.c   2018-04-16 19:45:24.538599024 +0300
@@ -374,10 +374,12 @@ 
     j = maxpacket_maxes[usb_endpoint_type(&endpoint->desc)];

     if (maxp > j) {
-      dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid 
maxpacket %d, setting to %d\n",
+      dev_warn(ddev, "config %d interface %d altsetting %d endpoint 0x%X has invalid 
maxpacket %d, setting to %d (IGNORED!)\n",
            cfgno, inum, asnum, d->bEndpointAddress, maxp, j);
+      #if 0
        maxp = j;
        endpoint->desc.wMaxPacketSize = cpu_to_le16(i | maxp);

-------------------- CUT LINE -------------------