Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7978281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T09:27:01+00:00 2026-06-04T09:27:01+00:00

My app will be running from a USB key which have specific information like

  • 0

My app will be running from a USB key which have specific information like vendor-id, device-id, … which I need.

I tried using libusb, but despite the fact that I still can’t make it work properly, how could I find the right usb drive to get information from?

Note that I would like the code to be cross-platform, that’s why I firstly choose libusb.

Edit :

I have found a program (usbviewer) that enumerates all usb ports and the specific informations on the drive when it’s connected.

I have read the sources for linux, infos are directly extracted from /proc/bus/usb/devices, it’s quite straightforward.

But on windows, to get usb node connection information, it takes about 1000 lines before you get the actual information in a data structure (enumerate hub controllers, root hubs, ports…).

libusb on the otherside force me to generate an INF file and install a driver via inf-wizard.exe for each device before I can reach the information (didn’t try on linux though).

Edit 2 :

I have found a way to get the device serial number with Windows, Linux and Mac OS X (didn’t try MAC OS X but it should work just as Linux). For Windows, I use the function GetVolumeInformation(), on Linux, to read the serial number of drives with a FAT filesystem, I read 4 bytes in the corresponding /dev/* file starting from 0x27 or 0x43 depending on the FAT version.

But this reading requieres a root access which the program won’t have, and it seems to me a little bit unreliable.

Any ideas ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T09:27:02+00:00Added an answer on June 4, 2026 at 9:27 am

    I have found the solution that fits me, for thoses who are insterested.

    For Windows :

    I extract the serial number of the device from the registry knowing the drive letter : HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices\DosDevices\X:

    For Unix :

    I get the /dev file with the df command, then I read the link in /sys/block corresponding to the /dev file (e.g : The drive is /dev/sdb, I read link of /sys/block/sdb. Then I read the file serial which is located in the directory pointed by the link, 6x directory backwards.

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have to create an app that will read in some info from a
HI, I am creating an App in which countdown will be running. I want
I have an app written in ruby on rails which is running fine on
When running a CherryPy app it will send server name tag something like CherryPy/version.
My app will allow users to create a personalised list of events from a
We have a folder where our app will be potentially reading, writing and creating/deleting
I have client/server application where the client app will open files. Those files get
I have video in my project. I play it with MPMoviePlayerController but app will
I have an android device with support of USB host functionality. I have to
I have been receiving reports from customers in the field that my app is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.