Using ADB to mute on and off microphone during call - adb

I can call using below command to make a call:
"**adb shell am start -a android.intent.action.CALL 0000000000**"
and during the call, tried to mute and unmute microphone using the command:
"adb shell am start -a android.media.action.MICROPHONE_MUTE_CHANGED"
But, I got an error message that
"Error: Activity not started, unable to resolve Intent { act=android.media.action.MICROPHONE_MUTE_CHANGED flg=0x10000000 }"
Can I know how to fix it?

Related

Access user keyring from systemd hook or crontab

I'm trying to implement a systemd hook (systemd-sleep) to connect and disconnect from protonvpn. However, these scripts are executed as root and do not have access to the keyring. The backend is kwallet, since I am on fedora-kde plasma. When I execute protonvpn-cli c --sc, I get the following error:
[...] keyring_data_user = ExecutionEnvironment().keyring[ File "/usr/lib/python3.10/site-packages/protonvpn_nm_lib/core/keyring/linuxkeyring.py", line 32, in __getitem__ raise exceptions.KeyringError(e) protonvpn_nm_lib.exceptions.KeyringError: Environment variable DBUS_SESSION_BUS_ADDRESS is unset
I tried several things, none of them worked:
run sudo -E -u myuser protonvpn-cli c --sc, or replacing -E by -i, or none.
importing the DBUS session of myuser (who is currently logged ir and has kwallet opened). In this case, I get the error [...] bus = secretstorage.dbus_init() File "/usr/lib/python3.10/site-packages/secretstorage/__init__.py", line 80, in dbus_init raise SecretServiceNotAvailableException(str(ex)) from ex secretstorage.exceptions.SecretServiceNotAvailableException: [Errno 32] Broken pipe
I tried systemd --user services, but I've found no way to link this service to the suspend.target, or hibernate.target, since they are system targets and are executed on separate process.
Is there a way give access the an already opened kwallet to this hook script?

In shake-build, how to run a command with a pipe in it?

I can't seem to get the following to work in shake:
cmd_ (AddEnv "PGPASSWORD" "REDACTED") "bzcat /tmp/db.sql.bz2 | psql -U pguser -h localhost dbname"
In Shake, the cmd function and variants spawn processes directly by default. The pipe syntax is only available as part of the OS's shell functionality. To ask Shake to spawn things using the shell add the argument Shell.

How to get a response with an AT command via ADB?

I was doing what suggested here: Sending AT Commands Via ADB Android
So after I rooted my Samsung S5, I found my modem with this command: getprop rild.libargs and I got this result: -d /dev/smd0
Then I typed into my adb shell: echo -c "AT\r\n" > /dev/smd0
But nothing is returned.
I don't understand, any idea ?
I also tried other commands like: AT+CREG or AT+COPS=?, still nothing.

PuTTY command line automate serial commands from file

I am trying to connect to a serial port and send a series of commands from a file.
Firstly I have mananged to connect via the following:
PuTTY.exe -serial COM3 -sercfg 57600,8,n,1,N
E.g. I have a file called commands.txt with a series of serial commands I wished to be sent.
I tried the following however it failed to work:
PuTTY.exe -serial COM3 -sercfg 57600,8,n,1,N -m commands.txt
Any help is greatly appreciated.
Try like this :
for /f "delims=" %%a in ('type commands.txt') do PuTTY.exe -serial COM3 -sercfg 57600,8,n,1,N -m %%a
Another solution which I have used to regularly send commands to a device uses a combination of PuTTY and Autohotkey.
For the initial setup, configure a PuTTY session and save it. In my case I named is Oasis.
The following Autohotkey function can send a command to the already open PuTTY session. If PuTTY is not open it will start the saved session. oasis_putty_name() is the name of the PuTTY window once it's open, it will depend on the COM port selected. location_putty() is the location of the PuTTY executable. Both of these can be hard coded but I wanted to keep the variables separate from the functions.
; Oasis Check --------------------------------------------------
oasis_check(){
putty_name := oasis_putty_name()
; Start PuTTY if it's not already running
IfWinNotExist, %putty_name%
{
putty := location_putty()
Run %putty% -load Oasis
Sleep,1000
}
; Format Time Stamp
FormatTime, TimeString,,yyyy-MM-dd HH-mm-ss
; Record Oasis Values
ControlSend, , %TimeString%{ENTER}, %putty_name%
Sleep, 2000
ControlSend, , all?{ENTER}, %putty_name%
}
The frequency of execution can be controlled with another Autohotkey script or, as in my case, with the Windows Task Manager.

Application crashes only when launched from inittab on busybox

I'm writing an application for an embedded busybox system that allows TCP connections, then sends out messages to all connected clients. It works perfectly when I telnet to the box and run the application from a shell prompt, but I have problems when it is launched from the inittab. It will launch and I can connect to the application with one client. It successfully sends one message out to that client, then crashes. It will also crash if I connect a second client before any messages are sent out. Again, everything works perfectly if I launch it from a shell prompt instead.
The following errors are what comes up in the log:
<11>Jan 1 00:02:49 tmmpd.bin: ERROR: recvMessage failed, recv IO error
<11>Jan 1 00:02:49 tmmpd.bin: Some other LTK TCP error 103. Closing connection 10
<11>Jan 1 00:02:49 tmmpd.bin: ERROR: recvMessage failed, recv IO error
<11>Jan 1 00:02:49 tmmpd.bin: Some other LTK TCP error 103. Closing connection 10
Any suggestions would be greatly appreciated!
I was testing a bit in arm-qemu and busybox, and I was able to start a script as user test to run in background.
I have created a new user "test":
buildroot-dir> cat etc/passwd
test:x:1000:1000:Linux User,,,:/home/test:/bin/sh
Created a simple testscript.sh:
target_system> cat /home/test/testscript.sh
#!/bin/sh
while :
do
echo "still executing in bg"
sleep 10
done
To my /etc/init.d/rcS I added a startup command for it:
#!/bin/sh
mount -t proc none /proc
mount -t sysfs none /sys
/sbin/mdev -s
/bin/su test -c /home/test/testscript.sh& # < Added this
Now when I start the system, the script will run in the background, and when I grep for the process it has been started as user test (default root user is just 0):
target_system> ps aux | grep testscript
496 test 0:00 sh -c home/test/testscript.sh
507 test 0:00 {testscript.sh} /bin/sh home/test/testscript.sh

Resources