flat assembler
Message board for the users of flat assembler.
Index
> OS Construction > UHCI IN Transfert Descriptor fail |
Author |
|
BAiC 07 Oct 2019, 07:37
I don't know if this is your problem but I'm going to say it just in case.....
there is a "Chicken-or-the-egg" problem with USB. you need to know the Max Packet Size of the DEVICE before you issue any packets to/from the device. the problem is that the Max Packet Size is a field in the Device Descriptor that you need to issue packets to get. hence the chicken/egg. the Max Packet Size field is in the 7th byte of the Device Descriptor: send a request for the first 8bytes of the Device Descriptor and validate the Transfer Length received in the UHCI data structure to ensure 8 bytes were read before any potential error (an error wont necessarily occur). then use the Max Packet Size field to read in the full descriptor. Stefan |
|||
07 Oct 2019, 07:37 |
|
N-LG 07 Oct 2019, 16:35
i try to do a read of only 8 bytes of descriptor but it doesnt work
i test different usb device and all doesnt work and one devide doesnt accept my setup frame, so i have a doubt whit the format of the setup frame and i test to reverse the wLength in MSB first format but it doesnt work too do you think the setup frame i use is good? |
|||
07 Oct 2019, 16:35 |
|
QuarkMan 07 Oct 2019, 18:22
If you are trying to do something similar to:
Code: in rax, dx Here is your error, because x86 cannot read/write 8 Bytes at time, the maximum is 4 Bytes. |
|||
07 Oct 2019, 18:22 |
|
N-LG 07 Oct 2019, 19:24
read data from usb device is diffrent than reading I/O port, its more complex
|
|||
07 Oct 2019, 19:24 |
|
BAiC 07 Oct 2019, 20:10
QuarkMan wrote: If you are trying to do something similar to: ROTFLMAO _________________ byte me. |
|||
07 Oct 2019, 20:10 |
|
BAiC 07 Oct 2019, 20:17
N-LG wrote: i try to do a read of only 8 bytes of descriptor but it doesnt work I use an expression of identifiers for my SETUP packet so I wouldn't recognize the 8 byte numeric string offhand. I suggest creating identifiers for each option instead of using literal numbers. it serves to expose bugs that are very difficult to see when reduced to numbers. edit: I just looked at my early device descriptor retrieval code and it's a combination of identifiers and literals... oops. Code: mov rdi, 18 shl (8*6) + 0 shl (8*4) + usb.wValue.DEVICE shl (8*3) + 0 shl (8*2) + usb.bRequest.GET_DESCRIPTOR + 1 shl 7 + 0 shl 5 + 0 shl 0 _________________ byte me. |
|||
07 Oct 2019, 20:17 |
|
N-LG 07 Oct 2019, 20:44
in my code i use this:
mov byte[usb_commande],10000000b ;bmRequestType mov byte[usb_commande+1],6 ;bRequest (ici get descriptor) mov byte[usb_commande+2],1 ;LSB wValue (type) mov byte[usb_commande+3],0 ;MSB wValue (index) mov word[usb_commande+4],0 ;wIndex mov word[usb_commande+6],18 ;wLength i have a doubt about the word of the structure's command, in assembly we use LSB first but it seem to be a MSB first in the setup structure |
|||
07 Oct 2019, 20:44 |
|
BAiC 07 Oct 2019, 20:51
usb.wValue.DEVICE = 1
usb.bRequest.GET_DESCRIPTOR = 6 shl 8 |
|||
07 Oct 2019, 20:51 |
|
BAiC 07 Oct 2019, 20:53
you've got the wValue backwards
|
|||
07 Oct 2019, 20:53 |
|
BAiC 07 Oct 2019, 21:02
LOL. my code doesn't properly express what that field is... oops..
wValue is being used as a two byte field. one byte is the Descriptor Type and the other is the Descriptor Index. |
|||
07 Oct 2019, 21:02 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.