summaryrefslogtreecommitdiffstats
path: root/usr.sbin/usbconfig/dump.c
diff options
context:
space:
mode:
authorthompsa <thompsa@FreeBSD.org>2009-02-14 23:20:00 +0000
committerthompsa <thompsa@FreeBSD.org>2009-02-14 23:20:00 +0000
commit8152f4da8d3bb0ffd81ff4e53b21016c0d9ba8f8 (patch)
tree622b53531275e080bd1746cbafae09eed6be649e /usr.sbin/usbconfig/dump.c
parentf35949f29ca00a8a25a5ff0a6ad875c3967085e2 (diff)
downloadFreeBSD-src-8152f4da8d3bb0ffd81ff4e53b21016c0d9ba8f8.zip
FreeBSD-src-8152f4da8d3bb0ffd81ff4e53b21016c0d9ba8f8.tar.gz
MFp4 //depot/projects/usb@157699
Add two new functions to the libusb20 API and required kernel ioctls. - libusb20_dev_get_iface_desc - libusb20_dev_get_info New command to usbconfig, "show_ifdrv", which will print out the kernel driver attached to the given USB device aswell. See "man libusb20" for a detailed description. Some minor style corrections long-line wrapping. Submitted by: Hans Petter Selasky
Diffstat (limited to 'usr.sbin/usbconfig/dump.c')
-rw-r--r--usr.sbin/usbconfig/dump.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/usr.sbin/usbconfig/dump.c b/usr.sbin/usbconfig/dump.c
index ffa8b2c..01c55d2 100644
--- a/usr.sbin/usbconfig/dump.c
+++ b/usr.sbin/usbconfig/dump.c
@@ -176,15 +176,30 @@ dump_iface(struct libusb20_device *pdev,
}
void
-dump_device_info(struct libusb20_device *pdev)
+dump_device_info(struct libusb20_device *pdev, uint8_t show_ifdrv)
{
+ char buf[128];
+ uint8_t n;
+
printf("%s, cfg=%u md=%s spd=%s pwr=%s\n",
libusb20_dev_get_desc(pdev),
libusb20_dev_get_config_index(pdev),
dump_mode(libusb20_dev_get_mode(pdev)),
dump_speed(libusb20_dev_get_speed(pdev)),
dump_power_mode(libusb20_dev_get_power_mode(pdev)));
- return;
+
+ if (!show_ifdrv)
+ return;
+
+ for (n = 0; n != 255; n++) {
+ if (libusb20_dev_get_iface_desc(pdev, n, buf, sizeof(buf)))
+ break;
+ if (buf[0] == 0)
+ continue;
+ printf("ugen%u.%u.%u: %s\n",
+ libusb20_dev_get_bus_number(pdev),
+ libusb20_dev_get_address(pdev), n, buf);
+ }
}
void
@@ -339,7 +354,8 @@ dump_device_iface_access(struct libusb20_device *pdev, uint8_t iface)
owner = (pw = getpwuid(uid)) ? pw->pw_name : "UNKNOWN";
group = (gr = getgrgid(gid)) ? gr->gr_name : "UNKNOWN";
- printf(" " "Interface %u Access: %s:%s 0%o\n", iface, owner, group, mode);
+ printf(" " "Interface %u Access: %s:%s 0%o\n",
+ iface, owner, group, mode);
} else {
printf(" " "Interface %u Access: <not set>\n", iface);
}
OpenPOWER on IntegriCloud