summaryrefslogtreecommitdiffstats
path: root/usr.sbin/usbconfig/dump.c
diff options
context:
space:
mode:
authoralfred <alfred@FreeBSD.org>2008-11-19 08:56:35 +0000
committeralfred <alfred@FreeBSD.org>2008-11-19 08:56:35 +0000
commit881f5acc93790d49318ffde65d52c6f45ca9c1f8 (patch)
tree563c2e235db65a3694986a6531a444241d882b23 /usr.sbin/usbconfig/dump.c
parentf750559c3fe5d18392fa3f5969411eef4c84075c (diff)
downloadFreeBSD-src-881f5acc93790d49318ffde65d52c6f45ca9c1f8.zip
FreeBSD-src-881f5acc93790d49318ffde65d52c6f45ca9c1f8.tar.gz
src/sys/dev/usb2/controller/uss820dci_pccard.c
src/sys/dev/usb2/core/usbdevs src/sys/dev/usb2/include/urio2_ioctl.h src/sys/dev/usb2/storage/ustorage2_fs.h These files are not used any more. src/usr.sbin/Makefile src/etc/mtree/BSD.include.dist src/include/Makefile src/lib/Makefile src/share/man/man7/hier.7 src/share/mk/bsd.libnames.mk src/etc/mtree/BSD.include.dist Make "usbconfig" and "libusb20" a part of the default build. src/sys/dev/usb/rio500_usb.h src/sys/dev/usb2/storage/urio2.c Use common include file. src/sys/dev/usb2/bluetooth/ng_ubt2.c Make USB bluetooth depend on "ng_hci" module. src/sys/dev/usb2/controller/ehci2.c src/sys/dev/usb2/controller/ehci2.h Patches for Marvell EHCI. src/sys/dev/usb2/core/usb2_busdma.c Bugfix for 64-bit platforms. Need to unload the previously loaded DMA map and some cleanup regarding some corner cases. src/sys/dev/usb2/core/usb2_core.h src/sys/dev/usb2/core/usb2_dev.c src/sys/dev/usb2/core/usb2_dev.h Bugfix for libusb filesystem interface. New feature: Add support for filtering device data at the expense of the userland process. Add some more comments. Some minor code styling. Remove unused function, usb2_fifo_get_data_next(). Fix an issue about "fifo_index" being used instead of "ep_index". src/sys/dev/usb2/core/usb2_device.c src/sys/dev/usb2/core/usb2_generic.c Bugfix for Linux USB compat layer. Do not free non-generic FIFOs when doing an alternate setting. Cleanup USB IOCTL and USB reference handling. Fix a corner case where USB-FS was left initialised after setting a new configuration or alternate setting. src/sys/dev/usb2/core/usb2_hub.c Improvement: Check all USB HUB ports by default at least one time. src/sys/dev/usb2/core/usb2_request.c Bugfix: Make sure destination ASCII string is properly zero terminated in all cases. Improvement: Skip invalid characters instead of replacing with a dot. src/sys/dev/usb2/core/usb2_util.c src/sys/dev/usb2/image/uscanner2.c Spelling. src/sys/dev/usb2/include/Makefile Share "usbdevs" with the old USB stack. src/sys/dev/usb2/include/usb2_devid.h src/sys/dev/usb2/include/usb2_devtable.h Regenerate files. Alfred: Please fix the RCS tag at the top. src/sys/dev/usb2/include/usb2_ioctl.h Fix compilation of "kdump". src/sys/dev/usb2/serial/ubsa2.c src/sys/dev/usb2/serial/ugensa2.c Remove device ID's which will end up in a new 3G driver. src/sys/dev/usb2/sound/uaudio2.c Correct a debug printout. src/sys/dev/usb2/storage/umass2.c Sync with old USB stack. src/lib/libusb20/libusb20.3 Add more documentation. src/lib/libusb20/libusb20.c Various bugfixes and improvements. src/usr.sbin/usbconfig/dump.c src/usr.sbin/usbconfig/usbconfig.c New commands for dumping strings and doing custom USB requests from the command line. Remove keyword requirements from generated files: "head/sys/dev/usb2/include/usb2_devid.h" "head/sys/dev/usb2/include/usb2_devtable.h"
Diffstat (limited to 'usr.sbin/usbconfig/dump.c')
-rw-r--r--usr.sbin/usbconfig/dump.c76
1 files changed, 12 insertions, 64 deletions
diff --git a/usr.sbin/usbconfig/dump.c b/usr.sbin/usbconfig/dump.c
index 89a47ac..ffa8b2c 100644
--- a/usr.sbin/usbconfig/dump.c
+++ b/usr.sbin/usbconfig/dump.c
@@ -96,9 +96,6 @@ static void
dump_field(struct libusb20_device *pdev, const char *plevel,
const char *field, uint32_t value)
{
- struct LIBUSB20_CONTROL_SETUP_DECODED req;
- uint16_t lang_id;
- uint8_t index;
uint8_t temp_string[256];
printf("%s%s = 0x%04x ", plevel, field, value);
@@ -108,64 +105,15 @@ dump_field(struct libusb20_device *pdev, const char *plevel,
return;
}
if (value == 0) {
- printf(" <no string> \n");
+ printf(" <no string>\n");
return;
}
- LIBUSB20_INIT(LIBUSB20_CONTROL_SETUP, &req);
-
- lang_id = 0;
- index = 0;
-
- req.bmRequestType =
- LIBUSB20_REQUEST_TYPE_STANDARD |
- LIBUSB20_RECIPIENT_DEVICE |
- LIBUSB20_ENDPOINT_IN;
- req.bRequest = LIBUSB20_REQUEST_GET_DESCRIPTOR;
- req.wValue = (256 * LIBUSB20_DT_STRING) | index;
- req.wIndex = lang_id;
- req.wLength = 4; /* bytes */
-
- if (libusb20_dev_request_sync(pdev, &req,
- temp_string, NULL, 1000, 0)) {
- goto done;
- }
- lang_id = temp_string[2] | (temp_string[3] << 8);
-
- printf(" LangId:0x%04x <", lang_id);
-
- index = value;
-
- req.wValue = (256 * LIBUSB20_DT_STRING) | index;
- req.wIndex = lang_id;
- req.wLength = 4; /* bytes */
-
- if (libusb20_dev_request_sync(pdev, &req,
- temp_string, NULL, 1000, 0)) {
- printf("ERROR>\n");
- goto done;
- }
- req.wValue = (256 * LIBUSB20_DT_STRING) | index;
- req.wIndex = lang_id;
- req.wLength = temp_string[0]; /* bytes */
-
- if (libusb20_dev_request_sync(pdev, &req,
- temp_string, NULL, 1000, 0)) {
- printf("ERROR>\n");
- goto done;
- }
- req.wLength /= 2;
-
- for (index = 1; index != req.wLength; index++) {
- if (isprint(temp_string[(2 * index) + 0])) {
- printf("%c", temp_string[(2 * index) + 0]);
- } else if (isprint(temp_string[(2 * index) + 1])) {
- printf("%c", temp_string[(2 * index) + 1]);
- } else {
- printf("?");
- }
+ if (libusb20_dev_req_string_simple_sync(pdev, value,
+ temp_string, sizeof(temp_string))) {
+ printf(" <retrieving string failed>\n");
+ return;
}
- printf(">\n");
-done:
+ printf(" <%s>\n", temp_string);
return;
}
@@ -244,7 +192,7 @@ dump_be_quirk_names(struct libusb20_backend *pbe)
{
struct libusb20_quirk q;
uint16_t x;
- int err;
+ int error;
memset(&q, 0, sizeof(q));
@@ -252,8 +200,8 @@ dump_be_quirk_names(struct libusb20_backend *pbe)
for (x = 0; x != 0xFFFF; x++) {
- err = libusb20_be_get_quirk_name(pbe, x, &q);
- if (err) {
+ error = libusb20_be_get_quirk_name(pbe, x, &q);
+ if (error) {
if (x == 0) {
printf("No quirk names - maybe the USB quirk "
"module has not been loaded.\n");
@@ -272,7 +220,7 @@ dump_be_dev_quirks(struct libusb20_backend *pbe)
{
struct libusb20_quirk q;
uint16_t x;
- int err;
+ int error;
memset(&q, 0, sizeof(q));
@@ -280,8 +228,8 @@ dump_be_dev_quirks(struct libusb20_backend *pbe)
for (x = 0; x != 0xFFFF; x++) {
- err = libusb20_be_get_dev_quirk(pbe, x, &q);
- if (err) {
+ error = libusb20_be_get_dev_quirk(pbe, x, &q);
+ if (error) {
if (x == 0) {
printf("No device quirks - maybe the USB quirk "
"module has not been loaded.\n");
OpenPOWER on IntegriCloud