How can I get details on NON-HID USB Devices? Like the serial number, etc in c#?
I have created successfully a sample application to retrieve those information on HID only devices but not on NON-HID USB Devices.
Have you looked into LibUSB .Net?
http://sourceforge.net/projects/libusbdotnet/
I remmber seeing that this was possible, I'll try and dig the article out.
You want to retrieve the device descriptors. Assuming a driver has been bound to the device, some of these are already available as they can be seen from Device Manager.
Related
I'm trying to connect to FT232R USB UART device using Windows Runtime Component for Windows Store application. Unfortunately, nothing seem to work.
My device has a vid of 0x0403 and a pid 0x6001 which seem pretty standard for this type of the device.
I tried this approach but in my case the ClassCode and SubClassCodde are both 0x00 respectively and InterfaceClassCode and InterfaceSubClassCode are both 0xFF. All this data comes from the USB view utility.
Using selector based on these class and subclass codes no device is found by DeviceInformation.FindAllAsync(selector). Also selector created based on vid and pid does not find any device.
Without the selector the device is found but I receive null in UsbDevice.FromIdAsync(serviceInfo.Id).
I also tried the FTDI approach. I downloaded the FTDI drivers and referenced the FTDI.D2xx.WinRT.winmd and FTDI.D2xx.WinRT.USB.winmd. I used the approach documented in this PDF but FTDI.D2xx.WinRT.FTManager.GetDeviceList() returns empty list.
The DeviceCapabilities are defined as they should according to documentation I found:
<Capabilities>
<m2:DeviceCapability Name="usb">
<!--FT232AM, FT232BM, FT232R and FT245R Devices-->
<m2:Device Id="vidpid:0403 6001">
<m2:Function Type="name:vendorSpecific" />
</m2:Device>
</m2:DeviceCapability>
</Capabilities>
What am I doing wrong?
Well, after long hours of fighting I found the solution. Posting it here in case anyone will need it in the future.
First of all, you should follow the official FTDI guide to install FTDI drivers from here.
You will need to remove default drivers installed by Windows for your device.
Do it this way:
It's important to check the "Delete the driver software for this device" checkbox.
Do so for Serial controller also:
Afterwards disable Windows automatic drivers installation as described here.
Then scan for hardware changes in the Device manager and you'll see the unrecognized device.
Install drivers for it manually.
Afterwards you'll see your device under Universal Serial Bus devices and not controllers.
Now your device will be fully accessible using the FTDI API.
Here is a link to API guide in case you need it. It also has an explanation on how to install correct FTDI drivers.
I am working on USB devices and can identify a usb device. But I have a theoretical question.Is it shows any usb device like portable cd drive or specifically flash drives? I could nt check all possibilities due to lack of these hardwares :). Is there any method to identify if it is a flash drive or another usb device.
Please don't beat with what you have tried. I googled regarding same but because of my least experience I couldn't find any.
Thanks
Please use the class USBSerialNumber
USBSerialNumber usb = new USBSerialNumber();
string serial = usb.getSerialNumberFromDriveLetter("f:\");
MessageBox.Show(serial);
Each pendrive has serial number which is unique.
You can use this class for this purpose.
Download it from following link:
http://www.cfdan.com/posts/Retrieving_Non-Volatile_USB_Serial_Number_Using_C_Sharp.cfm
I'm trying to contact an usb barcode scanner as a serial port, using his virtual COM port name and the Serial Port class.
The reason I'm trying to do it this way is to avoid using the scanner as a keyboard wedge since I need the possibility to scan even when the form is hidden.
Problem is that when I connect the barcode scanner to the usb port, and I run the "GetPortNames" function, I get an empty list. Any suggestions why? Thanks
Typically many USB barcode scanners will just appear as virtual keyboard devices - not virtual COM ports. That would explain why it doesn't appear.
Does your scanner support some kind of serial emulation mode? You may need to configure it or install different drivers to enable this. Does it appear as a serial port in Device Manager? (Look under the Ports tree)
As an aside:
Take a look at this question if you find that the 'keyboard mode' is the only one supported:
Reading a barcode using a USB barcode scanner along with ignoring keyboard data input while scanner product id and vendor id are not known
This question refers to this article with a large amount of good information relating to keyboard hooks and filtering out the scanned barcodes:
http://nicholas.piasecki.name/blog/2009/02/distinguishing-barcode-scanners-from-the-keyboard-in-winforms/
I cannot guarantee that it will work with your specific device, but I've seen code that solved a similar problem once. The solution was looking for the port name in the registry.
The code for it can be found in the open source project ez430chronosnet; a .NET library that can access TI's EZ430 Chronos watch via its USB dongle.
You'll want to look at the PortName.cs file that looks for the name in the registry (it will at least point you to the right keys) and the Chronos.cs file that does the actual port opening with SerialPort.
I want to write a simple program that detect USB Wifi plugged computer and unplug it. I am finding code or library help me to do that (C# or Delphi). Tell me if you know :)
Or
Code or lib that list all USB devices on computer ?
Thanks !
I can only answer part of the question. You can "eject" USB devices using this API:
CM_Request_Device_Eject (MSDN link)
I'm using it to eject USB thumb drives after I copy stuff onto them in a backup application. I'm pretty sure there are ways of enumerating available USB devices using one of the many CM_XXX routines, but I was only interested in storage devices connected via USB, so I can't comment on WiFi devices.
An other sugestion: Maybe you can solve your problem at an other layer, maybe you can detect the addition of a new network adapter and disable that. Not all USB devices can be ejected, it's probably a driver-related issue. But I guess, if you can eject it from the notification area icon, you can eject it from code.
may have a look at http://sourceforge.net/projects/libusbdotnet/ (never used it by myself)
I'd like to know if it is possible how to do it, because my client asked me if the program I'm developing could also send wallpapers to nearby cellphones(my program will be in a place with many people passing by, so it would be good to have the bluetooth feature).
Thanks!
it can send pictures as files, users then may set them as wallpapers.
Unless the phone and the computer support bluetooth and are connected, you cannot. You can send the files to mobiles over bluetooth. 32feet provides a nice library to perform bluetooh related operations. Try that.
Hope it helps.
To do this you would need to
Make sure each user's device is paired to your bluetooth "sever"
Create the ability to auto connect and send the file.
On your phone's application, receive the image file and set the phone background - this will be different for each type of phone's OS. I would assume you are aiming towards Window Mobile Devices, since you are using c#.
The first step i see as being the difficult step as each phone much "register" the bluetooth of the server to be paired with it.