KGL Unit + USB DAC SABRE ES9023 - MTCB Hardware Development

Following the instructions below, I managed to get my USB DAC to work. I will attach the drivers that worked for me.
aluver said:
So, I am glad to say, we have USB Audio (DACs) support now.
If you want to build a serious car sound system, you have to make a digital out to your amp (or DSP) instead of using our head units line outs.
I will try to write in more detail and more simply as to repeat it.
For the redirection of all sounds of the Android to your USB device (a sound card, DAC) it is necessary:
1. To be convinced that a system's kernel version is 3.0.36+ . The version of a firmware can be any. At me I was KLD-1.98 and 4.2.2. But despite it I pulled out driver modules from a tablet firmware on the Android 4.4.2.
2. Get root, root explorer and Android terminal emulator.
3. Copy by root explorer USB Audio support modules *.ko from the applied archive in /system/lib/modules/, and set them permissions to 0644.
4. It is obligatory to try loading modules manually from the terminal exactly in that order:
Code:
[email protected]:/ $ su
[email protected]:/ # insmod /system/lib/modules/snd-hwdep.ko
[email protected]:/ # insmod /system/lib/modules/snd-rawmidi.ko
[email protected]:/ # insmod /system/lib/modules/snd-usbmidi-lib.ko
[email protected]:/ # insmod /system/lib/modules/snd-usb-audio.ko
If the device reboots at execution of this commands, these drivers don't suit to you (though probability of it is small as our HU are identical)
If system silently swallowed your commands - everything normally, we go further.
5. Connect your USB device to one of the back USB ports intended for 3G/Wifi (as we surely need port with support of USB-host).
6. In the terminal enter the following commands and check your device, what number it was defined.
Code:
[email protected]:/ # ls dev/snd
controlC0
controlC1
controlC2
pcmC0D0c
pcmC0D0p
pcmC1D0p
[COLOR="Red"]pcmC2D0c
pcmC2D0p[/COLOR]
timer
[email protected]:/ # cat /proc/asound/cards
0 [RK29WM8731 ]: RK29_WM8731 - RK29_WM8731
RK29_WM8731
1 [RKHDMII2S ]: RK-HDMI-I2S - RK-HDMI-I2S
RK-HDMI-I2S
[COLOR="red"]2 [Headset ]: USB-Audio - Plantronics Headset
Plantronics Plantronics Headset at usb-usb20_host-1.3, full speed[/COLOR]
[email protected]:/ #
Apparently from replies of system, my test Plantronics headset received the address pcmC2D0p - that is Card 2 Device 0. Remembered these figures. Due to the identical architecture of our HU, I think, it will be similar for all of us.
7. To make modules *.ko were loaded at each start of a system, it is necessary to copy by root explorer install-recovery.sh script from archive to /system/etc/install-recovery.sh, set permissions 0755.
8. For providing the redirection of a sound to our USB device it is necessary to deceive system. For this purpose it is necessary to replace number of the device (card) in file /system/lib/hw/audio.primary.rk30board.so. You need find 'pcmC0D0p' string and change it to your remembered value (pcmC2D0p, I think so). It is best of all to make it on the computer by any binary files editor. But I put already my edition of the audio.primary.rk30board.so file with pcmC2D0p value. Don't forget to set it permission 0644. And it is obligatory to make a backup of the original file for ability to return to an initial state.
Click to expand...
Click to collapse
At step 7. my unit looses root capability, therefore I created a script that runs after boot with Script manager.
The script contains the following:
insmod /system/lib/modules/snd-hwdep.ko
insmod /system/lib/modules/snd-rawmidi.ko
insmod /system/lib/modules/snd-usbmidi-lib.ko
insmod /system/lib/modules/snd-usb-audio.ko
At step 8, I didn't find that PCM in my unit so I used another audio.primary.rk30board.so file. I will attach it below.
Problems:
After the sound was rerouted to the DAC, I discovered that I can't control the volume.
Therefore, I bought USB AUdio Player PRO. Now I can control volume, but only from the app, the buttons still doesn't work.
!!!!!! I want to change the tracks from the buttons + SWC and the volume too.
I tried Headunit app, but it doesn't do anything with this player.
PS: Viper4Android doesn't work with this app too.
Instead, Viper4Android works with stock musicplayer but I can't control the volume over HiFimeDIY Sabre USB DAC ES9023 96kHz/24bit
PS2: After I start the USB Audio Player PRO App, I get no sound in other applications. If I don't start that app, I get sound in stock Music Player, Youtube, PowerAmp, etc.

Excellent!

I have found that I can control the volume with the following command:
alsa_amixer -c N cset numid=X Y
Click to expand...
Click to collapse
Where:
N is the number of the card
X is the option corresponding to the volume
y is the value of the volume
In my case, maximum volume is 110 and minimum is 0
Example of command in my case:
alsa_amixer -c 2 cset numid = 2 100
Click to expand...
Click to collapse
Can someone please make a widget/app or integrate it somehow in Headunit so that I can control the volume?
I would be very grateful.

R4D3N said:
I have found that I can control the volume with the following command:
Where:
N is the number of the card
X is the option corresponding to the volume
y is the value of the volume
In my case, maximum volume is 110 and minimum is 0
Example of command in my case:
Can someone please make a widget/app or integrate it somehow in Headunit so that I can control the volume?
I would be very grateful.
Click to expand...
Click to collapse
Here is my edition of last version (2.15) of RK3066-Headunit-service
My edition is able to change the volume levels of DAC and HU together - in same percentage.
DAC volume is changing by command:
Code:
alsa_amixer -c2 sset 'PCM' X%
where 2 - is a card number of DAC (for our HU is always 2)
PCM is the name of alsa volume simple control of Sabre U2 (and many others DACs too)
X% - the value of volume, % - always equal to internal volume of HU, that calculating from 0...30 to 0...100 "exponentialy" by microntek service.
And by the way it also can switch folders/albums in Poweramp through API-commands NEXT_IN_CAT / PREVIOUS_IN_CAT (my wheel buttons codes for it - 61, 62; yours may be different).
I wrote to petrows (developer of this RK3066-Headunit-service) about this modification and asked him to include this functionality to next versions.

Thank you very much. It works but now I have another problem.
After 10-15 minutes, the volume control stops working. It remains or at maximum volume or at the last volume that was set up.
Any ideas how to fix this?

I gues sthe problem is that your volume knob does not control android's volume but send commands to MCU.
Could you try using "Volume+" App to control volume if that works?

