FileDocCategorySizeDatePackage
UsbCommand.javaAPI DocAndroid 5.1 API2207Thu Mar 12 22:22:08 GMT 2015com.android.commands.svc

UsbCommand

public class UsbCommand extends Svc.Command

Fields Summary
Constructors Summary
public UsbCommand()

        super("usb");
    
Methods Summary
public java.lang.StringlongHelp()

        return shortHelp() + "\n"
                + "\n"
                + "usage: svc usb setFunction [function]\n"
                + "         Set the current usb function.\n\n"
                + "       svc usb getFunction\n"
                + "          Gets the list of currently enabled functions\n";
    
public voidrun(java.lang.String[] args)

        boolean validCommand = false;
        if (args.length >= 2) {
            if ("setFunction".equals(args[1])) {
                IUsbManager usbMgr = IUsbManager.Stub.asInterface(ServiceManager.getService(
                        Context.USB_SERVICE));
                try {
                    usbMgr.setCurrentFunction((args.length >=3 ? args[2] : null), false);
                } catch (RemoteException e) {
                    System.err.println("Error communicating with UsbManager: " + e);
                }
                return;
            } else if ("getFunction".equals(args[1])) {
                System.err.println(SystemProperties.get("sys.usb.config"));
                return;
            }
        }
        System.err.println(longHelp());
    
public java.lang.StringshortHelp()

        return "Control Usb state";