diff options
author | hselasky <hselasky@FreeBSD.org> | 2013-02-14 12:22:40 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2013-02-14 12:22:40 +0000 |
commit | d7b1840a86d06ec4dc5506a5063682c00642dadf (patch) | |
tree | a0b0c710f98a991d5594c3cd1efed27bd508c825 /lib/libusb/libusb20.c | |
parent | af9a6b59013c48aa503513ce55d93fe84817996a (diff) | |
download | FreeBSD-src-d7b1840a86d06ec4dc5506a5063682c00642dadf.zip FreeBSD-src-d7b1840a86d06ec4dc5506a5063682c00642dadf.tar.gz |
Add USB API to read power draw on USB devices.
Update usbconfig to print power draw on USB devices.
MFC after: 2 weeks
Submitted by: Matt Burke @ icritical.com
Diffstat (limited to 'lib/libusb/libusb20.c')
-rw-r--r-- | lib/libusb/libusb20.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/libusb/libusb20.c b/lib/libusb/libusb20.c index aa45991..ce75511 100644 --- a/lib/libusb/libusb20.c +++ b/lib/libusb/libusb20.c @@ -71,6 +71,7 @@ dummy_callback(struct libusb20_transfer *xfer) #define dummy_check_connected (void *)dummy_int #define dummy_set_power_mode (void *)dummy_int #define dummy_get_power_mode (void *)dummy_int +#define dummy_get_power_usage (void *)dummy_int #define dummy_kernel_driver_active (void *)dummy_int #define dummy_detach_kernel_driver (void *)dummy_int #define dummy_do_request_sync (void *)dummy_int @@ -717,6 +718,18 @@ libusb20_dev_get_power_mode(struct libusb20_device *pdev) return (power_mode); } +uint16_t +libusb20_dev_get_power_usage(struct libusb20_device *pdev) +{ + int error; + uint16_t power_usage; + + error = pdev->methods->get_power_usage(pdev, &power_usage); + if (error) + power_usage = 0; + return (power_usage); +} + int libusb20_dev_set_alt_index(struct libusb20_device *pdev, uint8_t ifaceIndex, uint8_t altIndex) { |