473,748 Members | 6,412 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scanning USB devices and reading USB descriptors

Hi,

I'm wondering how I can scan the system for USB devices and read off
the USB descriptors such as VID/PID/serial number in C? I have an
external USB HDD that I wish to access, and I'm currently able to do
so with DeviceIoControl by addressing it as PhysicalDriveX, which will
return me information about the device, except it only does it for the
attached fixed disk, rather than the USB device.

Thanks!

May 10 '07 #1
5 10570
galapogos wrote:
Hi,
Hi,
>
I'm wondering how I can scan the system for USB devices and read off
the USB descriptors such as VID/PID/serial number in C? I have an
external USB HDD that I wish to access, and I'm currently able to do
so with DeviceIoControl by addressing it as PhysicalDriveX, which will
return me information about the device, except it only does it for the
attached fixed disk, rather than the USB device.
While this is not possible in plain standard C, there are certainly a
few libraries that you can use to access USB devices.
One of those is libusb [1], which is available on quite a few Unix-like
operating system.

[1] http://libusb.sourceforge.net/
>
Thanks!

--
Pietro Cerutti

PGP Public Key ID:
http://gahr.ch/pgp
May 10 '07 #2
On May 10, 5:55 pm, Pietro Cerutti <g...@gahr.chwr ote:
galapogos wrote:
Hi,

Hi,
I'm wondering how I can scan the system for USB devices and read off
the USB descriptors such as VID/PID/serial number in C? I have an
external USB HDD that I wish to access, and I'm currently able to do
so with DeviceIoControl by addressing it as PhysicalDriveX, which will
return me information about the device, except it only does it for the
attached fixed disk, rather than the USB device.

While this is not possible in plain standard C, there are certainly a
few libraries that you can use to access USB devices.
One of those is libusb [1], which is available on quite a few Unix-like
operating system.

[1]http://libusb.sourcefo rge.net/
Thanks!

--
Pietro Cerutti

PGP Public Key ID:http://gahr.ch/pgp
Thanks. I actually have libusb-win32. I wasn't aware the source code
was included. I'll check it out.

I also checked out MSDN, specifically the "USB Structures and
Enumerations", and several of the functions all depend on usbdlib.h,
but despite copying the file over to my project from libusb I can't
seem to use the functions. How exactly do I use the libusb source
files?

May 10 '07 #3
galapogos wrote:
On May 10, 5:55 pm, Pietro Cerutti <g...@gahr.chwr ote:
>galapogos wrote:
>>Hi,
Hi,
>>I'm wondering how I can scan the system for USB devices and read off
the USB descriptors such as VID/PID/serial number in C? I have an
external USB HDD that I wish to access, and I'm currently able to do
so with DeviceIoControl by addressing it as PhysicalDriveX, which will
return me information about the device, except it only does it for the
attached fixed disk, rather than the USB device.
While this is not possible in plain standard C, there are certainly a
few libraries that you can use to access USB devices.
One of those is libusb [1], which is available on quite a few Unix-like
operating system.

[1]http://libusb.sourcefo rge.net/
>>Thanks!
--
Pietro Cerutti

PGP Public Key ID:http://gahr.ch/pgp

Thanks. I actually have libusb-win32. I wasn't aware the source code
was included. I'll check it out.

I also checked out MSDN, specifically the "USB Structures and
Enumerations", and several of the functions all depend on usbdlib.h,
but despite copying the file over to my project from libusb I can't
seem to use the functions. How exactly do I use the libusb source
files?
No clue. You better ask to a more specific newsgroup, since your issue
isn't related to the C programming language, but rather to the way you
access some third-party library function.

Please check the libusb website, they surely have documentation on their
product.
--
Pietro Cerutti

PGP Public Key ID:
http://gahr.ch/pgp
May 10 '07 #4
galapogos wrote:
>
I'm wondering how I can scan the system for USB devices and read
off the USB descriptors such as VID/PID/serial number in C? I
have an external USB HDD that I wish to access, and I'm currently
able to do so with DeviceIoControl by addressing it as
PhysicalDriveX, which will return me information about the device,
except it only does it for the attached fixed disk, rather than
the USB device.
I see no reference to USB in the C standard. So this is off-topic
in c.l.c. Follow-ups set.