Volume+ doesn't work over my DAC.
Headunit does, but after 15 minutes stops working, but if I clear data or restart the Headunit application it works again for 15 minutes.
Any ideas?
PS: SHould I give special permissions to Headunit app? Before it was 0777 and now I am trying with 0644 and I will get back with review.

R4D3N said:
Thank you very much. It works but now I have another problem.
After 10-15 minutes, the volume control stops working. It remains or at maximum volume or at the last volume that was set up.
Any ideas how to fix this?
Click to expand...
Click to collapse
I have had this problem, but only once. Not depends from time in my case. Fixed by reboot too. I think you need to check the direct capability of alsa_amixer to change the dac volume from terminal when it happened again.
Code:
su
alsa_amixer -c2 sset 'PCM' 50%
If it will work, i think the problem is your SU is only for 15 minutes for application. Check your root preferences.
---------- Post added at 07:51 PM ---------- Previous post was at 07:44 PM ----------
dark alex said:
I gues sthe problem is that your volume knob does not control android's volume but send commands to MCU.
Could you try using "Volume+" App to control volume if that works?
Click to expand...
Click to collapse
Our RK3066 HU doesn't have this functional - android volume change is blocked by ROM. Tried this some time earlier.
Alsa mixer was used on this reason. Service just catches microntek MCU volume changes and sends alsa_amixer commands with the same value of volume in %.

How do I check my root preferences?

aluver said:
Code:
su
alsa_amixer -c2 sset 'PCM' 50%
If it will work, i think the problem is your SU is only for 15 minutes for application. Check your root preferences.
.
Click to expand...
Click to collapse
This works so the problem is my root preferences.

then you have to change it in superuser (or SuperSU - depending) app.

I tried but It won't appear in Superuser because when I run it, it doesn't prompt for Root Privilleges, it just runs. How can I manually add it to Superuser?
PS: I am using Malaysk's latest firmware for RK3188.

I installed SuperSU, i granted permanent SuperUser for Headunit but I have the same problem. After a while, the volume control stops working. It works again only if I reboot or if I clear data of the Headunit program.
Ideas?

R4D3N said:
I installed SuperSU, i granted permanent SuperUser for Headunit but I have the same problem. After a while, the volume control stops working. It works again only if I reboot or if I clear data of the Headunit program.
Ideas?
Click to expand...
Click to collapse
When you clear data of the Headunit program, it restarts. So, you just give it 15 min of work with root-access again. Try to delete in SuperSU access rule for this service and reboot. When it will ask for root, give it permanent root. Or you can choose in SuperSU permanent root for all applications.

Thank you very much. I got that working too, I now I have only one problem.
Everytime I power one the unit or when it powers from sleep the volume is at 100% and after I press the volume button it changes at the value on the screen.
Is there a way the set set the default volume as MUTE or 10% ?

Any idea?

