thank you a lot eddyb for your answer.
i have applied it and now my code works well on QEMU and able to send requests to a Mass Storage Device connected to QEMU.
But i now, i wish i could find an answer to another question, which says "Is it able to connect more than two devices to UHCI?" i see that there are only 2 ports in the UHCI, does each port represent a device? or more than one device? and if it presents more than one device, so chould you inform me plz how it detects changes in drives? UHCI specs is misleading and doesn't talk about all of this topics.
Thank you a lot and Best Regards,
Mostafa.
UHCI Counter in VMware?
Re: UHCI Counter in VMware?
It's actually one device/port. And UHCI can have more than 2 ports, but it's uncommon. But qemu emulates a hub, in case there are more devices present. Sadly, there's no way of detecting a device change on UHCI by IRQs... You have to poll the PORTSC registers at a constant rate to allow real time device recognition. EHCI does send IRQs and USB hubs have a interrupt endpoint, which you can use to detect a port change.mostafazizo wrote:thank you a lot eddyb for your answer.
i have applied it and now my code works well on QEMU and able to send requests to a Mass Storage Device connected to QEMU.
But i now, i wish i could find an answer to another question, which says "Is it able to connect more than two devices to UHCI?" i see that there are only 2 ports in the UHCI, does each port represent a device? or more than one device? and if it presents more than one device, so chould you inform me plz how it detects changes in drives? UHCI specs is misleading and doesn't talk about all of this topics.
Thank you a lot and Best Regards,
Mostafa.
- iocoder
- Member
- Posts: 208
- Joined: Sun Oct 18, 2009 5:47 pm
- Libera.chat IRC: iocoder
- Location: Alexandria, Egypt | Ottawa, Canada
- Contact:
Re: UHCI Counter in VMware?
Now i understanded, any new attached device is placed in Power State, then Default State, and i should send SET ADDRESS request to place the device in Address State.
Then I should send SET CONFIGURATION to place it in the Configured State. my code does all of that, but the address of the connected device doesn't change, and i still call it through address Zero. i read somewhere that Microsoft Windows Resets the bus while doing 'Enumeration', in order for 'SET ADDRESS' to work successfully. but i don't now exactly what is 'Bus Reset'. I tried 'Global Reset', 'Host Controller Reset', and 'Port Reset', but it still not works and the drive is still accessible through Address 0.
Here is my code:
Do u have any idea plz????
Thanks and Best Regards,
Mostafa.
Then I should send SET CONFIGURATION to place it in the Configured State. my code does all of that, but the address of the connected device doesn't change, and i still call it through address Zero. i read somewhere that Microsoft Windows Resets the bus while doing 'Enumeration', in order for 'SET ADDRESS' to work successfully. but i don't now exactly what is 'Bus Reset'. I tried 'Global Reset', 'Host Controller Reset', and 'Port Reset', but it still not works and the drive is still accessible through Address 0.
Here is my code:
Code: Select all
// Enumeration:
// 1: Requesting The first 64 bytes of Device Descriptor:
printk(" 64 Bytes of Device Descriptor: %x;\n", uhci_do_setup_transfer(0, 0, 0x80, 0x06, 0x0100, 0x00, 64));
// 2: Reading First 8 Bytes:
printk(" First 8 Bytes: %x;\n", uhci_do_in_transfer(0, 0, krnl_get_selector_base(ds) + (int) uhci_buffer, 8));
// 3: Immediately Reset the Bus:
// What to do?????
// 4: Enter Address State:
printk(" Enter Address State: %x;\n", uhci_do_setup_transfer(0, 0, 0x00, 0x05, 0x0001, 0x00, 0x0));
// 5: Read the entire 18 bytes of Device Descriptor:
printk(" 18 Bytes of Device Descriptor: %x;\n", uhci_do_setup_transfer(0, 0, 0x80, 0x06, 0x0100, 0x00, 18));
printk(" Reading State: %x;\n", uhci_do_in_transfer(0, 0, krnl_get_selector_base(ds) + (int) uhci_buffer, 18));
// 6: Read First 9 Bytes of Configuration Descriptor:
printk(" 9 Bytes of Config Descriptor: %x;\n", uhci_do_setup_transfer(0, 0, 0x80, 0x06, 0x0200, 0x00, 9));
printk(" Reading State: %x;\n", uhci_do_in_transfer(0, 0, krnl_get_selector_base(ds) + (int) uhci_buffer, 9));
// 7: Read Configuration Descriptor:
printk(" Config Descriptor: %x;\n", uhci_do_setup_transfer(0, 0, 0x80, 0x06, 0x0200, 0x00, 0x20));
printk(" Reading State: %x;\n", uhci_do_in_transfer(0, 0, krnl_get_selector_base(ds) + (int) uhci_buffer, 0x20));
// 8: Enter Configuration State:
printk(" Configuration State: %x;\n", uhci_do_setup_transfer(0, 0, 0x00, 0x09, 0x0001, 0x00, 0x0));
Thanks and Best Regards,
Mostafa.
- iocoder
- Member
- Posts: 208
- Joined: Sun Oct 18, 2009 5:47 pm
- Libera.chat IRC: iocoder
- Location: Alexandria, Egypt | Ottawa, Canada
- Contact:
Re: UHCI Counter in VMware?
well, in order to resolve that, i would like to ask a question, does a TD represent a Packet or a full transaction??
Re: UHCI Counter in VMware?
Both. A transaction basically means the transfer of one packet. A control transaction (I suppose it is this term that confuses you) means a sequence of packets/transfers/transactions, a SETUP one and an IN/OUT one...mostafazizo wrote:well, in order to resolve that, i would like to ask a question, does a TD represent a Packet or a full transaction??
PS: I see you have lots of questions, we could talk on IRC (channel ##eddyb, server irc.freenode.net) .
EDIT: I just realized transfer and transaction can both have the both meanings, so packet is a bit better to use . Oh, and you can reuse a TD as many times as you want .