On Tue, 26 Oct 2004, Alex Sanks wrote:

> Hi Alan,
> 
> Sorry for the delay on this.  Anyway, I'm trying to figure out how to
> duplicate this easily.
> 
> Here's what I did (host is vanilla 2.6.9, built with CONFIG_USB_DEBUG and
> CONFIG_USB_SUSPEND:
> - modprobe net2280
> - modprobe g_zero
> - echo -n 3 > /sys/bus/usb/device/1-1/power/state
>       (the device itself is 1-1:3.0, but changing its "state" had no
> effect)
> - NET2280 is now suspended (and detected by g_zero)
> - rmmod g_zero (no messages appear in syslog, but reading
>   /sys/bus/pci/drivers/net2280/registers shows the USB_DETECT_ENABLE bit got
> 
>   cleared in USBCTL as expected)
> 
> Since USB_DETECT_ENABLE is cleared, the chip should have disabled its
> internal pull-ups.  It's unclear to me how to verify this from the Linux
> host.  Running lsusb *does* continue to show the device, until I resume the
> hub.  At that point I see the resume and "device removed" messages show up
> in syslog.
> 
> That all seems reasonable to me, but, unfortunately, we're rapidly reaching
> the point where my knowledge in the USB host-side and power management stuff
> ends.  Could you give me a little more detail regarding what exactly you're
> seeing versus what you expect?
> 
> regards,
> Alex

I can't remember exactly what I did, but here are two ways to demonstrate
the problem.  The first involves connecting the card to a Windows host.  
Then do

        modprobe net2280
        modprobe g_file_storage removable=y

The host detects the device and installs the appropriate driver.  Then
click on the "Remove device" icon in the System Tray and tell Windows you
want to disconnect the new drive.  This will cause Windows to disable the
port.  Then

        rmmod g_file_storage
        modprobe g_file_storage removable=y

Windows does not detect a connect status change.


The second test involves applying the following patch to the file-storage 
driver:

===== drivers/usb/gadget/file_storage.c 1.28 vs edited =====
--- 1.28/drivers/usb/gadget/file_storage.c      2004-10-20 10:25:24 -04:00
+++ edited/drivers/usb/gadget/file_storage.c    2004-10-27 13:35:18 -04:00
@@ -203,7 +203,7 @@
  */
 
 
-#undef DEBUG
+#define DEBUG
 #undef VERBOSE
 #undef DUMP_MSGS
 
@@ -1364,6 +1364,7 @@
                        VDBG(fsg, "get device descriptor\n");
                        value = min(ctrl->wLength, (u16) sizeof device_desc);
                        memcpy(req->buf, &device_desc, value);
+value = 0;
                        break;
 #ifdef CONFIG_USB_GADGET_DUALSPEED
                case USB_DT_DEVICE_QUALIFIER:
===== drivers/usb/gadget/file_storage.c 1.28 vs edited =====

For this test, I used a Linux host running 2.6.9-bk7 (approximately).
Configure USB debugging on to see what's happening behind the scenes.

        modprobe net2280
        modprobe g_file_storage removable=y

The patch will prevent the driver from enumerating, so Linux will give up
on it and disable the port.  This shows up as a suspend of the gadget, and
you should see a suspend message appear in the system log.

        rmmod g_file_storage

This should show up as a connect change, but it doesn't.

        modprobe g_file_storage removable=y

Likewise, so should this.

Alan Stern



-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_id=5588&alloc_id=12065&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to