Page 1 of 1

Emulate an USB HUB

Posted: Mon Sep 06, 2010 4:32 pm
by Maui
Hi there...

I am currently trying to emulate an USB-Hub and connect/disconnect several other devices (which would have to be emulated aswell). So far I have been able to present the Hub to the host and get it to request port states. The thing I am currently confused about is emulating the connect/disconnect of devices to my emulated hub. Anyone round here ever done sth like that.

Any help would be greatly appreciated.

maui

Re: Emulate an USB HUB

Posted: Thu Sep 09, 2010 3:34 pm
by yapoid
Hi,
I'm also working on emulating an USB HUB. I got the USB HUB to be found by Linux. Here's my dmesg output:

Code: Select all

[33547.616587] usb 5-1: new low speed USB device using uhci_hcd and address 83
[33547.774569] usb 5-1: configuration #1 chosen from 1 choice
[33547.779024] hub 5-1:1.0: USB hub found
[33552.785401] hub 5-1:1.0: config failed, can't read hub descriptor (err -22)


As you can see, Linux can't get the USB HUB Descriptor. How did you get V-USB to answer with the USB HUB Descriptor?

I think we're both working on the same project, would you mind PMing me with some contact info (MSN, GTalk, IRC or something) so we can work on this together?

Re: Emulate an USB HUB

Posted: Fri Sep 10, 2010 12:54 am
by crazyc
I'm working on the same thing. I have everything working (hub, port connect, long descriptor) except the timing. The hub endpoint 1 always gets stuck in a stall condition after port 1 is enumerated because it can't be reached while usbDeviceAddr is set to the port 1 address. I'm using an attiny85 with the internal oscillator.

Re: Emulate an USB HUB

Posted: Fri Sep 10, 2010 6:18 am
by yapoid
@crazyc did you need to patch something to get V-USB to answer the HUB descriptor? (second byte from wValue equals 0x29, AFAIK)

Are you guys working on a new code from scratch or just porting the existing AT90USB LUFA-based source code?

I'm working with an ATmega328p clocked with an external 20MHz crystal and trying to just port the existing source code.

p.s.: Since we're all working on the same thing, I think it would be wise if we join our efforts. We can setup a github repo or something.

Re: Emulate an USB HUB

Posted: Fri Sep 10, 2010 5:09 pm
by sys4096
I have an Arduino Mega1280 and also trying to get it working. Did you build the hardware with the zener diodes ?

Re: Emulate an USB HUB

Posted: Fri Sep 10, 2010 7:59 pm
by yapoid
Yes. Two 3v6 diodes: one between D+ and GND, the other one between D- and GND. My microcontroller is running with 5V, powered by the USB port.

Re: Emulate an USB HUB

Posted: Sun Sep 19, 2010 10:59 pm
by Melfice
I have an ATmega64 and also trying to make this. Can anybody share their stuff, so it might be easier?

Re: Emulate an USB HUB

Posted: Mon Sep 20, 2010 8:03 am
by xen0
I just patched up version on github. Search for a fork with vusb. It's working for the arduino mega, should be relatively simple to patch to work for other boards/chips.

Re: Emulate an USB HUB

Posted: Wed Sep 22, 2010 3:03 pm
by sys4096
hey xen0,

Just tried your port and it works like a charm. Thanks a lot for your effort !

Re: Emulate an USB HUB

Posted: Thu Sep 23, 2010 2:22 am
by fake
seems vusb does not support write value to usbDeviceAddr "Reg".

Re: Emulate an USB HUB

Posted: Wed Feb 09, 2011 10:38 pm
by brian
Is hub emulation example code available? Thanks.