Quote:
Originally Posted by eppeP
Unless I have misinterpreted something, this should not be that much of a problem. Maybe a bit inconvenient if you don't know USB programming though.
If you can get the device into APX mode it will answer the first read request with the UID.
So if you open the device (955:7820) and initiate a bulk transfer on endpoint 0x81 and you should get 8 bytes that is the UID.
Something like:
Code:
#include <libusb-1.0/libusb.h>
#include <stdio.h>
#include <stdint.h>
int main(void)
{
unsigned char data[64];
int received_length;
int r = 1;
libusb_context* ctx = NULL;
libusb_device_handle* dev_handle = NULL;
libusb_init(&ctx);
dev_handle = libusb_open_device_with_vid_pid(ctx, 0x0955, 0x7820);
if(dev_handle)
{
r = libusb_bulk_transfer(dev_handle, 0x81, data, sizeof(data), &received_length, 10000);
if (r == 0)
{
if(received_length == 8)
{
printf("uid: %#016lx\n", *(uint64_t*)data);
}
else
{
r = 1;
printf("Error: We got %d bytes of data insetad of the 8 bytes we expected...\n", received_length);
}
}
else
{
printf("Error: USB read failed!\n");
}
libusb_release_interface(dev_handle, 0);
}
else
{
printf("Error: Failed to open device!\n");
}
libusb_exit(ctx);
return r;
}
|
First thanks
having a hard time compiling in ubuntu
output is:
lr@lr:~/a500$ gcc -Wall -W -Werror apx.c -o apx
/tmp/ccNiYNxr.o: In function `main':
apx.c  .text+0x36): undefined reference to `libusb_init'
apx.c  .text+0x4c): undefined reference to `libusb_open_device_with_vid_pid'
apx.c  .text+0x82): undefined reference to `libusb_bulk_transfer'
apx.c  .text+0xec): undefined reference to `libusb_release_interface'
apx.c  .text+0x104): undefined reference to `libusb_exit'
collect2: ld returned 1 exit status
any ideas for me?
|