--
<http://www.cs.auckland .ac.nz/~pgut001/pubs/vista_cost.txt>
<http://www.securityfoc us.com/columnists/423>
<http://www.aaxnet.com/editor/edit043.html>
<http://kadaitcha.cx/vista/dogsbreakfast/index.html>
cbfalconer at maineline dot net

--
Posted via a free Usenet account from http://www.teranews.com

May 11 '07 #5
In article <46************ **@yahoo.com>,
CBFalconer <cb********@mai neline.netwrote :
>galapogos wrote:
>>
I'm wondering how I can scan the system for USB devices and read
off the USB descriptors such as VID/PID/serial number in C? I
have an external USB HDD that I wish to access, and I'm currently
able to do so with DeviceIoControl by addressing it as
PhysicalDriveX , which will return me information about the device,
except it only does it for the attached fixed disk, rather than
the USB device.

I see no reference to USB in the C standard. So this is off-topic
in c.l.c. Follow-ups set.
IOW, ...

(You know the drill)

May 11 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
12210
by: CHANGE username to westes | last post by:
What are the most popular, and well supported, libraries of drivers for bar code scanners that include a Visual Basic and C/C++ API? My requirements are: - Must allow an application to be written to a single interface, but support many different manufacturers' barcode scanning devices. I do not want to be tied to one manufacturers' software interfaces. - Must support use of the scanner from Visual Basic, and ideally from C/C++ and...
2
1907
by: Denis S. Otkidach | last post by:
I've noticed that the order of attribute lookup is inconsistent when descriptor is used. property instance takes precedence of instance attributes: >>> class A(object): .... def _get_attr(self): .... return self._attr .... attr = property(_get_attr) .... >>> a=A()
2
1808
by: François Pinard | last post by:
This question is a bit technical, but hopefully, this list will offer me good hints or nice solutions. Happily enough for me, it often does! :-) I would need to recognise and play with descriptor types, like: member descriptors method descriptors getset descriptors wrapper descriptors
14
1641
by: Antoon Pardon | last post by:
Can anyone explain why descriptors only work when they are an attribute to an object or class. I think a lot of interesting things one can do with descriptors would be just as interesting if the object stood on itself instead of being an attribute to an other object. So what are the reasons for limiting this feature in such a way? -- Antoon Pardon
42
4688
by: Jim Smith | last post by:
Note the cross-posting - but no flame wars please. This question was prompted by a thread on the a postgres mailing list during which someone (Gregory Williamson) claimed <quote> raw devices, at least on Solaris, are about 10 times as fast as cooked file systems for Informix. <quote>
3
2209
by: Ron | last post by:
I need a way to read the hex values of an old DBase3 data file. Can anyone give me some info regarding how to grab hex values out of a file? Not sure exactly how to do this. Thanks for your help.
1
3237
by: Bruce D | last post by:
I'm researching a VB .NET project that will have two functions: 1 - scan images using TWAIN drivers of scanner 2 - read barcode of that scanned image I've been researching many companies and was wondering if anyone had any recommendations of any options about the companies I've listed here. Your input is appreciated! The thing here is that I like Dosadi:EZTwain...but they don't offer barcode recognition. It seems these are the only...
10
3753
by: Samuel Shulman | last post by:
I assume that when I use a barcode reader (at least some of them) it will input the number as though it was entered in via the keyboard How can I then get the value without setting to focus to a textbox control I don't want the user to see the scanned number but I still need a way to read the value, in addition, I need an event that will be fired once the barcode was read in full so I know it actually finished reading Thank you, Samuel
1
1604
by: Fine | last post by:
When any person enters any shop and buy some items then goes to where he pays the prices of his items, the person there make scanning to each item to know what's the price? I am asking how this is done? what's program Language used to create this program scanning ? and what's the name of this thing that I can read to know this secret? From Beginner. ===========================
0
8991
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9325
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9249
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6796
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.