Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Converting a driver to linux

I'm trying to write a linux driver to a device that i have the windows driver of (Similar to the case described Here, but a different device)

I'm using Libusb for the communication on the linux side, and SourceUSB as my USB sniffer (on the windows machine). Now I think I've replicated the controls and bulks properly, but I can't really test the linux log against the windows one. I'm running Ubuntu 12.04 on a VM.

So my questions are:

  1. Is there a multiplatform logger? That could really simplify the log compare process.
  2. When I attach the USB device to the VM - I get the VM driver in Windows. Sniffing this device gives me exactly what the device sees, right? I mean - Is this where I want to sniff?

EDIT: I've compiled my application on windows (libusb is cross platform - A big thanks to libusb developers who did such a good job) and my application worked properly.

When sniffing the VM driver while running my application on linux, I see the requests to the USB as VENDOR_DEVICE instead of CONTROL_TRANSFER and BULK_OR_INTERRUPT. This seems to be the problem if I understand correctly, since this is what the device "sees".

So I guess my problem now is why does Linux sends my requests as vendor.

ANOTHER EDIT: Problem solved:

  1. Listening to the VM driver gave me the wrong requests (I was listening to the VM driver traffic, not, as i wanted, the traffic of the my USB linux driver
  2. Libusb is perfectly multiplatform. It took me a few minutes to get my code to compile under windows, and from there it was pretty easy to debug and compare logs
like image 421
Nitay Avatar asked Oct 02 '12 11:10

Nitay


People also ask

Can Windows drivers be used in Linux?

The tool for getting Windows network drivers to work in Linux is called NdisWrapper (wiki, downloads).

Does Linux support drivers?

Each Linux operating system handles the driver installation process a different way. Second, most default Linux drivers are open source and integrated into the system, which makes installing any drivers that are not included quite complicated, even though most hardware devices can be automatically detected.

Can I install Windows driver on Ubuntu?

In most cases drivers will be automatically detected and used by Ubuntu. In the case of proprietary drivers you need to add them by going to System Settings > Additional Drivers. In some cases, such as wireless cards, you can use Windows drivers by using 'wrappers'. Save this answer.


1 Answers

You can use Wireshark to capture USB traffic. This page explain how to do it for Linux and Windows : CaptureSetup/USB

like image 93
Laurent Parenteau Avatar answered Sep 22 '22 14:09

Laurent Parenteau