Estuve haciendo sniffing sobre el puerto usb al conectarle un teclado y aquí tengo los resultados.
Al conectar el teclado se envian y reciben varios datos... una vez que el protocolo ya esta iniciado, solo se envía la información de la tecla presionada y nada más.
Ahora solo hay que averiguar que es lo que envía el HOST (PC) al controlador integrado del teclado para que éste comience a enviar los datos de las teclas presionadas.
ESTO ES LO QUE SUCEDE CUANDO SE ENCHUFA EL TECLADO EN UN HOST CON WIN XP:
000005: PnP Event: Query ID (UP), 11.05.2006 18:34:20.3906250 +93.4062500
Hardware IDs: USB\Vid_0a81&Pid_0101&Rev_0110&MI_00, USB\Vid_0a81&Pid_0101&MI_00
000006: PnP Event: Query ID (UP), 11.05.2006 18:34:20.3906250 +0.0
Compatible IDs: USB\Class_03&SubClass_01&Prot_01, USB\Class_03&SubClass_01, USB\Class_03
000007: Get Descriptor Request (DOWN), 11.05.2006 18:34:20.4218750 +0.0312500
Descriptor Type: Device
Descriptor Index: 0x0
Transfer Buffer Size: 0x12 bytes
000008: Get Descriptor Request (UP), 11.05.2006 18:34:20.4218750 +0.0
Descriptor Type: Device
Descriptor Index: 0x0
Transfer Buffer Size: 0x12 bytes
000009: Get Descriptor Request (DOWN), 11.05.2006 18:34:20.4218750 +0.0
Descriptor Type: Configuration
Descriptor Index: 0x0
Transfer Buffer Size: 0x9 bytes
000010: Get Descriptor Request (UP), 11.05.2006 18:34:20.4218750 +0.0
Descriptor Type: Configuration
Descriptor Index: 0x0
Transfer Buffer Size: 0x9 bytes
000011: Get Descriptor Request (DOWN), 11.05.2006 18:34:20.4218750 +0.0
Descriptor Type: Configuration
Descriptor Index: 0x0
Transfer Buffer Size: 0x22 bytes
000012: Get Descriptor Request (UP), 11.05.2006 18:34:20.4218750 +0.0
Descriptor Type: Configuration
Descriptor Index: 0x0
Transfer Buffer Size: 0x22 bytes
000013: Select Configuration (DOWN), 11.05.2006 18:34:20.4218750 +0.0
Configuration Index: 1
000014: Select Configuration (UP), 11.05.2006 18:34:20.4218750 +0.0
Configuration Index: 1
Configuration Handle: 0xfe6d2980
000015: Class-Specific Request (DOWN), 11.05.2006 18:34:20.4218750 +0.0
Destination: Inrterface, Index 0
Reserved Bits: 34
Request: 0xa
Value: 0x0
Send 0x0 bytes to the device
000016: Control Transfer (UP), 11.05.2006 18:34:20.4218750 +0.0
Pipe Handle: 0xfe747568
Setup Packet
21 0A 00 00 00 00 00 00 |
!....... |
Recipient: Inrterface
Request Type: Class
Direction: Host->Device
Request: 0xa (Unknown)
Value: 0x0
Index: 0x0
Length: 0x0
000017: Get Descriptor Request (DOWN), 11.05.2006 18:34:20.4218750 +0.0
Descriptor Type: Unknown
Descriptor Index: 0x0
Transfer Buffer Size: 0x81 bytes
000018: Control Transfer (UP), 11.05.2006 18:34:20.4218750 +0.0
Pipe Handle: 0xfe747568
05 01 09 06 A1 01 05 07 19 E0 29 E7 15 00 25 01 75 01 95 08 81 02 95 01 75 08 81 01 95 03 75 01 05 08 19 01 29 03 91 02 95 05 75 01 91 01 95 06 75 08 15 00 26 FF 00 05 07 19 00 2A FF 00 81 00 C0 |
....¡....à)ç..%. u....u...u. ....)...u... u...&ÿ.....*ÿ.. À |
Setup Packet
81 06 00 22 00 00 81 00 |
.."... |
Recipient: Inrterface
Request Type: Standard
Direction: Device->Host
Request: 0x6 (GET_CONFIGURATION)
Value: 0x2200
Index: 0x0
Length: 0x81
000019: PnP Event: Query ID (UP), 11.05.2006 18:34:20.4375000 +0.0156250
Device ID: USB\Vid_0a81&Pid_0101&MI_00
000020: PnP Event: Query ID (UP), 11.05.2006 18:34:20.4375000 +0.0
Hardware IDs: USB\Vid_0a81&Pid_0101&Rev_0110&MI_00, USB\Vid_0a81&Pid_0101&MI_00
000021: Class-Specific Request (DOWN), 11.05.2006 18:34:22.1250000 +1.6875000
Destination: Inrterface, Index 0
Reserved Bits: 34
Request: 0x9
Value: 0x200
Send 0x1 bytes to the device
000022: Control Transfer (UP), 11.05.2006 18:34:22.1250000 +0.0
Pipe Handle: 0xfe747568
Setup Packet
21 09 00 02 00 00 01 00 |
!....... |
Recipient: Inrterface
Request Type: Class
Direction: Host->Device
Request: 0x9 (Unknown)
Value: 0x200
Index: 0x0
Length: 0x1
Esto es lo que sucede cuando presionamos la tecla "a":
000045: Bulk or Interrupt Transfer (UP), 11.05.2006 18:37:01.7343750 +12.9062500
Pipe Handle: 0xfe536a84 (Endpoint Address: 0x81)
Get 0x8 bytes from the device:
00 00 04 00 00 00 00 00 |
........ |
000046: Bulk or Interrupt Transfer (UP), 11.05.2006 18:37:01.8437500 +0.1093750
Pipe Handle: 0xfe536a84 (Endpoint Address: 0x81)
Get 0x8 bytes from the device:
00 00 00 00 00 00 00 00 |
........ |
IDEM PARA LA TECLA "b":
000047: Bulk or Interrupt Transfer (UP), 11.05.2006 18:50:16.6250000 +794.7812500
Pipe Handle: 0xfe536a84 (Endpoint Address: 0x81)
Get 0x8 bytes from the device:
00 00 05 00 00 00 00 00 |
........ |
000048: Bulk or Interrupt Transfer (UP), 11.05.2006 18:50:16.7187500 +0.0937500
Pipe Handle: 0xfe536a84 (Endpoint Address: 0x81)
Get 0x8 bytes from the device:
00 00 00 00 00 00 00 00 |
........ |