Add methods for Usb Gadget Hal v1.2
1. Add svc usb getUsbSpeed method 2. Add svc usb getCurrentGadgetHalVersion method Bug: 168282708 Test: build pass and get test result Change-Id: Id3480757fd3545b0cce083aaa3cf906e09ae318c
This commit is contained in:
@@ -42,10 +42,20 @@ public class UsbCommand extends Svc.Command {
|
||||
+ " Sets the functions which, if the device was charging, become current on"
|
||||
+ "screen unlock. If function is blank, turn off this feature.\n"
|
||||
+ " svc usb getFunctions\n"
|
||||
+ " Gets the list of currently enabled functions\n"
|
||||
+ " Gets the list of currently enabled functions\n"
|
||||
+ " possible values of [function] are any of 'mtp', 'ptp', 'rndis',\n"
|
||||
+ " 'midi', 'ncm (if supporting gadget hal v1.2)'\n"
|
||||
+ " svc usb resetUsbGadget\n"
|
||||
+ " Reset usb gadget\n\n"
|
||||
+ "possible values of [function] are any of 'mtp', 'ptp', 'rndis', 'midi'\n";
|
||||
+ " Reset usb gadget\n"
|
||||
+ " svc usb getUsbSpeed\n"
|
||||
+ " Gets current USB speed\n"
|
||||
+ " possible values of USB speed are any of 'low speed', 'full speed',\n"
|
||||
+ " 'high speed', 'super speed', 'super speed (10G)',\n"
|
||||
+ " 'super speed (20G)', or higher (future extension)\n"
|
||||
+ " svc usb getGadgetHalVersion\n"
|
||||
+ " Gets current Gadget Hal Version\n"
|
||||
+ " possible values of Hal version are any of 'unknown', 'V1_0', 'V1_1',\n"
|
||||
+ " 'V1_2'\n";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -84,6 +94,23 @@ public class UsbCommand extends Svc.Command {
|
||||
System.err.println("Error communicating with UsbManager: " + e);
|
||||
}
|
||||
return;
|
||||
} else if ("getUsbSpeed".equals(args[1])) {
|
||||
try {
|
||||
System.err.println(
|
||||
UsbManager.usbSpeedToBandwidth(usbMgr.getCurrentUsbSpeed()));
|
||||
} catch (RemoteException e) {
|
||||
System.err.println("Error communicating with UsbManager: " + e);
|
||||
}
|
||||
return;
|
||||
} else if ("getGadgetHalVersion".equals(args[1])) {
|
||||
try {
|
||||
System.err.println(
|
||||
UsbManager.usbGadgetHalVersionToString(
|
||||
usbMgr.getGadgetHalVersion()));
|
||||
} catch (RemoteException e) {
|
||||
System.err.println("Error communicating with UsbManager: " + e);
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
System.err.println(longHelp());
|
||||
|
||||
Reference in New Issue
Block a user