Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Write file to a PNP device connected to a Windows PC

By plugging in a PNP device to a Windows PC I want to know if the device supports a feature of data transferring. I am majoraly interested in pushing some content to device. So, for example when I am plugging in a Windows Phone I can see over windows managment query that 5 new devices are added

Name: Windows Phone

CompartibleId: USB\MS_COMP_MTP, USB\Class_06&SubClass_01&Prot_01, USB\Class_06&SubClass_01, USB\Class_06


Name: WinUsb Device

CompartibleId: USB\MS_COMP_WINUSB, USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff, USB\Class_ff


Name: WinUsb Device

CompartibleId: USB\MS_COMP_WINUSB, USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff, USB\Class_ff


Name: WinUsb Device

CompartibleId: USB\MS_COMP_WINUSB, USB\Class_ff&SubClass_ff&Prot_ff, USB\Class_ff&SubClass_ff, USB\Class_ff


Name: USB Composite Device

CompartibleId: USB\DevClass_00&SubClass_00&Prot_00, USB\DevClass_00&SubClass_00, USB\DevClass_00, USB\COMPOSITE

How can I now get a glue that:

  • All the devices are parts of a single device
  • The device allows me to save a file on it
  • Find an indicator that certainly tells me about the suppoted file transfer protocol
  • In case if there are more than a sigle possiblility for file trasfer select the more fastest(or modern)

I will appreaciate any help even if you could just tell me a focused direction where I should continue my study/investigation.

I am looking at a generic way to work with devices. Desired implementation language is C#.

like image 924
Yaugen Vlasau Avatar asked May 05 '15 10:05

Yaugen Vlasau


1 Answers

Firstly You can consult this codeproject it gives you details of Windows Device Drivers.
SharpUSBLib and HidLibrary are two widely used libraries you can even get a tutorial project with implementation here.
SharpUsbLib earlier version used to screw up systems.

Would prefer libusbdotnet. If you have to work with an USB device (send requests, process responses), this library was the best solution I could find.

Pros:

Has all methods you need to work in synch or asynch mode. Source code provided Enough samples to start using it straight away.

Cons:

Poor documentation (it's common problem for open source projects). Basically, you can find just common description of methods in the CHM help file and that's it. But I still find provided samples and source code is enough for coding. Just sometimes I see a strange behaviour and want to know why it was implemented in this way and can't get even a hint... Seems unsupported any more. Last version was issued in Oct 2010. And it's hard to get answers sometimes.

like image 129
Jerin Avatar answered Oct 03 '22 04:10

Jerin