Turning off a single usb device… again

前端 未结 3 1391
轮回少年
轮回少年 2020-12-25 13:23

I know that this topic has been discussed many times, but none of the answers helped me. For the record, i\'m running Debian.

The deal is: I bought an usb powered le

3条回答
  •  礼貌的吻别
    2020-12-25 14:12

    Try this code it works for me (Only for rooted)

     String[] cmdline = { "su", "-c", "echo '1-1' >/sys/bus/usb/drivers/usb/unbind" };
    try {
        Runtime.getRuntime().exec(cmdline);
    } catch (IOException e) {
        Log.e("MainActivity","Failed"+e);
    }
    

    and for bind again do this

        String[] cmdline = { "su", "-c", "echo '1-1' >/sys/bus/usb/drivers/usb/bind" };
    try {
        Runtime.getRuntime().exec(cmdline);
    } catch (IOException e) {
        Log.e("MainActivity","Failed"+e);
    }
    

提交回复
热议问题