DATA!!!!!!!!!!!!!!
Running "i:\programming\libusbxhid\libusbhid_test.exe " Found 15 devices attached 8086:A36D, bus: 1, address: 0 8087:0AAA, bus: 1, address: 5 0424:2734, bus: 1, address: 51 1D50:6015, bus: 1, address: 38 1B1C:0C15, bus: 1, address: 7 10CE:EB93, bus: 1, address: 47 Found device with vid:pid 4302:60307 at idx:5! Device instance found: 1 at idx:5! 05E3:0610, bus: 1, address: 3 04E8:61F5, bus: 1, address: 18 1B1C:0C10, bus: 1, address: 4 0424:274C, bus: 1, address: 46 047D:1020, bus: 1, address: 45 1B1C:1B4F, bus: 1, address: 43 1A40:0101, bus: 1, address: 50 0C45:7403, bus: 1, address: 36 10C4:EA60, bus: 1, address: 30 Index of device 4302:60307=5 Device opened. Next I must claim the interface. Freeing device list with 15 devices USB device list freed. good boy! device attempting go clear halt on ep $81 libusb: error [hid_clear_halt] unable to match endpoint to an open interface - cannot clear clear halt failed driver inactive - can claim interface getting configuration.... active config:1 Claiming interface.....fingers crossed... Interface claimed ... yay! received:8 bytes from device 04,7F,. ,. ,0F,12,. ,1A, received:8 bytes from device . ,69,. ,. ,. ,13,. ,08, received:8 bytes from device . ,D3,. ,. ,. ,. ,01,92, received:8 bytes from device . ,8F,. ,. ,. ,. ,00,8A, received:8 bytes from device . ,2B,. ,. ,. ,. ,. ,0A, Interface released. Phew.. Heap dump by heaptrc unit of i:\programming\libusbxhid\libusbhid_test.exe 401 memory blocks allocated : 18362/20440 401 memory blocks freed : 18362/20440 0 unfreed memory blocks : 0 True heap size : 196608 (160 used in System startup) True free heap : 196448 Yay I FINALLY got somewhere with this thing!!! Thanks for the example Stefan! I have a python example of how to decode the meaning of the incoming data, that's how I figured out that it sends 8 bytes at a time. Is there a way I can read data from the device with a timeout instead of just waiting forever for it? It doesn't send anything unless I push a button, but I need to do other things like update the LCD if I am not pushing a button. My python example uses a function called hid.read(size,timeout) so I'm trying to do something similar. This is going to be a console application when I am done, do I don't have a way to do anything else, so a timeout would work best. I'm also trying to figure out how to write to the LCD... Here is the python code the outputs stuff to the device: # send feature report, but breaks it into 7 byte packets def write(self, data): n = 0 n += self.hid.send_feature_report(data[0:7], 0x06) n += self.hid.send_feature_report(data[7:14], 0x06) n += self.hid.send_feature_report(data[14:21], 0x06) n += self.hid.send_feature_report(data[21:28], 0x06) n += self.hid.send_feature_report(data[28:35], 0x06) n += self.hid.send_feature_report(data[35:42], 0x06) return n I think there is a bug because 7 bytes would be data[0..6] and it would not duplicate byte 7.... but the 0x06 must tell it to send from bytes 0 to 6... but anyway, regardless of that, how do I do something like hid.send_feature_report? I'm guessing that libusbhid_set_report() is maybe something similar? But it has parameters for reportType and reportNum... any clue what to put there? Or is this not even the right function? I thought maybe putting HID_REPORT_TYPE_FEATURE would mean to send a feature report? But reportNum I have no idea... I stuck a 1 in there just to see and tried: libusbhid_set_report(device_context,HID_REPORT_TYPE_FEATURE,1,7,hidOutData[0..6]); but then I get: libusb: warning [_hid_set_report] mismatched report ID (data is FE, parameter is 01) control transfer to usb device failed! $FE is what I have in hidOutData[0], but I'm not sure what it wants for a report id? I put my attempt on Github here: https://github.com/Zaaphod/libusbxhid Can you tell me where to get libusb_1.0_X86.dll ? I had the x64 version from the sample Jean sent me, but I would like to make my program work on 32bit machines as well. Thanks to everyone for the help with this! I really appreciate it. James _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal