Blame view

kernel/linux-rt-4.4.41/tools/usb/usbip/src/usbip_port.c 1.29 KB
5113f6f70   김현기   kernel add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
  /*
   * Copyright (C) 2011 matt mooney <mfm@muteddisk.com>
   *               2005-2007 Takahiro Hirofuchi
   *
   * This program is free software: you can redistribute it and/or modify
   * it under the terms of the GNU General Public License as published by
   * the Free Software Foundation, either version 2 of the License, or
   * (at your option) any later version.
   *
   * This program is distributed in the hope that it will be useful,
   * but WITHOUT ANY WARRANTY; without even the implied warranty of
   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   * GNU General Public License for more details.
   */
  
  #include "vhci_driver.h"
  #include "usbip_common.h"
  
  static int list_imported_devices(void)
  {
  	int i;
  	struct usbip_imported_device *idev;
  	int ret;
  
  	ret = usbip_vhci_driver_open();
  	if (ret < 0) {
  		err("open vhci_driver");
  		return -1;
  	}
  
  	printf("Imported USB devices
  ");
  	printf("====================
  ");
  
  	for (i = 0; i < vhci_driver->nports; i++) {
  		idev = &vhci_driver->idev[i];
  
  		if (usbip_vhci_imported_device_dump(idev) < 0)
  			ret = -1;
  	}
  
  	usbip_vhci_driver_close();
  
  	return ret;
  
  }
  
  int usbip_port_show(__attribute__((unused)) int argc,
  		    __attribute__((unused)) char *argv[])
  {
  	int ret;
  
  	ret = list_imported_devices();
  	if (ret < 0)
  		err("list imported devices");
  
  	return ret;
  }