I have a wall-mounted Android POE-enabled tablet which I’ve successfully connected to the Android TV integration. The tablet contains an outer LED frame that can be controlled by issuing an ADB command to a mounted device ("echo w 0x05 > ./sys/devices/platform/led_con_h/zigbee_reset").
That mechanism enables me to show the status of the locking state of the alarm panel which is a great solution to remind everybody to unarm the panel.
In order to get the command successfully forwarded to the mounted device I need to elevate adbd having root access. This can be done by using the Android platform tools ("adb root") on my computer once connected to the device.
Anyway, each time the tablet is restarted, this elevation needs to be issued again. Is there a way to issue that command in the python ADB implementation that comes with the Android TV integration?
Sure, the model itself is a no-name chinese one. As with nearly all kind of chinese tablets, the tablet comes without any kind of security updates but is already pre-rooted and works for my intended usage like a charm (Fully Kiosk Browser locked, ADB via Ethernet).
I hope the admins are fine with posting a link to Aliexpress:
I came across another promising solution “ADB insecure” by Chainfire which has been repacked by someone at XDA-Developers to be compatible with Android 7+ devices. I will try that approach as well as I am not having the mood for dealing with modifying the bootloader on my own.
Unfortunately my attempt with ADB insecure did not work.
The automation is a good idea. Did not think about that! Thank you.
The best trigger would be if the device was offline and went back online because the command needs to be executed after startup of the Android tablet. This should be easily done by either using the Ubiquiti integration or a simple ping test. The only thing I am really struggling with is to issue that adb root command via the python implementation. It seems to me that each command beside “HOME”, “UP”, etc. will be applied to the shell.
Hi Guys, thank you for you buying from us. I am Fiona from YIXU Industry CO., LTD, the manufacture of the tablet you bought. Please feel free to contact me if you need any technical support.
Also, for how to control the LED indicator, please refer to below page, hope it helps.
public String adbcommand(String command) { //adb命令实现类
Process process = null;
DataOutputStream os = null;
String excresult = “”;
try {
process = Runtime.getRuntime().exec("su -c "+command );
os = new DataOutputStream(process.getOutputStream()); //os.writeBytes(command + “\n”); //os.writeBytes(“exit\n”);
os.flush();
BufferedReader in = new BufferedReader(new InputStreamReader(
process.getInputStream()));
StringBuffer stringBuffer = new StringBuffer();
String line = null;
while ((line = in.readLine()) != null) {
stringBuffer.append(line + " ");
}
excresult = stringBuffer.toString();
in.close();
process.destroy();
} catch (Exception e) {
e.printStackTrace();
}finally {
}
return excresult;
//The time must be in this format,
The front is the shutdown time (year, month, day, hour and minute), and the back is the power-on time. enable works, disable does not work.
adbcommand(“dpm set-device-owner de.allnet.allnetmedicalfrontbutton/.DeviceAdmin”); //Add This