summaryrefslogtreecommitdiff
path: root/cmds/svc
diff options
context:
space:
mode:
authorraychi <raychi@google.com>2020-10-06 00:33:05 +0800
committerraychi <raychi@google.com>2020-11-12 11:00:08 +0800
commit062ddc34752b71ecb50b97c027c61e98bfd72029 (patch)
treef313cac5408a3a513abdf0dc4327ea9e39520b8a /cmds/svc
parent88254a2b567d1d0b44d7447cd14457c9df4998c5 (diff)
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
Diffstat (limited to 'cmds/svc')
-rw-r--r--cmds/svc/src/com/android/commands/svc/UsbCommand.java33
1 files changed, 30 insertions, 3 deletions
diff --git a/cmds/svc/src/com/android/commands/svc/UsbCommand.java b/cmds/svc/src/com/android/commands/svc/UsbCommand.java
index cd751f4e2d20..227b9e24f173 100644
--- a/cmds/svc/src/com/android/commands/svc/UsbCommand.java
+++ b/cmds/svc/src/com/android/commands/svc/UsbCommand.java
@@ -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());