Click here to Skip to main content
15,892,161 members
Everything / USB

USB

USB

Great Reads

by Praveen Kullu
Preventing viruses in a USB drive in Windows
by Mike Meinz
PartnerTech provides a 32-bit DLL and a 64-bit DLL for communicating with the CD-7220 Series Customer Display in true USB mode. This tip demonstrates a .NET class that can be used to provide an easy way to access the PartnerTech-provided 32-bit DLL.
by thatraja
Found these linksTroubleshooting: USB Device Not Recognized[^]From Link1[^]:Cause #1: Outdated Device DriverCause #2: USB Device shares the same drive letter as another device already plugged inCause #3: All USB devices suddenly stop workingCause #4: Damaged USB PortCause #5:...

Latest Articles

by ToughDev
Custom USB device that processes input from peripherals and displays on computer
by ToughDev
How to interface NEO-6M GPS module to PIC
by ToughDev
How to integrate FatFs FAT filesystem module with CH375/CH376 USB controller
by Marco Bertschi
Serial communication with an Arduino Board via C# and the SerialPort class from the System.IO.Ports namespace

All Articles

Sort by Title

USB 

22 May 2013 by NeoGetz0
Most of the 3G modem (USB sticks) are support voice call, but all of them can do this only through the dashboard software which is shipped with them.Do you have any information, how to get the voice from and pass the mic data to the 3G modem?When I plug it, it installs 4 COM ports: ...
12 Jan 2014 by Ravuri Vasu
Hi,I am also working on same kind of implementation and I understand that when we initiate a call through NEMA port through AT command, it will call the destination number. The other port (Application Interface/Speech port) will start sending binary data once the call is answered by other...
30 Aug 2013 by Member 4347041
How to get the serial number, model,... of the usb key connected on to pc?Something like this: ManagementObjectSearcher USB = new ManagementObjectSearcher("SELECT * FROM Win32_DiskDrive"); ManagementObjectCollection USBinfo = USB.Get(); string info = ""; ...
30 Aug 2013 by Sergey Alexandrovich Kryukov
Please see: http://msdn.microsoft.com/en-us/library/windows/hardware/hh998535.aspx[^].—SA
30 Aug 2013 by V.Lorz
Try querying for the WMI class Win32_LogicalDisk, it has one property called VolumeSerialNumber. Other properties like DriveType and MediaType will help you identifying the type or drive. With the property PNPDeviceID it could be possible to track it down to the physical USB device...
5 Dec 2012 by cschenlu
hello,I'm a windows programmer. I've recently met a problem on usb driver, sincerely hope I could get your reply. My usb driver doesn't work well with usb device. It's a webcam device. when I start this webcam, it always display white no matter what we show before it. I use bus hound to...
13 Dec 2010 by DisneyCHZ
I wrote a virtual USB bus driver in Windows, after it enumerate the USBSTOR driver, in the usb bulk or interrupt transfer phase, the USBSTOR driver will send some IRPs with MDL pointer. It means that using direct I/O method (but strangely, the "Method" in the IRP is "Neither"). When I use the...
16 Dec 2010 by DisneyCHZ
I know the reason now. Before getting the virtual address here, I did a wrong thing. I lower the IRQL, this is a fatal error.
4 Apr 2013 by NannoJohannes
a usb driver for an ocean optics usb2000+ driver is already installed and used by the SpectraSuite program. How can I use this driver in my own application programmes like VB,C#, Matlab, ... ?When using Matlab or NI software to build a driver I get confusing messages about path settings and...
11 Jan 2012 by Er. Tushar Srivastava
Hello Friends,I am an electronics engineering student and currently I don't know about interfacing but I am required to interface one of my device to pc using USB since my lappy doesn't has any serial port. kindly help me by providing some very simple method to access USB port in visual C++ in...
11 Jan 2012 by CPallini
Usually the device manufacturer provides an API for interfacing the device with the PC (read the documentation). Very often (for low speed devices) they provide a serial port emulator, that is you communicate with the device using standard RS232 communication (again, check out your device...
11 Jan 2012 by Jochen Arndt
To access USB devices you must talk with the device specific USB driver using a library provided by the device manufacturer (or the manufacturer of the used USB interface chip). Whithout knowledge about the used device, nobody may help you here.Console applications can call Windows API...
12 Apr 2012 by stark9000
http://www.wai...
30 Apr 2013 by Member 10020016
Hello,I'm working about a solution to communicate between an usb device ( a Zigbee dongle recognize as ttyACM0 ) and the android emulator.I know with the SDK version of the emulator it is impossible, so I explored different solutions.The first one is to add the usb driver in the goldfish...
7 Oct 2021 by User 9916080
This maybe what you are looking for. From Google: Epson TM-T88III Drivers[^]
10 Mar 2016 by Marco Bertschi
Serial communication with an Arduino Board via C# and the SerialPort class from the System.IO.Ports namespace
30 Jan 2012 by Auric Consulting, LLC
In the code below, there is a BeginRead call which I want to use in an async manner. (warning, code is cobbled together using a variety of code samples found lying around on the internet!) With this sample, I expect the BeginRead to return immediately, and then the callback to be hit later on...
30 Jan 2012 by Herman<T>.Instance
static public void BeginAsyncReadshould bestatic public IAsyncResult BeginAsyncRead
20 Oct 2011 by 01.mandar
i have 2 Bluetooth1. PC dongle and 2. Mobile Bluetooth Device of same make in normal installation we goto Control Panel and do add device ,this device directly gets added in the system and pair with each other without using any key.i want to automate this by getting event from the OS...
20 Oct 2011 by Richard MacCutchan
You need to implement Plug & Play[^] for automatic installation.
3 Mar 2019 by Peter____
Hello, I have a problem with an Usb Ioctl over Jna on Linux Mint 19. On Android Platform the Ioctl can be submitted, but on Linux I get a bad address error. The programcode is shown below. There are more ioctls called on the usb device. The first 2 works without an error msg: rc =...
17 Oct 2018 by KarstenK
You have created a PointerByReference without any pointer. Use the other constructor with a pointer to a valid memory area.
3 Mar 2019 by Peter____
Solution: The code I posted was mainly for 32 bit platform: An int has different sizes on c#, java and other languages. To rewrite all the original IOCTL functions of the kernel in Java (JNA interface class used) and setted the structure sizes of the urb class new (with JNA Structure class...
21 Apr 2015 by Member 7964422
Hello. I have a MS Visual C# (2013) WPF program that I'm trying to read data being received on a USB port. I have code that will recognize the USB Device (A ADB-S Usb Dongle) as VID: 0BDAPID: 2838Friendly Name: RTL2838UHIDIRDevice Class: UsbDeviceDevice Location: ...
22 Apr 2015 by User 59241
You have a gadget using Realtek RTL2832U device (ezcap USB 2.0 DVB-T/DAB/FM dongle) http://www.realtek.com.tw/products/productsView.aspx?Langid=1&PFid=35&Level=4&Conn=3&ProdID=257[^]This should get you going:http://sdr.osmocom.org/trac/wiki/rtl-sdr[^]and...
20 Dec 2014 by Member 11175072
I want to run a application when a USB device plug into the computer,I think it should be implemented by Windows Service,Can you give me some tips or examples about it.I am a beginner for service.Thanks
20 Dec 2014 by BillWoodruff
CodeProject is your friend: [^]"This article describes my C# class called DriveDetector which will allow your program to receive a notification when a removable drive (such as a flash drive) is inserted or removed. It also supports notifications about pending removal of such a device and...
7 Jul 2012 by Ranabasu
Hello every1....... I'm using USB CDC class for the comunication between my lpc1769 device and the host. A C# form application is developed to handle host communication. So usb port / connection enumerate as a com port on host side. First I need to confidure my device. It's a data logger....
12 Oct 2015 by Member 12044616
what is the simplest way to auto detect USB insertion and removal i know there are projects here that show it but either are outdated or not what im after which is just for the application to auto detect USB insertion and removal and display a message box saying which has occurredi honestly...
12 Oct 2015 by Abhinav S
TryA USB Library to Detect USB Devices[^]Detecting USB Insertion/Removal in C# .Net 4.0[^]
4 Oct 2015 by Shahzad Mirza
I want to change permission level of the removable drive(USB) to be readonly for everyone and full control to the current user of the windows. There are many tutorials available on internet for changing of file, folder, directory,permission level. But i could not find any source to change a...
4 Oct 2015 by Shahzad Mirza
I just solve my question just using this Link and including this namespace System.Security.Principal.I just used below code to change permissions on the root folder (e.g. "G:\")DirectorySecurity sec = Directory.GetAccessControl(path);// Using this instead of the "Everyone" string...
28 Oct 2013 by Member 10365929
Looking for a way to read and extract data from printer spooler - basic text.Printer is connected via parallel or usb or serial.Please help!
18 Jun 2012 by charlesmister
Hi everyone,I'm a beginner at c# and i really need to know how to capture video and audio from a capturing HW plugged by USB. I'm using Grabster AV300 and it works fine in the provided software. Now i want to adquire the signal and display it im my winform. I've tried some articles mentioned...
4 Sep 2012 by charlesmister
Found it! The solution was rendering the audio also because i was only rendering the video. (just in case if someone is facing the same issue).
6 Jun 2012 by idle63
Hello allIs it possible to check programmatically whether usbser.sys does still poll a specific COM port where a USB device using CDC (Communication Device Class) is connected? If yes any idea how to do that?By the way the question is to make some test code to verify whether there is a...
6 Jun 2012 by Dave Kreskowiak
Not that I know of, no. I don't know of an interface exposed by it that will let you query that information.
22 Nov 2010 by Richard Stellingwerff
Hi there, this is my first time asking a question on The Code Project, so please bare with me.I've written an application that reads input from a USB HID device. It's a programmable keyboard with 35 keys, a Controlpad 682 for those that are interested. This device sends normal keycodes....
22 Nov 2010 by E.F. Nijboer
Maybe these examples/articles can help you further with this:http://www.codeproject.com/KB/system/DevMgr.aspx[^]http://www.codeproject.com/KB/cs/HardwareHelper.aspx[^]Good luck!
5 Jul 2014 by mhelinx09
Hello,I hope someone can help.I been struggling for days on this function, and it is quite hard to get an answer from the internet.I am trying to get the location information of the child usb device, using CM_Get_DevNode_Property.It works perfectly ok on Windows 7 x64, but fails...
5 Jul 2014 by George Jonsson
Maybe you can try what Microsoft recommends.Remarks"This function is reserved for system use. Do not use this function in your class installers, co-installers, or device installation applications. Use SetupDiGetDeviceProperty instead."Perhaps you have already tried this path.
28 Nov 2013 by Luiey Ichigo
Hi all,Right now I'm programming a device to interact with my program VB.Net 2008. Btw, the driver is provided and installed. Using the provided .dll, I cannot add a references in VB and also register the .dll in system32 which return error "not a valid assembly or COM component". Why? Any...
28 Nov 2011 by Member 8002808
Hello everyoneI am trying to communicate with a device by using windows messaging and through a USB port. I will be writing the code in C# and WPF. The device has a an interface board that uses a Cypress USB driver chip (CY7C6###). I have installed their generic drives and change the PID...
12 Dec 2011 by Viktor Signaievskyi
Hi,Could you tell us the aim you want to connect Cypress to PC? Is this something like storage device or the kind of ADC? I mean do you have some requirements or requests to the target device?As I know CY7C6### is a microprocessor, so you need to write the software, compile and flash the...
20 Oct 2010 by cs101000
I am working on a windows forms application project. I have a serious problem in communicating with my avr microcontroller: at90usb1287. I have designed a form using vc# And according to the input from the user, am going to send data to eeprom of the avr micro. I want to send data into its...
19 Oct 2010 by Johnny J.
I very much doubt that anybody here has the knowledge to help you with that. Much better to contact the hardware manufacturers and get the information from them
19 Oct 2010 by LloydA111
Could you not simply use the programmer software to modify the EEPROM? Or do you specifically need to be able to modify it using the application your making in VS?If you do need to do it with your VS project, then there are two choices that I can think of. Either write some code for the AVR...
19 Oct 2010 by JF2015
Hi,to communicate with the AVR, you will need the AtUsbHid.dll provided by Atmel. You should contact them or try to get the dll from their website. I'm pretty sure they also have some examples (at least for basic stuff as connecting to the controller)
9 Oct 2015 by Member 11986451
I want to create a portable apps that runs in flash drives that will have the capability to lock the flash drive and restrict access to it. As the user tries to open the flash drive, it will prompt for a password. how can i communicate with the flash drive progammatically and preferrably i...
9 Oct 2015 by Patrice T
The answer is NO you can't.Usual flash drives are passive devices. This imply that you can't enforce an execute as you plug it, and you can't restrict access.the only hope is to store only encrypted files on the drive.Otherwise, you must use an active device. That means that the drive...
6 Jun 2012 by Clionadh Martin
Hi guys!!I'm trying to develop a program that communicates with a USB device. I've just started playing around with some functions and I need some help.I wrote the code bellow and when I compile it, I have no errors but when i run it i get the following errors:1>Rev 4.obj : error...
6 Jun 2012 by «_Superman_»
See if these help -http://bytes.com/topic/net/answers/511307-where-rtc-libraries[^]http://social.msdn.microsoft.com/Forums/is/vcgeneral/thread/a8bae441-ea35-4b68-bb4a-ea9b0e497449[^]http://forums.codeguru.com/showthread.php?t=346998[^]
6 Jun 2012 by Clionadh Martin
I tried a few of those already, any other ideas?
7 Jun 2012 by SoMad
Check this old thread on CodeGuru: http://forums.codeguru.com/showthread.php?t=346998[^]The problem was solved by using these settings:Project Explorer > Settings > Linker > Input >- Additional dependencies: libcp.lib- Ignore All default libraries : no- ignore specific library :...
8 Jun 2012 by Clionadh Martin
Ok, thanks to superman and sorren for your quick answers. I had already tried them but I finally figured out my problem :).Anyway, the problem above resulted from another problem I had.I had to download SDK 7.1 and then i had to change the platform toolset (configuration properties ->...
11 Oct 2020 by Anh Chu
Hi guys,I have a system connect to PC through USB. I am writing the software that has "Connect" button which allows user to connect to that specific USB port. My solution is 1. Scan all available COM ports 2. Send a specific message to each COM port and if the system echo back another...
27 Aug 2010 by DavidKiryazi
Hi,Are you talking about USB or COM port emulator? It sounds like you are talking about a USB that connets as a COM port emulator.If that is the case, you can use the following method to get the list of names of com port devices.SerialPort.GetPortNames();you can then iterate...
28 Aug 2010 by Anh Chu
Yes, I am talking about a USB that connects as a COM port. And yes, I do a SerialPort.GetPortNames() to get the COMx name, and connect to that specific USB. But I am facing the problem, let's say the PC I connect the USB has the following COM (in device manager):1. COM1: Communication...
29 Aug 2010 by Anh Chu
Hi,Actuall...
1 Jan 2011 by Member 139650
Hi,Since more newer PC´s have no Parallel Port and Serial Port anymore, i need to rewrite a 10 year old MS Visual-C++ program for USB access.First problem: Visual C++ 6.0 doesn´t support serial ports greater than 5.On all laptops we cannot use serial ports 3 to 10 ( already occupied...
31 Dec 2010 by #realJSOP
You can get USB parallel and serial port adapters (hardware). They're typically less than $10. There shouldn't be any reason to change your obsolete code.
1 Jan 2011 by #realJSOP
You can't possibly expect 10-year-old code to remain relevant. Technology marches on, and that in turn makes software obsolete. My advice is to rewrite your code.
1 Jul 2019 by HARDIK Joshi
I am Transfer one directory from system to pendrive (Regular 2.0 USB Device) with the help of Microsoft.VisualBasic.FileIO.FileSystem.CopyDirectory class but it is taking too much time for transfer directory. Size of directory is 12GB or some time more then 12GB. 12GB directory taking time...
1 Jul 2019 by OriginalGriff
There is no "fast copy" method that will guarantee to make a significant improvement in transfer speed, you are almost certainly limited by three factors: 1) USB transfer speed - this will depend on the version of USB for both the port on the computer and the version of USB in the pendrive - the...
24 Oct 2016 by abbabbabba
Hi all! I've got one client machine that fails when using my application attempting to copy thousands of files from an USB stick. An error message is thrown after a few files are copied, and a lot of folders are created on the hard drive. The error message says that the USB stick is write...
25 Oct 2016 by abbabbabba
The cause of the problem lies in the code:There is an array containing thousands of files that should be copied.Depending on earlier settings, possibly made months ago, some files should not be copied.When the code skips copying a file that should not be copied, it should also skip...
29 Sep 2015 by Shahzad Mirza
I want to create program to lock USB with a password and everything in it is hidden and scrambled unless a user entered a right password to unlock it. I have searched a lot but I just found this software USB Locker. Can anyone guide me how this gonna programmed. Is it written using WMI or some...
29 Sep 2015 by Leo Chapiro
Take a look at this CodeProject: Developing a USB Storage Device Protection Tool with C#, it seems to be a good starting point.To disable USB storage devices it uses a registry key "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\usbstor":void USB_disableAllStorageDevices(){ ...
29 Sep 2015 by Dave Kreskowiak
One problem you're going to run into is that any C# app requires the .NET Framework to be installed on the machine before you can run the app. If the framework is not installed your code doesn't run.The only way you're going to "protect" the contents of the drive with a password is if all...
13 May 2023 by ToughDev
Custom USB device that processes input from peripherals and displays on computer
8 Dec 2014 by Charles Fernando
Hi,I m trying to build an application which can send text messages to the contacts of a connected Android phone. So as the first step I need to check whether an android device is connected via a USB port and the phone should be an Android phone. And I m using C# for this application.So guys...
28 Sep 2015 by Member 11840132
Hello. I have tried alot of codes to detect USB insert, every thing I found did not detect a portable device connection.I dont need to get information from the device, only to know if somthing has been connected.any of the following languages will do:C#, java, python.any idea's?...
28 Sep 2015 by Maciej Los
Google is your Friend! Here is a set of links:http://www.developerfusion.com/article/4392/deviceiocontrol-usb-using-managed-c-c/5/[^]https://channel9.msdn.com/coding4fun/articles/Is-that-you-Writing-Better-Software-for-Cool-USB-Hardware[^]http://www.beyondlogic.org/usbnutshell/usb5.shtml[^]
13 Apr 2011 by puneetdhawan2000
Hi,I am trying to detect a fixed voltage(etc 5 Volt) on a wire, initially I used parallel port and it was working fine.Can anyone help me to detect the same on USB port ?I am using C# for the project..Thanks,Puneet.
13 Apr 2011 by E.F. Nijboer
You can use Windows Management Instrumentation for that.Have a look at these articles:How To Get Hardware Information (CPU ID, MainBoard Info, Hard Disk Serial, System Information , ...)[^]Windows Management Instrumentation (WMI) Implementation[^]Good luck!
15 Sep 2015 by Patrice T
Honestly, the answer is your project will fail.The project require some rather extended skills but asking which language show a total lack of the very same skills.You also need to master encryption in order to do what you want.
19 Feb 2013 by Member 9848511
Hi,I want to disable a USB device completely. I DO NOT want to disable the port but I should be able to disable a particular model , when connected to my system. In my case, I am trying to disable LOGITECH C920 cameras. I tried using devcon to achieve this, but I was only able to disable the...
21 Mar 2016 by Saiprasad V
Hi, Is there a way to disable all USB ports, so that it does not recognize any removable storage or any other device(USB mouse, USB keyboard etc). Thank you.What I have tried:I have tried the below methods1. Make changes to USBSTOR registry value2. Enable the group policy...
21 Mar 2016 by CHill60
Quote:Use Device Manager to disable and re-enable all the USB controllershttps://support.microsoft.com/en-gb/kb/817900[^]
21 Mar 2016 by Manoj Kumar Choubey
for disable USB you need to change registry values programmatically. following is the code For disable USB Microsoft.Win32.Registry.SetValue(@"HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", 4, Microsoft.Win32.RegistryValueKind.DWord); For enable...
21 Mar 2016 by Jochen Arndt
You can use the Windows Device Console (Devcon.exe) - Windows 10 hardware dev[^] utility (source code available).There are examples to disable USB devices: Device Console (DevCon.exe) Examples - Windows 10 hardware dev[^]. When disabling the internal USB root hubs, no devices can be connected.
8 Dec 2011 by Member 8456258
Hello AllCould some one describe or direct me to an article which describes how to implement interfacing with a hardware device that come with a DLL. I have a USB Device that came with a DLL. I have the list of the functions. What I need is to implement the function pointers and HINSTANCE into...
11 May 2012 by Sergey Alexandrovich Kryukov
It looks like this is not a .NET assembly but a native (unmanaged) DLL. There are no "steps" to help you.You need to have profiles of all functions and learn P/Invoke. Start from here:http://en.wikipedia.org/wiki/P/Invoke[^],http://msdn.microsoft.com/en-us/library/Aa712982[^].Read...
9 Dec 2011 by Member 8456258
Thanks for your respond SAKryukov. The DLL is not a .NET assembly. I am using DllImport for function pointers. At this time below is all I got. However I still need to add a C# equivlent of HINSTANCE and loadlibrary (in C++ it is :HINSTANCE hDll = LoadLibrary("HINSTANCE hDll =...
6 Aug 2014 by Don.Coleone
This is the link to the software:USB Flash Block/UnblockIt will be very helpful for you to tell me anything related to this topic! For now, even a little bit idea has rejected me. Could be tough...At least for me, maybe not for U! So please tell me anything(Doesn't need to be an integrate...
21 Oct 2019 by TabZhang
Hi All Library Class: A USB Library to Detect USB Devices[^] How can I get only one Event Notification when USB Arrived or Removed when using the class above! Any help will be greatly appreciated! Thanks! What I have tried: USBClass usb = new USBClass(); USBDevicePropertiesList = new...
21 Oct 2019 by Richard MacCutchan
Please post your question in the forum at the end of the article so the author may help you.
21 Oct 2019 by Andy Lanng
Pretty sure that because you get two alerts, and I get 4, the code scans all usb ports when an item is connected or disconnected.
18 May 2020 by Moonwalker031
I am writing a Python prog on Raspberry Pi that has a function to write some data to a USB drive. I need to Unmount/Eject it when ready so that the user can take it out. Is there a way to do it through the python prog please? What I have...
18 May 2020 by Richard MacCutchan
See Eject/dismount a USB with code on a Pi - Raspberry Pi Forums[^]
4 Mar 2015 by nadim_bh
* implementation of a generic USB protocol for interfacing product:how can i create a driver?Is there to tricks or doc that will help me in this?Device Details: -TWR-k60f120M, ARM cortex-m4-eclipse kepler C/C++-GNU Tools ARM Embedded -OpenOCD-Real time OS:...
4 Mar 2015 by Richard MacCutchan
This question is far too broad for a Quick Answers forum, and it is impossible to provide much useful information. You need to do some research into USB protocol, embedded systems and drivers. You will also need to study the hardware of the device(s) you intend to support.
14 Apr 2013 by mehdi_k
Hello,I've been trying to send a command from my c++ program to epos2 70/10 through RS232 (not using the DLL provided), but I only receive two 79 witch is 'O' meaning ok, but after that I receive nothing, and the the motor doesn't work(not spining). What's wrong? please help.Here is my...
14 Apr 2013 by Malli_S
It seems that your program exits after reading bytes from the device. Should epos2 70/10 continue to run even after your program exits? I mean what does command you're sending tell epos2 70/10, To 'spin regardless app is running' or 'spin till app is running'?If it does mean something like...
30 Jun 2015 by Member 11803645
I'm getting the same problem. Have you solved it?
18 Mar 2011 by Khan Tanveer Alam
Dear Brothers and SistersI have a USB Finger Print Device (UDR-200B), I am trying to develop an application by using VB.Net and SQL server to record finger print of a user and verified user based on stored finger print in database.I stuck with it since last few weeks, is there any one...