Skip to content

Commit

Permalink
staging: usbip: userspace: re-add interface information listing
Browse files Browse the repository at this point in the history
This was deleted in the driver conversion patch. It didn't need
to be deleted; showing more information is ok.

Signed-off-by: Valentina Manea <valentina.manea.m@gmail.com>
Reviewed-by: Shuah Khan <shuah.kh@samsung.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Valentina Manea authored and Greg Kroah-Hartman committed Mar 9, 2014
1 parent 37765c1 commit 29a30ad
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
20 changes: 19 additions & 1 deletion drivers/staging/usbip/userspace/src/usbip_list.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,9 @@ static int get_exported_devices(char *host, int sockfd)
struct op_devlist_reply reply;
uint16_t code = OP_REP_DEVLIST;
struct usbip_usb_device udev;
struct usbip_usb_interface uintf;
unsigned int i;
int rc;
int rc, j;

rc = usbip_net_send_op_common(sockfd, OP_REQ_DEVLIST, 0);
if (rc < 0) {
Expand Down Expand Up @@ -103,6 +104,23 @@ static int get_exported_devices(char *host, int sockfd)
printf("%11s: %s\n", "", udev.path);
printf("%11s: %s\n", "", class_name);

for (j = 0; j < udev.bNumInterfaces; j++) {
rc = usbip_net_recv(sockfd, &uintf, sizeof(uintf));
if (rc < 0) {
err("usbip_net_recv failed: usbip_usb_intf[%d]",
j);

return -1;
}
usbip_net_pack_usb_interface(0, &uintf);

usbip_names_get_class(class_name, sizeof(class_name),
uintf.bInterfaceClass,
uintf.bInterfaceSubClass,
uintf.bInterfaceProtocol);
printf("%11s: %2d - %s\n", "", j, class_name);
}

printf("\n");
}

Expand Down
16 changes: 15 additions & 1 deletion drivers/staging/usbip/userspace/src/usbipd.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,9 @@ static int send_reply_devlist(int connfd)
{
struct usbip_exported_device *edev;
struct usbip_usb_device pdu_udev;
struct usbip_usb_interface pdu_uinf;
struct op_devlist_reply reply;
int rc;
int rc, i;

reply.ndev = 0;
/* number of exported devices */
Expand Down Expand Up @@ -194,6 +195,19 @@ static int send_reply_devlist(int connfd)
dbg("usbip_net_send failed: pdu_udev");
return -1;
}

for (i = 0; i < edev->udev.bNumInterfaces; i++) {
dump_usb_interface(&edev->uinf[i]);
memcpy(&pdu_uinf, &edev->uinf[i], sizeof(pdu_uinf));
usbip_net_pack_usb_interface(1, &pdu_uinf);

rc = usbip_net_send(connfd, &pdu_uinf,
sizeof(pdu_uinf));
if (rc < 0) {
err("usbip_net_send failed: pdu_uinf");
return -1;
}
}
}

return 0;
Expand Down

0 comments on commit 29a30ad

Please sign in to comment.