If this happens after cold start too, I have the one idea only. Your sevice is starting too early, before the DAC determined by system. Check your startup sequences scripts.
Insmod-commands must be at first positions of install-recovery.sh
mtcservice must be launched by install-recovery-2.sh
There is no problem for me with Malaysk fw #23.
default install-recovery-2.sh from there:
Code:
#dsa
lsd () {
to=$1
shift
for i in $*; do
if [ -d $i ]; then
i=${i%/}
j=${i##*/}
if [ "${j#com.tomtom.*}" != "$j" ]; then
k=$((k+1))
j=$to/$j
if [ -n "`ls $j`" ]; then continue; fi
mkdir -p $j
if mount | grep "$j "; then umount $j; fi
mount -o bind $i $j
else
lsd $to $i/*/
fi
fi
done
}
{
IFS=${IFS#??}
while ! mount | grep "/mnt/internal_sd "; do sleep 1; done
ck=0
while true; do
k=0
#########################################################################
### lsd syntax: ###
### First argument is the target (internal) folder. ###
### Further arguments make a list of source (external) storage paths. ###
### If any com.tomtom.* folder is found in any source path tree, ###
### it will be (bind) mounted under the target folder. ###
#########################################################################
lsd /mnt/internal_sd/tomtom /mnt/external_sd*/*/ /mnt/usb_storage*/*/
if [ $k -gt 0 ]; then
ck=0
sleep 20
continue
fi
if [ $ck -ge 90 ]; then
sleep 30
else
ck=$((ck+1))
sleep 1
fi
done
} >/dev/null 2>&1 &
getpid () {
ps | busybox sed -n "/busybox sed -n/! s/[^ ]* *\([0-9]*\).*$1.*/\1/p"
}
while true; do
pid=`getpid maxmpz`
if [ -z "$pid" -o "$pid" != "$pap" ]; then
om=0
st=0
while true; do
st=$((st+1))
nm=`mount | grep usb_storage | busybox wc -l`
if [ $nm -ne $om ]; then
om=$nm
st=0
else
if [ $st -gt 3 ]; then
if [ $nm -gt 0 ]; then
usb=1
break
fi
if [ -z "$usb" ]; then
break
fi
st=0
fi
fi
if [ $nm -gt 0 ]; then
sleep 1
else
sleep 3
fi
done
while ! am startservice -a com.maxmpz.audioplayer.API_COMMAND --ei cmd 3; do sleep 1; done
sleep 2
pap=`getpid maxmpz`
fi
pid=`getpid petrows`
if [ -z "$pid" ]; then
while ! am startservice com.petrows.mtcservice/.ServiceMain; do sleep 1; done
sleep 1
fi
sleep 10
done &
As you can see startservice com.petrows.mtcservice exists here by default.
I have just replaced old mtcservice apk by new own edition.
PS: Answer with quotes please, because it's the only way to get an E-mail notification for me. I visit this place very rarely.

Does anyone use any RCA mixer or other stuff with DAC to use the built in BT handsfree and FM radio? If I understand good need to connect the DAC and the head unit's RCA outputs to the amplifier in same time.
I found this: Rolls MX22A it is an active mixer, or a passive diy mixer good enough for us?
Or anybody tired the Behringer UCA202/UCA222? It has RCA input and monitor output.
I haven't got any DAC, so I can't try it, but thinking of buying one.

peti007 said:
Does anyone use any RCA mixer or other stuff with DAC to use the built in BT handsfree and FM radio? If I understand good need to connect the DAC and the head unit's RCA outputs to the amplifier in same time
Click to expand...
Click to collapse
If you want to built SQ system, don't do this. This way is wrong - you'll loose the sound quality your DAC gives. Just leave one pair of speakers (coax at rear?) plugged to front speaker outs of your HU and all dirt will live there with BT and radio. You'll CAN hear sound from them, when you need that, but the noise from line outs of HU shouldn't be mixed to your clear music stream
The real music must be at front only: 2-way, 3-way, with sub, etc.

aluver said:
If you want to built SQ system, don't do this. This way is wrong - you'll loose the sound quality your DAC gives. Just leave one pair of speakers (coax at rear?) plugged to front speaker outs of your HU and all dirt will live there with BT and radio. You'll CAN hear sound from them, when you need that, but the noise from line outs of HU shouldn't be mixed to your clear music stream
The real music must be at front only: 2-way, 3-way, with sub, etc.
Click to expand...
Click to collapse
If I listen to FM radio, the HU's RCA out sounds and the DAC is muted, if I listen to music over DAC the HU's RCA is muted.
Maybe I'm wrong, but if I connect the HU's front RCA out and the DAC's RCA out to the RCA mixer in the same time, it doesn't mean they both sound in the same time. There is noise on the HU's RCA too when no sound came out from it?

Related

[Q] Second Camera?

Good day...
Im wanting to connect a USB camera to my ViewSonic G Tablet... I have 3 different USB models. When I plug them in (individually,) I get the /dev/video0 device but I don't seem to be able to use the device...
Why a second camera? I'm thinking I can use my G Tab in my car with a USB camera connected for a Baby Cam (since the baby faces the other way so I can't see and most of my traveling is at night so the normal mirror won't work unless I blind the poor child...) -- In theory, it could be used as a backup camera as well. (Same effect)
The internal camera works, but I don't need to see myself, I'd rather see something behind me.
Ideas?
I've scoured the Forums in more detail... Several ask the questions and someone made it work on the Nook, but it looked Nook specific. =/
Is there a more appropriate place to ask? This would affect all Android Devices that have a USB Host Port...
Now, the G Tablet, VEGAn mod at least... has the UVC Driver for WebCams. When I plug a camera in I get the /dev/video0 device (which doesn't exist until I plug in a camera.) - could it be permissions or is the driver not fully implemented?
The mplayer app that was released sets the root path to /sdcard so I can't point it at /dev/video0... I've tried to use the stream part, but it just exits the video - no error that I can see...
adamsoutherland said:
Now, the G Tablet, VEGAn mod at least... has the UVC Driver for WebCams. When I plug a camera in I get the /dev/video0 device (which doesn't exist until I plug in a camera.) - could it be permissions or is the driver not fully implemented?
Click to expand...
Click to collapse
The device appearing is a good first sign. Can you get me a dmesg output after you've plugged the webcam in? Run a Terminal Emulator app, then type in the window:
Code:
$ [B]dmesg > /mnt/sdcard/dmesg.txt[/B]
The mplayer app that was released sets the root path to /sdcard so I can't point it at /dev/video0... I've tried to use the stream part, but it just exits the video - no error that I can see...
Click to expand...
Click to collapse
Is this app an Android port of the standard mplayer for Linux? If yes, then it will use the V4L (Video 4 Linux) API to grab video frames, and if you can start it on the command line (or supply an input file name), then you can try "tv://" as the input file name.
Run this command first, though, to give everybody read-write access to /dev/video0:
Code:
$ [B]su[/B]
# [B]chmod 666 /dev/video0[/B]
I'm attaching a dmesg prior to plugging in the camera, and one after... I'm also inserting the text of the "diff" in the post...
Code:
[ 189.574313] usb 1-1.1: new high speed USB device using tegra-ehci and address 3
[ 189.657223] usb 1-1.1: New USB device found, idVendor=18ec, idProduct=3299
[ 189.664506] usb 1-1.1: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 189.671944] usb 1-1.1: Product: USB2.0 PC CAMERA
[ 189.677125] usb 1-1.1: Manufacturer: ARKMICRO
[ 189.685907] usb 1-1.1: configuration #1 chosen from 1 choice
[ 189.695760] uvcvideo: Found UVC 1.00 device USB2.0 PC CAMERA (18ec:3299)
[ 189.708989] uvcvideo: UVC non compliance - GET_DEF(PROBE) not supported. Enabling workaround.
[ 189.732392] input: USB2.0 PC CAMERA as /devices/platform/tegra-ehci.2/usb1/1-1/1-1.1/1-1.1:1.0/input/input7
[ 190.318832] SO340010: gpio_val=0xc0a50000, button_val = 0xdbaf0002
[ 190.445387] SO340010: gpio_val=0xc0a50000, button_val = 0xdbaf0000
and this:
Code:
/data/data/berserker.android.apps.sshdroid/home # ls -lh /dev/vid*
crw-rw---- 1 0 1006 81, 0 Sep 2 18:22 /dev/video0
I've also done this:
Code:
/data/data/berserker.android.apps.sshdroid/home # chmod 666 /dev/video0
/data/data/berserker.android.apps.sshdroid/home # cat /dev/video0 /mnt/sdcard/test.mpg
cat: read error: No such device
/data/data/berserker.android.apps.sshdroid/home # ls -lh /dev/vid*
crw-rw-rw- 1 0 1006 81, 0 Sep 2 18:22 /dev/video0
/data/data/berserker.android.apps.sshdroid/home #
The mplayer was an APK from someone on the forums... I've opened it up only to find a "mplayer.so" as I thought it might contain the mplayer binary... (I don't have a machine (with sufficient space) to load the Android SDK at the moment...) (It's on my todo list.)
Am I right to try "cat /dev/video0" before I find the proper mplayer or event ffmpeg binary? (It generally works in linux when I do it...)
PS - I have 3 WebCams, I can give you a dmesg of each one if you need it... They all appear to do the same thing (they are by different manufacturers... iMicro, Sabrent and Agama.) -- also note that these 3 web cams work in Linux (each slightly different, but they work.)
adamsoutherland said:
The mplayer was an APK from someone on the forums... I've opened it up only to find a "mplayer.so" as I thought it might contain the mplayer binary... (I don't have a machine (with sufficient space) to load the Android SDK at the moment...) (It's on my todo list.)
Click to expand...
Click to collapse
Attach the APK so I can have a look at it.
Am I right to try "cat /dev/video0" before I find the proper mplayer or event ffmpeg binary? (It generally works in linux when I do it...)
Click to expand...
Click to collapse
I'm surprised that that works even on standard Linux! You have to setup the frame capture parameters first using ioctl()s before you can start reading data from /dev/video0. Even after that, you get raw frame data, and not mpeg video from the device.
PS - I have 3 WebCams, I can give you a dmesg of each one if you need it... They all appear to do the same thing (they are by different manufacturers... iMicro, Sabrent and Agama.) -- also note that these 3 web cams work in Linux (each slightly different, but they work.)
Click to expand...
Click to collapse
Attach all the 3 webcams to your desktop machine, check that each one works and get me a dmesg and a lsmod command output for each one. I want to see what drivers are loaded for each one. We'll have to load the same drivers on the gTablet too after compiling them.
Code:
[I]Attach Camera1 and make sure its working, then,[/I]
desktop$ [B]dmesg > dmesg1.txt[/B]
desktop$ [B]lsmod > lsmod1.txt[/B]
[I]Attach Camera2 and make sure its working, then,[/I]
desktop$ [B]dmesg > dmesg2.txt[/B]
desktop$ [B]lsmod > lsmod2.txt[/B]
[I]Attach Camera3 and make sure its working, then,[/I]
desktop$ [B]dmesg > dmesg3.txt[/B]
desktop$ [B]lsmod > lsmod3.txt[/B]
Caveats: Even if we get all the drivers to load on the gTablet (the V4L drivers, the main camera driver, and, possibly, its support drivers), we still have the problem of displaying the video stream on Android. While I'm happy to write whatever systems code is required, writing the Java UI code for the Android app is beyond my ken. We'll have to ask someone else (try in the main Android development forums on XDA, or, ask user herbert1 here who's helped out before with custom Java apps) once we've checked that we can read data from the V4L device (I'll send you a test prog which'll output .jpg files once every second once we have the drivers sorted out).
It would be great if someone has already ported mplayer for Android.
I'm attaching the APK I found...
Side note:
After looking deeper at 'cat /dev/video0'; it does not work with these webcams... I think this works on my TV Cards that natively displayed mpeg2 video (it's been a while).
See the attached dmesg-*.txt and lsmod-*.txt. Each is named after the company logo on the camera. (I can get the model numbers if the dmesg isn't enough.) Between each dmesg I rebooted the linux box for clarity. (They can all work at once, but I get confused on what is doing what.)
The command I used to test:
Code:
ffmpeg -f alsa -i hw:0,0 -f video4linux2 -s 320x240 -i /dev/video0 test-agama.mpg
(Each of these cameras has audio - The audio is not important for what I am attempting to do...)
About the UI... I've been avoiding this but it maybe time to start work on this =P -- I just realized that the box I'm testing the cameras on has space... I may have to reload linux for 64bit but then I can install the Android SDK and get to UI Development.
All three webcams seem to depend on only 3 kernel modules: uvcvideo, videodev and v4l1_compat.
If all 3 drivers are loaded on the gTablet too, then we should be able to get the video frames from /dev/video0 (or whatever the device).
I'll send you a test program this evening. In the mean time...:
That .apk file contains the application too--the classes.dex file contains the Dalvik executable bytecode. Just install the .apk, then run the app and provide a file name as input. Try "tv://" as the file name once all 3 drivers have been loaded. Do the "chmod 666 /dev/video0" before running the app.
Try the webcam test program in the attachment. The program reads from a user-specified V4L device and outputs JPEG images until you stop it with CTRL-C. Run as:
Code:
$ [B]su[/B] [I]Become superuser[/I]
# [B]mkdir /mnt/sdcard/tmp[/B] [I]Make a tmp dir. for storing imgs[/I]
# [B]./webcam -o /mnt/sdcard/tmp[/B] [I]Capture webcam images until stopped with CTRL-C[/I]
Get usage instructions with "./webcam --help".
EDIT: I actually didn't test the program out because I couldn't locate my webcam. Report if you encounter any bugs.
Quick Update:
I will be trying this tonight... I've been busy trying to get things done. (Little one is going to be born tomorrow!)
Sorry I haven't been able to respond sooner...
rajeevvp said:
Try the webcam test program in the attachment. The program reads from a user-specified V4L device and outputs JPEG images until you stop it with CTRL-C. Run as:
Code:
$ [B]su[/B] [I]Become superuser[/I]
# [B]mkdir /mnt/sdcard/tmp[/B] [I]Make a tmp dir. for storing imgs[/I]
# [B]./webcam -o /mnt/sdcard/tmp[/B] [I]Capture webcam images until stopped with CTRL-C[/I]
Get usage instructions with "./webcam --help".
EDIT: I actually didn't test the program out because I couldn't locate my webcam. Report if you encounter any bugs.
Click to expand...
Click to collapse
I copied it to /mnt/asec (because I can execute things there without remount)
When I run it, i get:
Code:
/mnt/asec # ./webcam -o /mnt/asec/tmp -d /dev/video0
./webcam: error getting video channel info. Invalid argument
I tried without the -d /dev/video0 and got the same result.
(Sorry for the LOOONG delay... Turns out a newborn takes more time and energy than I expected. I'm just now figuring that out... =P It's worth it though.)
Try this simple USB Webcam test app in the attachment which works on VEGAn-Tab 7.1 and GtabComb* (which have the pershoot kernel).
1. Plug the USB webcam in.
Assuming the kernel you're running has the correct USB webcam drivers compiled in--and, most of them do seem to have the V4L subsystem and the UVC camera drivers (which supports a lot of the common USB webcams) built into the kernel--you should see a new /dev/video0 device file pop up.
2. Run these commands to set correct permissions and owners on the device file (some ROMs--eg. GtabCombOver--don't need it):
Code:
$ [B]su[/B]
# [B]chown system.camera /dev/video0[/B]
# [B]chmod 660 /dev/video0[/B]
(Note that if you unplug and replug the webcam, you'll have to re-run the commands on ROMs which don't set the correct permissions and owners.)
3. Now install and run the SimpleWebCam app.
If, for some reason, no /dev/video0 device is created, then your webcam may need different device drivers, which have not been compiled in (or not been written!), in which case you'll have to compile a new kernel with the correct drivers either built-in or as loadable modules. Nothing else described in this post will need change.
adamsoutherland said:
When I run it, i get:
Code:
/mnt/asec # ./webcam -o /mnt/asec/tmp -d /dev/video0
./webcam: error getting video channel info. Invalid argument
I tried without the -d /dev/video0 and got the same result.
Click to expand...
Click to collapse
Looks like I'll have to update the code to make the program use the V4L2 API instead.
Nexus 7
Just tested this on my Google Nexus 7 tablet and it worked fine, I didn't have to modify the permissions either,
PS, it is rooted, of sure if that makes much difference, will test it on my friends stock nexus 7 tomorrow
USB Camera App
I was able to get the app working on my rooted Nexus 7 4.2 and an unrooted Galaxy SIII . How hard would it be to add a video record function to the app?
droidoso said:
How hard would it be to add a video record function to the app?
Click to expand...
Click to collapse
If you want to do that, then it's better to compile a custom native camera-interface library which makes the USB webcam appear as a standard camera (--the rear one, usually). Then, you can use the standard apps to record videos.
See this thread for a precompiled binary and for the source.

[Q] Connecting USB Sound Device(esp. Microphone) to Android

Hello,
I hope that this is the right Forum section where I can ask my question. If it is the wrong place, I would be pleased if the Mods can place it in the right Forum.
So to my Problem now
I am trying for hours without any luck, so before I spend another day resolving the problem without solution, I am trying my luck here
I have an Android Device with rooted Omnirom kitkat that have no internal microphone built in. So I was hoping to connect any sort of usb microphone as default android audio input device that can be used for google voice for example.
I connected a Logitech webcam that has a built in microphone.
The usb audio device of the webcam get well recognized by the OS:
Code:
cat /proc/asound/cards
gives me
Code:
0 [SMDKI2S ]: SMDK-I2S - SMDK-I2S
SMDK-I2S
1 [U0x46d0x819 ]: USB-Audio - USB Device 0x46d:0x819
USB Device 0x46d:0x819 at usb-s5pv210-1.2, high speed
So the hardware device I would like to use, has the number 1 and it's name is U0x46d0x819.
Code:
cat /proc/asound/devices
gives me
Code:
0: [ 0] : control
16: [ 0- 0]: digital audio playback
24: [ 0- 0]: digital audio capture
32: [ 1] : control
33: : timer
56: [ 1- 0]: digital audio capture
So the mic is also detected as digital audio capture.
When I connect the webcam I get in /proc/asound/card1/ the following entries:
id
stream0
usbbus
usbid
usbmixer
usbmixer has the following content (some sort of controls):
Code:
USB Mixer: usb_id=0x046d0819, ctrlif=2, ctlerr=0
Card: USB Device 0x46d:0x819 at usb-s5pv210-1.2, high speed
Unit: 5
Control: name="Mic Capture Volume", index=0
Info: id=5, control=2, cmask=0x0, channels=1, type="S16"
Volume: min=768, max=6912, dBmin=300, dBmax=2700
Unit: 5
Control: name="Mic Capture Switch", index=0
Info: id=5, control=1, cmask=0x0, channels=1, type="INV_BOOLEAN"
Volume: min=0, max=1, dBmin=0, dBmax=0
When connecting the Webcam I get under /dev/snd/ two new devices:
controlC1 and pcmC1D0c
When I try the mic with this app (link) where I can choose the usb audio device to test it, I get cristal clear recording! So it is working from the hardware point of view.
My issue now is how can I get that sound device configured to be the default mic for all apps in android?
I've read that it has to do with asound.conf or audio_policy.conf files in /system/etc, but I have absolutly no idea how they can be configured correctly.
May be it is a very basic question for all the modders and dev gurus out there, so thanks for any help for taking time pointing me to the right direction.:good:
Did you ever get this to work?
I have the same issue.
I created the /system/etc/asound.conf but the Android 4.4-r3 seems to be ignoring the config file.

[Q&A] [ROM] Gohma 2.0 - 12/15/2014 [Android Wear]

Q&A for [ROM] Gohma 2.0 - 12/15/2014 [Android Wear]
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for [ROM] Gohma 2.0 - 12/15/2014 [Android Wear]. If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!
It appears that the vibration and other settings are not active in Gohma 2.0
From my research it seems that the /system/etc/rc.d/01tweaks file never gets to run.
I have been messing around with my watch to find a place to trigger execution of that directory but haven't found one yet.
Where did you put an initialization for it last time?
Alynna said:
It appears that the vibration and other settings are not active in Gohma 2.0
From my research it seems that the /system/etc/rc.d/01tweaks file never gets to run.
I have been messing around with my watch to find a place to trigger execution of that directory but haven't found one yet.
Where did you put an initialization for it last time?
Click to expand...
Click to collapse
I'll have a fix shortly, sorry!
Alynna said:
It appears that the vibration and other settings are not active in Gohma 2.0
From my research it seems that the /system/etc/rc.d/01tweaks file never gets to run.
I have been messing around with my watch to find a place to trigger execution of that directory but haven't found one yet.
Where did you put an initialization for it last time?
Click to expand...
Click to collapse
The init.d/rc.d directories seem to be run from the /system/etc/install-recovery.sh file. Look there and you should see the run-parts command. Which btw okibi, is ingenious, using the stock recovery script to provide init.d support in the face of a kernel that doesn't support it natively.
What software compilation are using Gohma 2.0? I´ve been testing and I have the corrosion problem with a Lg G watch (1,4 volts between pins while being out of the charger), perhaps the base isn´t a "finished-on-Y" compilation?
Nice work, 0 lag everywhere!
Bootloop
While I was running the windows installation to upgrade to 2.0, the program crashed, and the rom is stuck in a bootloop. I can boot into fastboot, and the recovery, but nothing. Any help?
tharrllz said:
While I was running the windows installation to upgrade to 2.0, the program crashed, and the rom is stuck in a bootloop. I can boot into fastboot, and the recovery, but nothing. Any help?
Click to expand...
Click to collapse
http://forum.xda-developers.com/showthread.php?p=54250887
Toolkit should work to get back to stock lollipop.
Still a bug
There is still a little bug in gohma 2.1, but I fixed it in the script.
SOMETHING sets the governor back to userspace/787200 about a minute into the watches' boot.
I logged in and watched it occur.
However the other parameters now stick.
I fixed it with the following:
#!/system/bin/sh
/system/xbin/sysrw
##############################
# BEGIN CUSTOM USER SETTINGS #
##############################
# increase vibration intensity
# default is 80
echo 85 > /sys/class/timed_output/vibrator/amp
# default is 20
echo 175 > /sys/class/timed_output/vibrator/driving_ms
# switch from userspace to ondemand governor
# echo ondemand > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
# echo 787200 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
# Defer change until later, see enforcer below.
GOV=ondemand
FREQ=1094400
# set dpi (default is 240, smaller number means smaller text)
setprop ro.sf.lcd_density 200
##############################
# END CUSTOM USER SETTINGS #
##############################
# improve sd cache
if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]; then
echo 2048 > /sys/devices/virtual/bdi/179:0/read_ahead_kb
fi
# improve block speed
for node in `busybox find /sys -name nr_requests | grep mmcblk`; do echo 1024 > $node; done
# gpu rendering
busybox mv /system/lib/egl/libGLES_android.so /system/lib/egl/libGLES_android.bak
busybox sed -i '/0 0 android/d' /system/lib/egl/egl.cfg
# adjust minfree
echo "0" > /sys/module/lowmemorykiller/parameters/debug_level
echo "2560,4096,6144,12288,14336,18432" > /sys/module/lowmemorykiller/parameters/minfree
# improve file system mounts
busybox mount -o remount,noatime,nodiratime,noauto_da_alloc,data=ordered,nobh,barrier=0 -t auto /
busybox mount -o remount,noatime,nodiratime,noauto_da_alloc,data=ordered,nobh,barrier=0 -t auto /sys
busybox mount -o remount,noatime,nodiratime,nodelalloc,noauto_da_alloc,data=ordered,nobh,barrier=0 -t auto /system
busybox mount -o remount,noatime,nodiratime,nodelalloc,noauto_da_alloc,data=ordered,nobh,barrier=0 -t auto /data
busybox mount -o remount,noatime,nodiratime,nodelalloc,noauto_da_alloc,data=ordered,nobh,barrier=0 -t auto /cache
# improve transitions
if [ -e /data/data/com.android.providers.settings/databases/settings.db ]; then
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update system set value = 0.5 where name = 'transition_animation_scale'"
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update system set value = 0.5 where name = 'animator_duration_scale'"
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update system set value = 1 where name = 'window_animation_scale'"
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update global set value = 0.5 where name = 'transition_animation_scale'"
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update global set value = 0.5 where name = 'animator_duration_scale'"
sqlite3 /data/data/com.android.providers.settings/databases/settings.db "update global set value = 1 where name = 'window_animation_scale'"
fi
# enable sysctl tweaks
busybox sysctl -p /system/etc/sysctl.conf
/system/xbin/sysro
# Wait around for the system to change the governor and change it back, then exit when we're sure its set.
# This function will remain running for a minute to enforce the change, until it's sure the system won't change it back.
enforcer () {
X=0
while [ $X -lt 12 ]; do
if [ ! `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor` = $GOV ]; then
echo $GOV > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
X=0
else
X=$(($X+1))
fi
sleep 5
done
unset X
}
enforcer &
Alynna said:
There is still a little bug in gohma 2.1, but I fixed it in the script.
SOMETHING sets the governor back to userspace/787200 about a minute into the watches' boot.
I logged in and watched it occur.
However the other parameters now stick.
I fixed it with the following:
Click to expand...
Click to collapse
I reinstalled using your additional governer tweak, is there any way to check and make sure its working? Seems to have made a noticeable improvement, it reduces some random lag i was getting with Wear Mini Launcher
myke66 said:
I reinstalled using your additional governer tweak, is there any way to check and make sure its working? Seems to have made a noticeable improvement, it reduces some random lag i was getting with Wear Mini Launcher
Click to expand...
Click to collapse
I log into the phone using:
adb shell
and check that the /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor remains 'ondemand'.
I noticed when I logged in with gohma 2.0 and 2.1, that this would get switched back to 'userspace' after a little less than a minute.
I'm not sure the 01tweaks file was even executed in 2.0. Definitely is executed in 2.1, but, something else in the system was changing the scaling settings back to defaults.
if its not working, the file above will be 'userspace', if it does, it is 'ondemand'.
Also, I have set my default top speed to 1.0ghz which is why wear launcher is probably snappier. This MAY have an impact on battery life, but probably not too much because the watch remains at about 300mhz whenever idle.
You can check /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies for valid values for the FREQ variable. Lower numbers probably mean marginally better battery life.
myke66 said:
I reinstalled using your additional governer tweak, is there any way to check and make sure its working? Seems to have made a noticeable improvement, it reduces some random lag i was getting with Wear Mini Launcher
Click to expand...
Click to collapse
A handy utility that you can sideload on our watch is PerfMon by Chainfire:
http://forum.xda-developers.com/showthread.php?t=1933284
If your frequency fluctuates from 300 to 1190, then you are on ondemand governor.
---------- Post added at 12:19 PM ---------- Previous post was at 11:50 AM ----------
Alynna,
Thanks for the enforcer mod. For some reason after installing your mod, the governor was still on userspace/787200. After playing around I changed sleep from 5 to 10 and now it works great.
:good:
The standard 5.0 ROM version has a new sleep function that turns off the watch display if it hasn't moved for 30 minutes. This is driving me nuts as I always put my watch next to my monitor while I'm working so I have to keep waking it up or I miss notifications.
Is this "feature" in this ROM and if so, is there any way to turn it off or extend the timeout ?
Thanks
i'm looking at the rom and kernel.
the kernel looks like it has more option/tweaks.
i know both dont work together a bit normal cause the rom is a bit the same it are tweaks and no visual changes
i think kernel looks better. in way of functions.
just this rom has also more cpu steps? 300-1.1ghz?
cause if im right stock just is locked on 778mhz? and even with wear control app seems like i can't change it (i mean i don't realy know cant see if power save or balanced governers do any thing). need to check with a app how fast my cpu is running.
This ROM had been great! One question: Does the reset option in the watch settings properly reset and keep gohma tweaks? I tend to flash allot of ROMs on my phone and have been flashing my watch back to stock then each time as well as reflashing gohma. Stock recovery here. See no real reason for custom when everything is done using adb and computer.
Nandrew said:
This ROM had been great! One question: Does the reset option in the watch settings properly reset and keep gohma tweaks? I tend to flash allot of ROMs on my phone and have been flashing my watch back to stock then each time as well as reflashing gohma. Stock recovery here. See no real reason for custom when everything is done using adb and computer.
Click to expand...
Click to collapse
Yup. Just reset between phone ROM flashes.
Any update or thoughts on if we can find a way to make this ROM stop pumping out the 1.74 volts to our wrists via the metal contacts? Just discovered the whole issue of corrosion via the voltage emitted from the watch while being worn. I checked mine, running this ROM, and sure enough: it's live. 1.74 volts of electricity going into your wrist while you wear this thing. LG claims to have sent out a software fix a while back.
Thanks for the development & work on this ROM! Hopefully an "ah-ha" moment can be had and get this issue solved!
To think some people actually pay to have electricity run thru their body.. LG didn't consider it a feature? Lol
No corrosion here.
Gohma 2.2 - NEED DOWNLOAD
Jake's site to download the rom seems to be acting up. The download is extremely slow and keeps failing. I am in desperate need of this excellent ROM!! Does anybody have an alternate download link for Gohma 2.2? Any help is greatly appreciated.
Quick question? Installed 2.2 and everything runs fine except Perfmon only shows one core active. If I run the adb script I can turn the others on but for some reason by default one one core is up after a reboot. Any help.
kwd114kwd114 said:
Quick question? Installed 2.2 and everything runs fine except Perfmon only shows one core active. If I run the adb script I can turn the others on but for some reason by default one one core is up after a reboot. Any help.
Click to expand...
Click to collapse
The 01tweaks script on 2.3 didn't work for me either. Ondemand and frequency are correctly set, but only one core. Couple of workarounds:
1. Set the cores directly using adb commands from your PC.
2. Sideload kernel adiutor from the play store (nice kernel tuner app that works on our watch, dev is active on XDA)
3. Or modify the 01tweaks script to set the cores within the enforcer part of the script (right after $GOV and $FREQ are set)
Code:
# Wait around for the system to change the governor and change it back, then exit when we're sure its set.
# This function will remain running for a minute to enforce the change, until it's sure the system won't change it back.
enforcer () {
X=0
while [ $X -lt 12 ]; do
if [ ! `cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor` = $GOV ]; then
echo $GOV > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo $FREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "1" > /sys/devices/system/cpu/cpu1/online
X=0
else
X=$(($X+1))
fi
sleep 5
done
unset X
}
enforcer &

Solution: Get Rid of Google Voice Search Popping In At Random While Using Headphones

With the latest software update of my Sony Z5P I faced a really annoying issue, which essentially prevents me from listening to the music with the device. Symptoms are as following: during headphones connect or disconnect, or even slight movement of the jack in the audio port, volume randomly goes all way up or down and, the most annoyingly, music pauses and Voice Search is activated. Very frustrating.
I searched for the possible fixes in the Internet and found that there are dozens of posts on various web resources, regarding exactly the same issue. The issue exists on a very broad range of phones, tablets and Android versions. There are a lot of solutions too, generally "Try to install app X" or even "disable Google Search", but nothing worked for me (and probably for majority of users). And I didn't wanted to disable Voice Search, because it's a useful feature.
Looking into the problem further, I discovered that the issue is caused by the wrong detection of a headphones by Android. The system decides that it's not headphones, but a headset, that is the headphones with a mic and hardware buttons to control audio. The system even places an icon to the upper bar and there is a "Headset is plugged in" notification in the drawer.
Due to a hardware difference between connectors of headphones and a headset, every time it is slightly moved in port generates random electric signals which Android mistakenly recognizes as commands from a hardware remote control. If you are listening to the music while walking or especially running, the chances are pretty high, that connector is moving slightly. And the music become constantly interrupted by Voice Assistant or its volume is being decreased or increased. That's really, really disturbing.
One particular useful post which I found was this one. From it I learned there is a /system/usr/keylayout directory in Android filesystem, with files handling hardware buttons. Other useful insight is a link to the small Chris Boyle's app for keypresses debug (he even made a blog post about it). With this knowledge and this small useful tool I started to dig into my phone's system.
Using Key Test app mentioned above I figured out that any slight jack movement generates keypresses with scan codes 226 and 582 (HEADSETHOOK and VOICE_ASSIST) and occasionally 114 and 115 (VOLUME_DOWN and VOLUME_UP). That's what I should find in the system.
At first I should state that to make my solution work, you will need a rooted phone. All dirty hacks need root privileges. For Sony Z5 Premium rooting I assembled a dedicated guide, although it should work with most recent Sony devices. If you have a phone from some other OEM, please search this forum, there are plenty of rooting guides.
Okay, you have a topic problem, your phone is rooted and your adb works. That's how I fixed my phone.
At first you should check contents of your phone's /system/usr/keylayout directory and inspect individual files. It's easier to do on a computer, so copy this folder (maybe with some file manager like ES File Explorer) to your internal or external storage (for example to /sdcard) and then transfer by MTP to the computer (in Windows use File Explorer, the directory is in the This PC\Xperia Z5 Premium Dual folder or something like this).
Once you have keylayout directory on your computer, use some text editor tool which can search multiple text files for a particular text (I use Notepad++, but if you are on a Unix-like OS, you may use grep as well). You should search you files for this text strings:
Code:
HEADSETHOOK
and
Code:
VOICE_ASSIST
On the latest Z5 Premium firmware (Android 6.0.1, build .224) these particular strings were found in the Generic.kl and msm8994-tomtom-snd-card_Button_Jack.kl files. While the former is a generic keymapping file of all Android devices, the latter is specific to Z5P, because of it's name, which suggests that it is somehow related to MSM 8994, which is a partnumber of Qualcomm Snapdragon 810 SoC. In fact, this file is obviously handles headset keypresses, and its contents are:
Code:
key 226 HEADSETHOOK
key 115 VOLUME_UP
key 114 VOLUME_DOWN
key 582 VOICE_ASSIST
key 260 VENDOR_1
Your phone may have file with some other name but contents should be similar. What worked in my case is a changing the codes in this file to some different values which are not used elsewhere. I changed mine to this:
Code:
key 995 HEADSETHOOK
key 996 VOLUME_UP
key 997 VOLUME_DOWN
key 998 VOICE_ASSIST
key 999 VENDOR_1
And that's how I placed modified msm8994-tomtom-snd-card_Button_Jack.kl back into its original place in the phone. This is particularly tricky and you absolutely need rooted phone to do this.
First, place the file into the phone's memory with a guaranteed write access. /sdcard usually is a such place:
Code:
adb.exe push msm8994-tomtom-snd-card_Button_Jack.kl /sdcard/
Then login to the phone's shell and become superuser (root):
Code:
adb.exe shell
[email protected]:/ $ su
[email protected]:/ #
After that make /system mounted as a read/write filesystem:
Code:
[email protected]:/ # mount -o remount,rw /system
And copy the modified file back in place. After that reboot:
Code:
root[email protected]:/ # cp /sdcard/msm8994-tomtom-snd-card_Button_Jack.kl /system/usr/keylayout/
[email protected]:/ # reboot
Once the file was updated and the phone rebooted, I checked keypresses with Key Test again. These keypresses were generated as before, with the same scan codes, but this time key codes were registered as KEYCODE_UNKNOWN and did not any harm. The system cannot recognize them and doesn't react to them in any sensible way.
That's it. Be informed, that if you plan to use a real headset, with this hack its keys will not work at all.
tl;dr
- Enable ADB and root access for ADB
- In ADB shell:
Code:
$ su
# mount -o remount,rw /system
# sed -i "s/\(key.*HEADSETHOOK\)/#\1/g" /system/usr/keylayout/Generic.kl
# sed -i "s/\(key.*VOICE_ASSIST\)/#\1/g" /system/usr/keylayout/Generic.kl
# reboot

Question Managing battery charge

Hello!
My Nord 2 will be plugged in 24/7 because I use it for E2E testing. I need to optimize battery so it wont swell up.
Is there any working solutions for doing it? Or is there a way to put battery charging to idle so main power will be drawn from usb.
I tried Magisk ACC plugin, but it seems it is not running. Shell has supperuser power on magisk
ADB shell:
"acc
/system/bin/sh: <stdin>[2]: acc: inaccessible or not found
accd,
/system/bin/sh: <stdin>[3]: accd,: inaccessible or not found"
Also same error in ACC app, magisk have given supperuser access for that app:
"/system/bin/sh: <stdin>[3544]: acc: inaccessible or not found"
when i execut acc.sh in /data/adb/vr25/acc/ folder then i cant get ACCD running there. Well it runs for a minut then turns off
"
Advanced Charging Controller v2021.8.31 (202108310)
Copyright 2017-2021, VR25
GPLv3+
(i) accd is not running
1) Language
2) All commands
3) Documentation
4) Start/restart daemon
5) Stop daemon
6) Export logs
7) Charge once to #%
8) Uninstall
9) Edit config.txt
a) Reset battery stats
b) Test charging switches
c) Check for update
d) Flash zips
e) Battery info
f) Exit
#? b
(!) Charger must be plugged to continue...
(i) Alright, this may take a minute or so...
(!) [/proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0] won't work
(i) Press any key to continue..."
Hi, I'm the developer of acc.
Have you tried a slow charger or USB charging?
Refer to README > Troubleshooting.
This is a kernel/adapter issue.
Edit
Just noticed that you're not using the latest acc release.
Since you're facing issues, upgrading is a must.
Regardless, don't skip the documentation.
I am using PC USB connection for charging. Should ACC daemon allways run? It works for a minute and then stop. Do you mean oneplus nord 2 battery charging management have same kernel issue as you mentioned in ACC thread?
I have tested different versions to be sure. v2021.8.31 came from Magisk for first.
AccA is latest 1.0.35 Daemon/API 202109200
New ver.:
Advanced Charging Controller v2021.9.20 (202109200)
Copyright 2017-2021, VR25
GPLv3+
(i) accd is not running (PID 12046)
1) Language
2) All commands
3) Documentation
4) Start/restart daemon
5) Stop daemon
6) Export logs
7) Charge once to #%
8) Uninstall
9) Edit config.txt
a) Reset battery stats
b) Test charging switches
c) Check for update
d) Flash zips
e) Battery info
f) Undo upgrade
g) Exit
#? b
(!) Charger must be plugged to continue...
(i) Alright, this may take a minute or so...
(!) [/proc/mtk_battery_cmd/current_cmd 0::0 0::1 /proc/mtk_battery_cmd/en_power_path 1 0] won't work
This is usually a kernel and/or power adapter issue.
The daemon should be running to control charging.
The #1 reason for it to stop is total charging switch failure.
That is, all charging switches fail to respond.
In that case, it finds no reason to keep running.
Share a log archive (acc -le) and the output of acc -p.
Where can i get those logs? From /data/adb/vr25/acc-data/logs/ ? Might it be acc-logs-OP515BL1.tar.gz file?
Somehow "pull" and "cp" are not working on me with adb shell. Is there any better tools for pulling files and logs? There is many tools witch are not working with my phones and cant find root folders, google is to big.
@VR25 Hi! I attached all logs from ACC-data logs folder. Will it help?
CapnRene said:
@VR25 Hi! I attached all logs from ACC-data logs folder. Will it help?
Click to expand...
Click to collapse
Perfect!
I found potential charging switches.
Test the following commands one by one and report the ones that work:
su -c acc -t /sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0
su -c acc -t /sys/devices/platform/charger/enable_sc 0 1
su -c acc -t /sys/devices/platform/charger/enable_sc 1 0
su -c acc -t /sys/devices/virtual/oplus_chg/battery/stop_charging_enable 0 1
su -c acc -t /sys/firmware/devicetree/base/charger/usb_charger_current_suspend 0 1
Note
One/some of the commands may trigger a reboot.
That's not a big deal. Just move to the next on the list.
First line got response:
OP515BL1:/ # su -c acc -t /sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0
(!) Charger must be plugged to continue...
(i) Alright, this may take a minute or so...
(i) [/sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0] works
- battIdleMode=true
As i understand i need to change switch now to get it working?
su -c acc -s s="/sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0"
You should be all set after running that.
The next release will include the new switch.
Edit
Since the device will be plugged in 24/7, you may want to run `acc 3920` to set it up.
Essentially, this will keep the battery voltage between 3870-3920 millivolts.
3920 is said to be the sweet spot for longevity.
Not 100% sure did it work, need to test it a litte to be sure. It seems it updated log
OP515BL1:/ # su -c acc -s s="/sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0"
/system/bin/acc[580]: export: 1: is not an identifier
(i) Alright, this may take a minute or so...
(i) /data/adb/vr25/acc-data/logs/acc-logs-OP515BL1.tar.gz
My bad
It should have been
su
acc -s s="/sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0"
VR25 said:
My bad
It should have been
su
acc -s s="/sys/devices/virtual/oplus_chg/battery/mmi_charging_enable 1 0"
Click to expand...
Click to collapse
It worked! Ty! I set my swich to turn on 59% and off 60% for optimal ressult.
It seems that those are not working or maybe i have made some mistake somewhere:
shutdown capacity
charge current
charge voltage
CapnRene said:
It worked! Ty! I set my swich to turn on 59% and off 60% for optimal ressult.
It seems that those are not working or maybe i have made some mistake somewhere:
shutdown capacity
charge current
charge voltage
Click to expand...
Click to collapse
From the documentation:
# shutdown_capacity (sc) #
# When the battery is discharging and its capacity/voltage_now_millivolts <= sc and phone has been running for 15 minutes or more, acc daemon turns the phone off to reduce the discharge rate and protect the battery from potential damage induced by voltage below the operating range.
# sc=-1 disables it.
# [Beta] if the file /data/adb/vr25/acc-data/warn exists, accd posts Android shutdown warning notifications at sc + 5% or sc + 200 mV.
The last two features are not supported by all devices.
I'm yet to see a MediaTek device that supports at least one of the those.
Please ask further questions in the actual forum, so that other users can help you whenever I'm unavailable.

Categories

Resources