if you are a little bit more clearer with those cryptic lines... then we might be capable of replicating... not everybody can speak your language cheers.
Now I have 9 like in DHO1000. Wanna see 666 or any other number?
Android is based on Linux kernel with little bit of staff from GNU. Every process leaves trace, and we can strace that. I didnt expect to production app being compiled with flags to trace function calls, but without it its possible to trace all system calls like a opening or closing files. Typically lot of things (including sleeps and many other things), so its better to send it via pipe to a file, to examine it later.
Second thing:
In Unix and Unix-like (Linux) systems, everything is a file. So You dont need to write or download any software to do many things - couple basic tools and You can do almost everything.
Third thing: most drivers are layer between real hardware and... guess what is on other side. Spoiler: on other side there is a file.
Fourth thing: solution was practically already on this forum. Module hdcode_gpio.ko was reading some GPIO pins (I dont know which pins, how often and etc) and creating a file to read from there or maybe even to write into.
My suspicions was in /sys or eventually in /proc pseudo-filesystems, where normally more or less strange drivers creates some files. Comparing files listed into text files (Kompare from KDE - very useful), with and without this module (rmmod and insmod) gives me practically nothing. But opened file names visible with strace...
[pid 1851] openat(AT_FDCWD, "/dev/hdcode_gpio", O_RDWR|O_NONBLOCK <unfinished ...>
So to make a first test, I decided to unload this module and restart the app. As in my previous post, number was 0 instead of 8 like original.
Inserting this module back and restarting app, still gives 0. Im not a expert with Android. I have very little bit of knowledge with *-nix systems but not specially with Android - more of that, I think that is a very big crap, especially 8 and newer. No surprise for me, they used 7. Currently Im using two mobile phones - one with 7 and second one with 14.
Investigating further with this module...
rk3399_rigol:/ $ ls -l /dev/hdcode_gpio
crwxrwxrwx 1 root root 10, 45 2013-01-18 16:50 /dev/hdcode_gpio
C at the beginning means that is not normal file, but a char device - almost the same, but usually created by some kernel module.
I tried to read from it...
rk3399_rigol:/ $ cat /dev/hdcode_gpio
Houston, we have a cra... sudden reboot and crash. I almost had a heart attack. Playing too much, can cause to destroy something - for example, small mistake can cause to write into I2C and boom, RK808 gives much much higher voltages than usual. So be careful.
Next experiment was to remove this module from kernel and from Rigol script, where is located insmod command. Mentioned file disappeared
no surprise.
Normally in /dev directory special (magic?) file system is mounted. Root can create and in some cases can delete files from there. Including completely normal files. So whats the problem?
echo -n "9" > /dev/hdcode_gpio
I wanted DHO1000 but result was more like DHO9234532487. Jokes aside, app showed hardware number 57...
After about 15 minutes of thinking (I was too much lazy to do experiments with random numbers) I reminded ASCII table. Character 9 is 57 in ASCII.
In ASCII byte 0x9 (9 in decimal) is a tab (\t). So...
rk3399_rigol:/ # echo -en "\t" > /dev/hdcode_gpio
After that, little test to confirm I didnt made any mistake:
rk3399_rigol:/ # cat /dev/hdcode_gpio
rk3399_rigol:/ #
And now I have what I always wanted from being 3 years old.