I need a way to turn off the flash of the Sunmi L2s PRO.
By "flash", I mean the light at the top of the device, next to the laser barcode scanner (I do not mean the torch at the back of the device):
According to the Sunmi support, that is not possible. But the demo app which is shipped with the device has a setting which can enable or disable the flash, so there must be a way. But it seems like it is a private API.
Does anyone know how to toggle the flash or how I could reverse-engineer the demo app or "intercept" system calls etc. to find out how it is done?
The only two official methods to achieve what you want is by either pushing the setting from partner.sunmi.com web panel or through the scanner configuration (which you have called a demo) application.
As you correctly assume, there is a third - a bit more unofficial and not documented way - which I, as a person who already disassembled and reverse engineered the scanner service on Sunmi devices - discovered.
Just keep in mind that this is an unofficial API, that may stop working in the future. At this moment it works at every device I have tested (V2 Pro, V2s, V2s Plus, L2K, L2Ks, L2s and L2H), but it is not a guarantee.
To use it follow the steps:
IScanInterface.aidl
add the following line before closing curly bracket: void sendCommand(String str) = 5;
sendCommand
with the parameter of either scan00000107=1;
to enable or scan00000107=0;
to disable flash control.With this API you can change all options of scanner configuration. There is also a second private method to query for current scanner configuration. In the future I will publish everything what I have learned during reverse engineering scanner service in the form of a generic Android library, but until that will happen, you can refer to my capacitor.js plugin, where you could find the control codes for rest of the settings if you want.