mirror of
https://github.com/ipxe/ipxe
synced 2026-01-21 18:30:56 +03:00
[usb] Expose USB device descriptor and strings via settings
Allow scripts to read basic information from USB device descriptors
via the settings mechanism. For example:
echo USB vendor ID: ${usb/${busloc}.8.2}
echo USB device ID: ${usb/${busloc}.10.2}
echo USB manufacturer name: ${usb/${busloc}.14.0}
The general syntax is
usb/<bus:dev>.<offset>.<length>
where bus:dev is the USB bus:device address (as obtained via the
"usbscan" command, or from e.g. ${net0/busloc} for a USB network
device), and <offset> and <length> select the required portion of the
USB device descriptor.
Following the usage of SMBIOS settings tags, a <length> of zero may be
used to indicate that the byte at <offset> contains a USB string
descriptor index, and an <offset> of zero may be used to indicate that
the <length> contains a literal USB string descriptor index.
Since the byte at offset zero can never contain a string index, and a
literal string index can never be zero, the combination of both
<length> and <offset> being zero may be used to indicate that the
entire device descriptor is to be read as a raw hex dump.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -22,6 +22,7 @@
|
||||
FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
|
||||
#include <config/usb.h>
|
||||
#include <config/settings.h>
|
||||
|
||||
/** @file
|
||||
*
|
||||
@@ -63,3 +64,10 @@ REQUIRE_OBJECT ( usbblk );
|
||||
#ifdef USB_EFI
|
||||
REQUIRE_OBJECT ( efi_usb );
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Drag in USB settings mechanism
|
||||
*/
|
||||
#ifdef USB_SETTINGS
|
||||
REQUIRE_OBJECT ( usb_settings );
|
||||
#endif
|
||||
|
||||
@@ -12,6 +12,7 @@ FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
|
||||
#include <config/defaults.h>
|
||||
|
||||
#define PCI_SETTINGS /* PCI device settings */
|
||||
#define USB_SETTINGS /* USB device settings */
|
||||
//#define CPUID_SETTINGS /* CPUID settings */
|
||||
//#define MEMMAP_SETTINGS /* Memory map settings */
|
||||
//#define VMWARE_SETTINGS /* VMware GuestInfo settings */
|
||||
|
||||
Reference in New Issue
Block a user