Re: How to force enumeration from linux gadget/device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 11-05-11 02:28 PM, Alan Stern wrote:
On Wed, 11 May 2011, Marc St-Jean wrote:

There are a couple of things you could do.  The easiest is to unload
the gadget driver and then reload it a second or so later.  For
example, if you're using g_ether:

	rmmod g-ether
	sleep 1
	modprobe g-ether
I'm assuming you mean g_ether.ko? I've tried this already and it didn't
appear to help.

I tried again with a module based build in case I was doing something wrong, but no luck. Somehow unplugging or interrupting VBUS causes additional steps to occur in the host.

Here's essentially what I'm doing in my reset script to simulate a reboot. It works the first time after unplugging but will not force the host to reestablish IP networking if re-ran. The output of ifconfig and route all looks fine.

killall dhcpd
ifconfig usb0 down

rmmod g-ether
#rmmod arcotg-udc
#rmmod fsl-otg-arc
sleep 5 (tried up to 20)
modprobe fsl-otg-arc
#modprobe arcotg-udc
#modprobe g-ether

iptable --flush
more iptable to reestablish NATing

ifconfig usb0 up 10.10.0.1 netmask 255.255.255.0
dhcpd -S

I also tried building otg supoprt and udc driver as modules with the above lines uncommented but it made no differences.

Alternatively, if you can change the source code for the gadget driver
and if your controller driver supports this, you can have the gadget
driver call:

	usb_gadget_disconnect(gadget);
	ssleep(1);
	usb_gadget_connect(gadget);
I'm assuming this is equivalent to the rmmod above?
More or less.

I'm very interested in trying the code method as I see that these functions control the pullups. Earlier this week I found an Oct 29, 2008 post by you suggesting the D+/- pullup method to force enumeration.

Are you suggesting this code should be added to the g_ether driver (ether.c)?
Where should it go, at bind time (i.e. in eth_bind())?

Marc

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux