DLL for listing devices and getting device parameters. DLL to talk to the hardware devices. I'll admit, the technique is a bit convoluted, so let's break it down into steps:. However, they are in the downloadable sample code see the link at the bottom of the article. This top-level routine follows the steps outlined above. The FindDiskDevice function searches the device tree for DeviceNumber that matches that of the drive letter.
And lastly, the GetStringDescriptor function returns the actual serial number string. Every "Storage Device" is assigned a unique number based upon its device type. DeviceType , we "fold" the two numbers together. Next, we need to find the full "symbolic name" of the USB Hub where are disk is located an average PC might have internal USB hubs , and we also need the "Instance ID" of the device itself sorta like a device driver name.
Next, we search the entire "device tree" for a device that matches that device number. Active Oldest Votes. Improve this answer.
Tormod Volden Tormod Volden 5 5 silver badges 4 4 bronze badges. Thanks for thinking of the byte limit; you just saved me a lot of work. This answer was very helpful — OOPMan. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. I simply replaced the index with 'iSerialNumber' without quotes. Like this: usb. Add a comment. Active Oldest Votes. For the present PyUSB version 1.
Improve this answer. Sun Bear Sun Bear 5, 6 6 gold badges 39 39 silver badges 84 84 bronze badges. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Endpoint descriptors are used to describe endpoints other than endpoint zero. Endpoint zero is always assumed to be a control endpoint and is configured before any descriptors are even requested. The host will use the information returned from these descriptors to determine the bandwidth requirements of the bus.
Bits If Isochronous endpoint, Bits Value in frame counts. Isochronous must equal 1 and field may range from 1 to for interrupt endpoints. If an Isochronous endpoint is specified, additional attributes can be selected such as the Synchronisation and usage types.
String descriptors provide human readable information and are optional. If they are not used, any string index fields of descriptors must be set to zero indicating there is no string descriptor available.
The strings are encoded in the Unicode format and products can be made to support multiple languages. String Index 0 should return a list of supported languages. The host should read this descriptor to determine what languages are available. If a language is supported, it can then be referenced by sending the language ID in the wIndex field of a Get Descriptor String request. Configuration Descriptors A USB device can have several different configurations although the majority of devices are simple and only have one.
Interface Descriptors The interface descriptor could be seen as a header or grouping of the endpoints into a functional group performing a single feature of the device. Endpoint Descriptors Endpoint descriptors are used to describe endpoints other than endpoint zero.
String Descriptors String descriptors provide human readable information and are optional. Chapter 6 : USB Requests. Copyright Craig. Peacock beyondlogic. Size of the Descriptor in Bytes 18 bytes. USB Specification Number which device complies too. Maximum Packet Size for Zero Endpoint. Valid Sizes are 8, 16, 32, Value to use as an argument to select this configuration.
Index of String Descriptor describing this configuration.
0コメント