nohajc / termux-adb

Run adb in Termux without root permissions!
MIT License
311 stars 32 forks source link

How to auto accept new device without press accept request dialog #18

Closed Lolmc0587 closed 10 months ago

Lolmc0587 commented 11 months ago

can we do that? its really annoying when replug the device

nohajc commented 11 months ago

I don't think you can skip the dialog. It's how Android works for non-root users. Security feature...

Lolmc0587 commented 10 months ago

why termux not remember the previous usb plugged?

nohajc commented 10 months ago

This is not really a Termux issue. Every time you unplug a device, it is most likely de-authorized by Android OS. Then you have to go through the dialog again. I'm assuming this is the case. Maybe the termux devs could tell you if there's any way around it but I'm not aware of any.

All this has been designed to limit access to USB peripherals without user's explicit approval. Only if you have a rooted device, you get direct USB access as in any other Linux system.

The thing is, if you're not root, you can't even list attached devices using the /dev files. Instead you need to go through Android SDK's wrapper which enforces all this additional authorization. This is what termux exposes via the Termux:API extension and it's the only way to get adb working (unless you have root access).

Lolmc0587 commented 10 months ago

https://github.com/kai-morich/SimpleUsbTerminal this app just support an usb serial but when replug its still working this app have an remember button Screenshot_20230830_183546_Serial USB Terminal

nohajc commented 10 months ago

Well, in that case, this is a potential termux improvement. I can't do anything about it directly though...

offici5l commented 7 months ago

@Lolmc0587

It has to do with termux-api (app and package):

https://github.com/termux/termux-api/blob/master/app%2Fsrc%2Fmain%2Fjava%2Fcom%2Ftermux%2Fapi%2Fapis%2FUsbAPI.java#L111-L172

https://github.com/termux/termux-api-package/blob/master/scripts%2Ftermux-usb.in#L54-L68