How do I determine a USB memory stick's serial number in Cygwin?

30
2014-06
  • user2150989

    I already know that within windows, you can get a USB memory drive's Volume Serial Number by doing dir <drive_letter>:, where <drive_letter> is the drive letter of the USB drive. I also did some searching and found that Linux has a command called lsusb that will also give you the Volume Serial Number.

    Is there a corresponding command in Cygwin? I can't find lsusb in any of the setup files (libusb didn't have it).

    I have a script that runs and copies files to a particular USB memory stick every day. The problem is that I can't guarantee it will be the only USB memory stick plugged into my computer at any given time, and Windows assigns drive letters to USB memory sticks arbitrarily. Matching the volume serial number will allow me to be sure I am writing to the correct USB drive.

  • Answers
  • amphibole

    You might be able to use diskpart. This is included in most recent versions of MS Windows, to the best of my knowledge. I am using Windows 7 Starter Edition (so I have very little in the way of "expert technical tools" such as one assumes would be provided with a "server" or "professional" edition of Windows). Nonetheless, I have diskpart.

    Note that you may need to grapple with UAC (User Access Control) in order to run diskpart at all, even just to get information about disks or partitions (and I consider elaboration about UAC from perl to be beyond the scope of the question ;-). And note that diskpart is basically an interactive tool, and although the documentation describes using scripts to operate it, I have not yet tried that.


  • Related Question

    USB to Serial adapter/cable Windows/Mac/Linux
  • alexus

    I'm looking to get a USB to Serial cable for my Mac/Win/Linux preferably small in size and without unnecessary software installations. I've had one a while ago, it would only work with Windows. On my Mac I can just plug any USB printer or scanner and it'd just work without installing anything, so that's what I want in that USB to Serial. can someone suggest me one?


  • Related Answers
  • Troggy

    http://www.amazon.com/Keyspan-Speed-Serial-Adapter-USA-19HS/dp/B0000VYJRY/ref=sr_1_2?ie=UTF8&s=electronics&qid=1249590051&sr=1-2

    This is the best one out there when is comes to mac compatibility. It does require some software installation though.

    It states on the amazon site linux and windows compatibility.

    It is the best for os x because of the driver support and ease of use. Every GPS owner and os x I know has always come back to this adapter for serial support. I'm sure this translates for other uses as well. There are other options out there for os x, but this one has the best support and drivers. Plus, it supports all the major OS's.

  • The Tentacle

    For very high performance, low latency support FTDI usb-serial have been verified as solid on OS X. Just do a search to find numerous options. The performance measurements came from the developer of a scientific toolbox for matlab who verified sub-millisecond precision.

    Startec also make reliable usb-serial cables with OS X drivers:

    http://www.startech.com/item/ICUSB232PRO-USB-to-RS-232-Serial-DB9-Adapter-with-COM-Retention.aspx