Re: [PATCH] staging: usbip: add support for viewing imported devices

From: Ilija Hadzic
Date: Mon Dec 23 2013 - 15:00:48 EST




On Mon, 23 Dec 2013, Valentina Manea wrote:

As of Matt Mooney's major refactoring in 2011, usbip port
option was left out. Add support for this option in
a manner similar to the old implementation.


Yeah, I guess most people (incluing myself) have been just happy with
just cat-ing the files in /var/run/vhci_hcd. Anyway, I guess it doesn't hurt to have it in the tool.

Sample output:

Imported USB devices
====================
Port 00: <Port in Use> at Full Speed(12Mbps)
unknown vendor : unknown product (1687:6211)
2-1 -> usbip://192.168.122.152:3240/1-1 (remote devid 00010002 (bus/dev 001/002))


I don't find devid very useful when you are already printing bus and device number; devid is just a different format for the same thing. Just bus number and device number should suffice.


[SNIP]


+int usbip_vhci_imported_device_dump(struct usbip_imported_device *idev)
+{

[SNIP]

+
+ ret = read_record(idev->port, host, serv, remote_busid);
+ if (ret) {
+ err("read_record");
+ return -1;
+ }
+

If the caller is looping over the ports and dumping one port fails because some bozo has rm-ed the record file, is it the right thing to bail out of completely? You may want to consider continuing with the loop and still show what can be shown (and mark unshowable ports as such).

In that sense, you probably don't want to return an error here.


+ printf("Port %02d: <%s> at %s\n", idev->port,
+ usbip_status_string(idev->status),
+ usbip_speed_string(idev->udev.speed));

[SNIP]

+int usbip_port_show(int argc, char *argv[])
+{
+ (void) argc;
+ (void) argv;
+

This is an ugly way to suppress the warning. Consider using __attribute__((unused)) instead.


-- Ilija

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/