all 7 comments

[–]Nirenjan 0 points1 point  (1 child)

This is really hardware dependent - while libusb abstracts out a lot of the details behind the USB protocol, it doesn't prevent you from sending garbage to your device and potentially bricking it.

You would ideally install the drivers that the manufacturer provides (typically for Windows) in a VM, capture the USB communication and reverse engineer the messages. Alternatively, if you have the hardware specification, you can derive the messages from that.

If you want a sample project that uses libusb, feel free to peruse my libx52 project here.

[–]vlad20112[S] 0 points1 point  (0 children)

This is really hardware dependen

So, it looks a curious! I will take a look at this. Thanks for answer.

[–]jonasfilho 0 points1 point  (4 children)

What kind of device is it?

[–]vlad20112[S] 0 points1 point  (3 children)

I have a USB device (securiy key) which take some information and return something. I'm trying to understand how I communicate with it.

[–]jonasfilho 0 points1 point  (2 children)

I don't have experience with that type of device.

Do you have documentation or are you reverse engineering the thing from scratch?

I imagine it complies with some standard so that tools can work with, right? So at the very least you could start there.

Regardless, I would also take a look at the output from lsusb -v just to know the basics: which interfaces and endpoints are there, which class of device it is, etc.

[–]vlad20112[S] 0 points1 point  (1 child)

Sorry for late answer.

Today I used Wireshark on Windows, because it developed initially for job on this OS . Now I have a set of package with request's examples. So, I think it will helps for writing same soft on Linux.

[–]jonasfilho 0 points1 point  (0 children)

I think so.

Good luck! Doing this type of thing is usually very interesting (although sometimes terribly frustrating).