Working with USB devices in .NET

I’ve tried using SharpUSBLib and it screwed up my computer (needed a system restore). Happened to a coworker on the same project too. I’ve found an alternative in LibUSBDotNet: http://sourceforge.net/projects/libusbdotnet Havn’t used it much yet but seems good and recently updated (unlike Sharp). EDIT: As of mid-February 2017, LibUSBDotNet was updated about 2 weeks ago. … Read more

Android: Detecting USB

Some people suggested using UMS_CONNECTED which is deprecated as of recent version of Android The other problem with that is that it does not work with MTP enabled devices Others suggested the use of the BatteryManager, more precisely ACTION_BATTERY_CHANGED as well as BATTERY_PLUGGED_AC and BATTERY_PLUGGED_USB This is perfect if you want to detect the Battery … Read more

Safely remove a USB drive using the Win32 API?

You can use the CM_Request_Device_Eject() function as well as some other possibilities. Consult the following projects and articles: DevEject: Straightforward. http://www.withopf.com/tools/deveject/ A useful CodeProject article: http://www.codeproject.com/KB/system/RemoveDriveByLetter.aspx

Simple way to query connected USB devices info in Python?

I can think of a quick code like this. Since all USB ports can be accessed via /dev/bus/usb/< bus >/< device > For the ID generated, even if you unplug the device and reattach it [ could be some other port ]. It will be the same. import re import subprocess device_re = re.compile(“Bus\s+(?P<bus>\d+)\s+Device\s+(?P<device>\d+).+ID\s(?P<id>\w+:\w+)\s(?P<tag>.+)$”, re.I) … Read more

Android USB host and hidden devices

To enable USB host API support you should add a file named android.hardware.usb.host.xml and containing the following lines: <permissions> <feature name=”android.hardware.usb.host”/> </permissions> into folder /system/etc/permissions in that folder find file named handheld_core_hardware.xml or tablet_core_hardware.xml and add <feature name=”android.hardware.usb.host” /> into <permissions> section. Reboot your device. Usb host api should work. Tested on CUBE U30GT with … Read more

USB device access pop-up suppression?

When you request permission inside your app it seems that the checkbox “use by default for this USB device” does nothing (I am not sure why this checkbox even shows up on this popup. Instead you should register an intent handler for your activity in the manifest: <activity … … > <intent-filter> <action android:name=”android.hardware.usb.action.USB_DEVICE_ATTACHED” /> … Read more

Releasing a unplugged virtual Serial Port

Serial ports date from the stone age of computing. That’s where you plugged in your ASR-33 teletype to start typing in your Fortran program. The electrical interface is very simple. So is the Windows API to use a serial port from your own code. Practically any runtime environment supports them. USB has replaced serial port … Read more

python pygame.camera.init() NO vidcapture

I met the same problem. The error info of “ImportError: No module named vidcap” indicates that python interpreter didn’t find the vidcap module on you machine. so you’d better follow these steps. Download the vidcap from http://videocapture.sourceforge.net/ 2.Then copy the corresponding version of dll (which named “vidcap.pyd” in VideoCapture-0.9-5\VideoCapture-0.9-5\Python27\DLLs) to “your python path”\DLLs\ . 3.restart … Read more