Add support for specifying UDC that HID gadget will connect to
Currently, HID gadget always connects to the USB virtual hub port
under /sys/bus/platform/devices/1e6a0000.usb-vhub, which only works
on ASPEED platform.
This commit adds support for specifying UDC that HID gadget will
connect to, it could be useful for non-ASPEED platform. Although there
are still some other ASPEED-specific behaviors need to be addressed,
but this commit is the first step for non-ASPEED platform.
Tested:
Specify UDC by '-u' parameter and HID gadget will connect to it. Otherwise,
HID gadget will connect to the USB virtual hub port.
Signed-off-by: Marvin Lin <milkfafa@gmail.com>
Change-Id: Ie24ed9d32cb4f7483e8d4c8b51cc5e1bb5fa94de
diff --git a/ikvm_args.cpp b/ikvm_args.cpp
index f9401ac..4887870 100644
--- a/ikvm_args.cpp
+++ b/ikvm_args.cpp
@@ -12,12 +12,16 @@
frameRate(30), subsampling(0), calcFrameCRC{false}, commandLine(argc, argv)
{
int option;
- const char* opts = "f:s:h:k:p:v:c";
- struct option lopts[] = {
- {"frameRate", 1, 0, 'f'}, {"subsampling", 1, 0, 's'},
- {"help", 0, 0, 'h'}, {"keyboard", 1, 0, 'k'},
- {"mouse", 1, 0, 'p'}, {"videoDevice", 1, 0, 'v'},
- {"calcCRC", 0, 0, 'c'}, {0, 0, 0, 0}};
+ const char* opts = "f:s:h:k:p:u:v:c";
+ struct option lopts[] = {{"frameRate", 1, 0, 'f'},
+ {"subsampling", 1, 0, 's'},
+ {"help", 0, 0, 'h'},
+ {"keyboard", 1, 0, 'k'},
+ {"mouse", 1, 0, 'p'},
+ {"udcName", 1, 0, 'u'},
+ {"videoDevice", 1, 0, 'v'},
+ {"calcCRC", 0, 0, 'c'},
+ {0, 0, 0, 0}};
while ((option = getopt_long(argc, argv, opts, lopts, NULL)) != -1)
{
@@ -42,6 +46,9 @@
case 'p':
pointerPath = std::string(optarg);
break;
+ case 'u':
+ udcName = std::string(optarg);
+ break;
case 'v':
videoPath = std::string(optarg);
break;
@@ -62,6 +69,8 @@
fprintf(stderr, "-h, --help show this message and exit\n");
fprintf(stderr, "-k device HID keyboard gadget device\n");
fprintf(stderr, "-p device HID mouse gadget device\n");
+ fprintf(stderr,
+ "-u udc name UDC that HID gadget will connect to\n");
fprintf(stderr, "-v device V4L2 device\n");
fprintf(
stderr,