I'm having trouble getting started. I'm trying to reverse engineer a USB light gate. The first "Setup packet" should return "40 00 00 00 00 00 00 00" according to "Device Monitor Studio" but I can't get it to return anything.
Can anyone see what I'm doing wrong? I think the first call should return 8 bytes not 0. I've put the USB trace at the end.
Many thanks,
Mike
00000002 08.11.2010 22:22:42.675 +13.816 DOWN 0x00000000 URB_FUNCTION_VENDOR_DEVICE
00000003 08.11.2010 22:22:42.677 +0.001 UP 0x00000000 URB_FUNCTION_CONTROL_TRANSFER
00000005 08.11.2010 22:22:42.699 +0.001 UP 0x00000000 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
000000: PnP Event: Device Connected (UP), 08.11.2010 21:47:33.801
The USB device has just been connected to the system.
000002: Vendor-Specific Request (DOWN), 08.11.2010 21:47:45.208 +11.406
Destination: Device
Reserved Bits: 0
Request: 0x0
Value: 0x0
Send 0x0 bytes to the device
000003: Control Transfer (UP), 08.11.2010 21:47:45.210 +0.002. Status: 0x00000000
Pipe Handle: 0x8725903c
Hi,
I'm having trouble getting started. I'm trying to reverse engineer a USB light gate. The first "Setup packet" should return "40 00 00 00 00 00 00 00" according to "Device Monitor Studio" but I can't get it to return anything.
This page has been useful to get started:
http://da.vidr.cc/2010/07/17/reverse-engineering-the-brother-mfc-7400c/
Here's my code:
dev.open(1, 0, -1);
byte nb = new byte;
int bytes = dev.controlMsg(USB.REQ_TYPE_DIR_DEVICE_TO_HOST | USB.REQ_TYPE_TYPE_VENDOR
| USB.REQ_TYPE_RECIP_DEVICE, 0, 0, 0, nb, nb.length, 1000, false);
System.out.println("bytes="+bytes);
logData(nb);
byte buff2 = new byte;
bytes = dev.readBulk(0x81, buff2, buff2.length, 2000, false);
System.out.println("bytes="+bytes);
logData(buff2);
dev.close();
and the output:
bytes=0
Data: 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0
bytes=2
Data: 0x31 0x60
Can anyone see what I'm doing wrong? I think the first call should return 8 bytes not 0. I've put the USB trace at the end.
Many thanks,
Mike
00000002 08.11.2010 22:22:42.675 +13.816 DOWN 0x00000000 URB_FUNCTION_VENDOR_DEVICE
00000003 08.11.2010 22:22:42.677 +0.001 UP 0x00000000 URB_FUNCTION_CONTROL_TRANSFER
00000005 08.11.2010 22:22:42.699 +0.001 UP 0x00000000 URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER
000000: PnP Event: Device Connected (UP), 08.11.2010 21:47:33.801
The USB device has just been connected to the system.
000002: Vendor-Specific Request (DOWN), 08.11.2010 21:47:45.208 +11.406
Destination: Device
Reserved Bits: 0
Request: 0x0
Value: 0x0
Send 0x0 bytes to the device
000003: Control Transfer (UP), 08.11.2010 21:47:45.210 +0.002. Status: 0x00000000
Pipe Handle: 0x8725903c
Setup Packet
40 00 00 00 00 00 00 00 @…….
Recipient: Device
Request Type: Vendor
Direction: Host->Device
Request: 0x0 (Unknown)
Value: 0x0
Index: 0x0
Length: 0x0
000005: Bulk or Interrupt Transfer (UP), 08.11.2010 21:47:45.224 +0.013. Status: 0x00000000
Pipe Handle: 0x86c20124 (Endpoint Address: 0x81)
Get 0x2 bytes from the device
31 60