Need hardware info - Atrix 4G Android Development

Good day!
I'm need some logs for extracting hardware info:
1. lsusb -v when Astrix is plugged (three logs: in normal mode, in ADB mode, in bootloader mode)
2. From the phone:
Code:
dmesg > dmesg.log
cat /proc/iomem > iomem.log
cat /proc/devices > devices.log
cat /proc/interrupts > interrupts.log
cat /proc/bootinfo > bootinfo.log
cat /proc/cpuinfo > cpuinfo.log
cat /proc/timer_list > timerlist.log
cat /proc/mtd > mtd.log

Related

M7 Usb modes from adb

These are different usb modes you can force from a adb shell (needs root)
This is just a fyi for information.
echo 1 > /sys/devices/virtual/android_usb/android0/f_diag/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_diag_mdm/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_rndis/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_modem/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_serial/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_acm/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_ccid/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_accessory/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_adb/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_audio_source/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_cdc_ethernet/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_cdc_network/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_mass_storage/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_mtp/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_projector/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_projector2/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_ptp/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_rmnet/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_rmnet_sdio/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_rmnet_smd/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_rmnet_smd_sdio/on
echo 1 > /sys/devices/virtual/android_usb/android0/f_rmnet/on
cdc_ether
Hi I am trying to connect a cdc_ether device into the LG Nexus5 usb port. I have cross compiled kernel for 3.4.0 hammerhead for this devices and enabled the cdc_ether module on it. But when I looked at the /sys/devices/virtual/android_usb/android0/f_cdc_ethernet/on, the f_cdc_ethernet directory doesnt exist. Does that mean the kernel was compiled wrong?

Need help with enabling Diag port on Z3+ (E6553) with zROM v1.1

Hi all,
I have unlocked bootloader and flashed zROM v1.1 so I got root. I want to enable Diag port to connect phone to the QXDM. Here is what i know.
Most important files are /init.usbmode.sh and /init.usbmode.platform.sh:
/init.usbmode.sh:
-disables USB and writes VendorID
Code:
echo 0 > /sys/class/android_usb/android0/enable
echo ${VENDOR_ID} > /sys/class/android_usb/android0/idVendor
-it setups engineering port with /init.usbmode.platform.sh if "getprop perist.usb.eng" is set to 1
-writes PID and USB FUNCTION
Code:
echo ${PID} > /sys/class/android_usb/android0/idProduct
echo ${USB_FUNCTION} > /sys/class/android_usb/android0/functions
-enables USB
Code:
echo 1 > /sys/class/android_usb/android0/enable
/init.usbmode.platform.sh:
Code:
setup_engmode()
{
PID_PREFIX=0
SUPPORT_RMNET=1
case ${1} in
"mass_storage,adb") PID_PREFIX=6 ;;
"mtp,adb") PID_PREFIX=5 ;;
"rndis,adb")
PID_PREFIX=D
SUPPORT_RMNET=0
;;
*)
/system/bin/log -t ${TAG} -p i "No eng PID for: ${1}"
exit 1
;;
esac
PID=${PID_PREFIX}146
USB_FUNCTION=${1},serial,diag
echo diag > /sys/class/android_usb/android0/f_diag/clients
echo smd,tty > /sys/class/android_usb/android0/f_serial/transports
if [ ${SUPPORT_RMNET} -eq 1 ] ; then
USB_FUNCTION=${USB_FUNCTION},rmnet
echo qti,bam2bam_ipa > /sys/class/android_usb/android0/f_rmnet/transports
fi
echo "${PID} ${USB_FUNCTION}"
exit 0
}
set_rndis_qc()
{
(...)
}
case ${1} in
"eng_setup")
if [ $# -ne 2 ] ; then
exit 1
fi
setup_engmode ${2}
;;
"set_rndis_qc")
set_rndis_qc
exit 0
;;
esac
-returns PID and USB_FUNCTION to /init.usbmode.sh, By default phone has USB_FUNCTION set to "mtp,adb" so there should be PID=5146 and USB_FUNCTION=mtp,adb,serial,diag,rmnet
-echoes
Code:
echo diag > /sys/class/android_usb/android0/f_diag/clients
echo qti,bam2bam_ipa > /sys/class/android_usb/android0/f_rmnet/transports
The main issue is that "getprop perist.usb.eng" doesn't exist.
As you know this Android runs on SE Linux. In /property_contexts file we can find following lines:
Code:
#line 1 "vendor/semc/system/sepolicy/Bootstrap_Applications/1.0.0/usbeng/property_contexts"
persist.usb.eng u:object_r:usb_eng_prop:s0
sys.usb.diag_mode u:object_r:usb_diag_mode_prop:s0
persist.sys.usb.config u:object_r:usb_config_prop:s0
persist.service.adb.enable u:object_r:usb_adb_enable_prop:s0
Only "persist.sys.usb.config " is visible in getprop command. This custom ROM has script located in /system/su.d/permissive.sh which enables permissive mode on SE Linux:
Code:
#!/system/bin/sh
/system/bin/setenforce 0
So in theory restrictions to the file types and process domains should not operate. Correct me if I am wrong.
Also there is a file /system/bin/usbeng which should be stared as a service by /init.sony.usb.rc
Code:
#Start usbeng
service usbeng /system/bin/usbeng
user system
group system
class late_start
oneshot
But it can't be seen in services list or process list. Also "getprop init.svc.usbeng" says it is "stopped". We can find SE Linux properties of this file in /file_contexts:
Code:
#line 1 "vendor/semc/system/sepolicy/Bootstrap_Applications/1.0.0/usbeng/file_contexts"
/system/bin/usbeng u:object_r:usbeng_exec:s0
I have tried echoing mentioned lines with a script:
Code:
echo 0 > /sys/class/android_usb/android0/enable
echo diag > /sys/class/android_usb/android0/f_diag/clients
echo qti,bam2bam_ipa > /sys/class/android_usb/android0/f_rmnet/transports
echo 5146 > /sys/class/android_usb/android0/idProduct
echo mtp,adb,serial,diag,rmnet > /sys/class/android_usb/android0/functions
echo 1 > /sys/class/android_usb/android0/enable
But last line seems to fail and USB doesn't get enabled and reboot is needed.
Seems that SE Linux is one of main reasons that Diag port can't be enabled. In effect there is lack of "persist.usb.eng" "sys.usb.diag_mode" in "getprop" command and "usbeng" service. Here comes question to you guys. Do you have idea how to enable mentioned properties and service? I will very appreciate any help or information that will help me enabling Diag port.
Best regards,
Piotr
solution?
did you find the solution, i need the same?
same here, i'm xperia z3 user

What's the fastest ROM to date?

Finally got a new battery after over a year of not using my Droid 4.
Flashed latest CM13 nightly, 1.4ghz OC. Everything seems slow.
My 512mb ram single core $19 cheapo runs smoother.
Anything I do has a half-second or so delay, clean install with nothing running in the background.
Ideally I would just go back to some minimal 2.3.7 ROM, but compatiblity for new programs is getting iffy.
So, as of 2016, what has the smoothest ROM to do date been?
azkay said:
Finally got a new battery after over a year of not using my Droid 4.
Flashed latest CM13 nightly, 1.4ghz OC. Everything seems slow.
My 512mb ram single core $19 cheapo runs smoother.
Anything I do has a half-second or so delay, clean install with nothing running in the background.
Ideally I would just go back to some minimal 2.3.7 ROM, but compatiblity for new programs is getting iffy.
So, as of 2016, what has the smoothest ROM to do date been?
Click to expand...
Click to collapse
I'm running very, very debloated, overclocked stock JB 4.1.2 with Greenify and ram manager and it works pretty well. Even most of new games and emulators rund good.
Cyanogenmod 11 is quite good. One thing I noticed is that the virtual ROM slots are extremely slow, due to the loopback devices.
One way to go is to install the ROM to the virtual ROM slots to test if they are working correctly and then install it into stock slot for real use.
Up, same question here
I use cm11 or cm12 (i find cm13 extremely slow) But with the following tweaks made from my daily experience feel free to try it
Add those lines on boot
swapoff /dev/block/zram0
echo 1 > /sys/block/zram0/reset
#
# setting zram size to 140 mb
echo 396286400 > /sys/block/zram0/disksize
#
# making zram swapable
mkswap /dev/block/zram0
#
# starting swap on zram
swapon /dev/block/zram0
sysctl -w vm.overcommit_ratio=2
sysctl -w vm.swappiness=100
sysctl -w vm.vfs_cache_pressure=70
swapoff /dev/block/zram0
swapon /dev/block/zram0
echo "0" > /sys/kernel/mm/ksm/run
chmod 755 /sys/kernel/dyn_fsync/Dyn_fsync_active
echo "1" > /sys/kernel/dyn_fsync/Dyn_fsync_active
#----------------------------------I/O------------------------------------
A=`ls -d /sys/block/mmcblk1` ;
B=`ls -d /sys/block/mmcblk0` ;
C=`ls -d /sys/block/mmcblk0/mmcblk0boot0` ;
D=`ls -d /sys/block/mmcblk0/mmcblk0boot1` ;
E=`ls -d /sys/block/mmcblk1/mmcblk0boot0` ;
F=`ls -d /sys/block/mmcblk1/mmcblk0boot1` ;
for i in $A $B $C $D $E $F;
do
chmod 755 $i/queue/scheduler
echo "sioplus" > $i/queue/scheduler
echo "16" > $i/queue/iosched/fifo_batch;
echo "1048576" > $i/queue/iosched/back_seek_max;
echo "128" > $i/queue/nr_requests;
echo "1" > $i/queue/add_random;
echo "1" > $i/queue/iosched/back_seek_penalty;
echo "1" > $i/queue/rq_affinity;
echo "3" > $i/queue/iosched/writes_starved;
echo "16" > $i/queue/iosched/quantum;
echo "0" > $i/queue/rotational
echo "1" > $i/queue/iostats
echo "500" > $i/queue/iosched/read_expire;
echo "3000" > $i/queue/iosched/write_expire;
#---------------------------ReadAhead------------------------------
echo "512" > /sys/devices/virtual/bdi/179:24/read_ahead_kb #SD CARD
done
G=`ls -d /sys/class/bdi/7:0` ;
H=`ls -d /sys/class/bdi/7:1` ;
I=`ls -d /sys/class/bdi/7:2` ;
J=`ls -d /sys/class/bdi/7:3` ;
L=`ls -d /sys/class/bdi/7:4` ;
M=`ls -d /sys/class/bdi/default` ;
N=`ls -d /sys/class/bdi/7:5` ;
O=`ls -d /sys/class/bdi/7:6` ;
P=`ls -d /sys/class/bdi/7:7` ;
for i in $G $H $I $J $L $M $N $O $P;
do
chmod 755 $i/read_ahead_kb
echo "512" > $i/read_ahead_kb
echo "512" > /sys/class/bdi/default/read_ahead_kb
done
echo "512" > /sys/class/bdi/253:0/read_ahead_kb
#----------------------------------I/O--FOR SD AND INTERNAL----------------------------------
AA=`ls -d /sys/block/mmcblk1` ;
BB=`ls -d /sys/block/mmcblk0` ;
for i in $AA $BB;
do
chmod 755 $i/queue/scheduler
echo "sioplus" > $i/queue/scheduler
echo "0" > $i/queue/rotational
echo "16" > $i/queue/iosched/quantum;
echo "1048576" > $i/queue/iosched/back_seek_max;
echo "1" > $i/queue/rq_affinity;
echo "1" > $i/queue/iosched/back_seek_penalty;
echo "256" > $i/queue/nr_requests;
echo "1" > $i/queue/add_random;
echo "16" > $i/queue/iosched/fifo_batch;
echo "3" > $i/queue/iosched/writes_starved;
#echo "1" > $i/queue/iosched/quantum;
echo "1" > $i/queue/iostats
echo "500" > $i/queue/iosched/read_expire;
echo "3000" > $i/queue/iosched/write_expire;
done
sysctl -w kernel.panic_on_oops=0
#sysctl -w vm.min_free_kbytes=3774
sysctl -w vm.vfs_cache_pressure=70
sysctl -w vm.swappiness=100
sysctl -w vm.drop_caches=0
sysctl -w vm.min_free_kbytes=3774
sysctl -w vm.page-cluster=3
#setsd speeds
chmod 666 /sys/block/mmcblk0/queue/read_ahead_kb
echo "512" > /sys/block/mmcblk0/queue/read_ahead_kb
chmod 666 /sys/block/mmcblk1/queue/read_ahead_kb
echo "512" > /sys/block/mmcblk1/queue/read_ahead_kb
chmod 666 /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
######sd card
chmod 666 /sys/devices/virtual/bdi/179:24/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:24/read_ahead_kb
chmod 666 /sys/devices/virtual/bdi/179:16/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:16/read_ahead_kb
chmod 666 /sys/devices/virtual/bdi/179:8/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:8/read_ahead_kb
chmod 666 /sys/devices/virtual/bdi/179:32/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:32/read_ahead_kb
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "1300000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "1200000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo "1300000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo "1200000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo 2 > /sys/devices/system/cpu/cpufreq/interactive/boost
echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
echo 70 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo 300000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo 15000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo 60 > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
echo 30000 > /sys/devices/system/cpu/cpufreq/interactive/timer_slack
chmod 666 /sys/module/lowmemorykiller/parameters/minfree
echo '7936,16384,37120,57088,58880,65536' > /sys/module/lowmemorykiller/parameters/minfree
giannhs_n said:
I use cm11 or cm12 (i find cm13 extremely slow) But with the following tweaks made from my daily experience feel free to try it
Add those lines on boot
Click to expand...
Click to collapse
Thank you man, this script made my droid 4 a whole lot more responsive and it does not reboot every few hours anymore.
Quite a few commands in that script don't work, probably due to different paths (sio plus as io scheduler and stock rom boot slot), but those that work, really seem to help a lot.
Oh and you should update the comment in that script about the zram size.
Milp said:
Thank you man, this script made my droid 4 a whole lot more responsive and it does not reboot every few hours anymore.
Quite a few commands in that script don't work, probably due to different paths (sio plus as io scheduler and stock rom boot slot), but those that work, really seem to help a lot.
Oh and you should update the comment in that script about the zram size.
Click to expand...
Click to collapse
Was testing on different Kernels that's why the paths are wrong.. Please replace the sio plus with cfq or bfq (i forgot to change that)
I am glad that those tweaks help you
Regards john
What about this one? Mentor's ROM http://forum.xda-developers.com/showthread.php?t=2122709
That's what I found on my used Droid 4... should I give it a try?
giannhs_n said:
Was testing on different Kernels that's why the paths are wrong.. Please replace the sio plus with cfq or bfq (i forgot to change that)
I am glad that those tweaks help you
Regards john
Click to expand...
Click to collapse
why replace sio plus? I used bfq before, but when i googled for sio plus i only found people saying that sio plus was the best of them all.
Milp said:
why replace sio plus? I used bfq before, but when i googled for sio plus i only found people saying that sio plus was the best of them all.
Click to expand...
Click to collapse
If your kernel support sio plus, of course use it.. else cfq or bfq is a good alternative
giannhs_n said:
I use cm11 or cm12 (i find cm13 extremely slow) But with the following tweaks made from my daily experience feel free to try it
Add those lines on boot
swapoff /dev/block/zram0
echo 1 > /sys/block/zram0/reset
#
# setting zram size to 140 mb
echo 396286400 > /sys/block/zram0/disksize
#
# making zram swapable
mkswap /dev/block/zram0
#
# starting swap on zram
swapon /dev/block/zram0
sysctl -w vm.overcommit_ratio=2
sysctl -w vm.swappiness=100
sysctl -w vm.vfs_cache_pressure=70
swapoff /dev/block/zram0
swapon /dev/block/zram0
echo "0" > /sys/kernel/mm/ksm/run
chmod 755 /sys/kernel/dyn_fsync/Dyn_fsync_active
echo "1" > /sys/kernel/dyn_fsync/Dyn_fsync_active
#----------------------------------I/O------------------------------------
A=`ls -d /sys/block/mmcblk1` ;
B=`ls -d /sys/block/mmcblk0` ;
C=`ls -d /sys/block/mmcblk0/mmcblk0boot0` ;
D=`ls -d /sys/block/mmcblk0/mmcblk0boot1` ;
E=`ls -d /sys/block/mmcblk1/mmcblk0boot0` ;
F=`ls -d /sys/block/mmcblk1/mmcblk0boot1` ;
for i in $A $B $C $D $E $F;
do
chmod 755 $i/queue/scheduler
echo "sioplus" > $i/queue/scheduler
echo "16" > $i/queue/iosched/fifo_batch;
echo "1048576" > $i/queue/iosched/back_seek_max;
echo "128" > $i/queue/nr_requests;
echo "1" > $i/queue/add_random;
echo "1" > $i/queue/iosched/back_seek_penalty;
echo "1" > $i/queue/rq_affinity;
echo "3" > $i/queue/iosched/writes_starved;
echo "16" > $i/queue/iosched/quantum;
echo "0" > $i/queue/rotational
echo "1" > $i/queue/iostats
echo "500" > $i/queue/iosched/read_expire;
echo "3000" > $i/queue/iosched/write_expire;
#---------------------------ReadAhead------------------------------
echo "512" > /sys/devices/virtual/bdi/179:24/read_ahead_kb #SD CARD
done
G=`ls -d /sys/class/bdi/7:0` ;
H=`ls -d /sys/class/bdi/7:1` ;
I=`ls -d /sys/class/bdi/7:2` ;
J=`ls -d /sys/class/bdi/7:3` ;
L=`ls -d /sys/class/bdi/7:4` ;
M=`ls -d /sys/class/bdi/default` ;
N=`ls -d /sys/class/bdi/7:5` ;
O=`ls -d /sys/class/bdi/7:6` ;
P=`ls -d /sys/class/bdi/7:7` ;
for i in $G $H $I $J $L $M $N $O $P;
do
chmod 755 $i/read_ahead_kb
echo "512" > $i/read_ahead_kb
echo "512" > /sys/class/bdi/default/read_ahead_kb
done
echo "512" > /sys/class/bdi/253:0/read_ahead_kb
#----------------------------------I/O--FOR SD AND INTERNAL----------------------------------
AA=`ls -d /sys/block/mmcblk1` ;
BB=`ls -d /sys/block/mmcblk0` ;
for i in $AA $BB;
do
chmod 755 $i/queue/scheduler
echo "sioplus" > $i/queue/scheduler
echo "0" > $i/queue/rotational
echo "16" > $i/queue/iosched/quantum;
echo "1048576" > $i/queue/iosched/back_seek_max;
echo "1" > $i/queue/rq_affinity;
echo "1" > $i/queue/iosched/back_seek_penalty;
echo "256" > $i/queue/nr_requests;
echo "1" > $i/queue/add_random;
echo "16" > $i/queue/iosched/fifo_batch;
echo "3" > $i/queue/iosched/writes_starved;
#echo "1" > $i/queue/iosched/quantum;
echo "1" > $i/queue/iostats
echo "500" > $i/queue/iosched/read_expire;
echo "3000" > $i/queue/iosched/write_expire;
done
sysctl -w kernel.panic_on_oops=0
#sysctl -w vm.min_free_kbytes=3774
sysctl -w vm.vfs_cache_pressure=70
sysctl -w vm.swappiness=100
sysctl -w vm.drop_caches=0
sysctl -w vm.min_free_kbytes=3774
sysctl -w vm.page-cluster=3
#setsd speeds
chmod 666 /sys/block/mmcblk0/queue/read_ahead_kb
echo "512" > /sys/block/mmcblk0/queue/read_ahead_kb
chmod 666 /sys/block/mmcblk1/queue/read_ahead_kb
echo "512" > /sys/block/mmcblk1/queue/read_ahead_kb
chmod 666 /sys/devices/virtual/bdi/179:0/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:0/read_ahead_kb
######sd card
chmod 666 /sys/devices/virtual/bdi/179:24/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:24/read_ahead_kb
chmod 666 /sys/devices/virtual/bdi/179:16/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:16/read_ahead_kb
chmod 666 /sys/devices/virtual/bdi/179:8/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:8/read_ahead_kb
chmod 666 /sys/devices/virtual/bdi/179:32/read_ahead_kb
echo "512" > /sys/devices/virtual/bdi/179:32/read_ahead_kb
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo "1300000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
chmod 666 /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
echo "1200000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo "interactive" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo "1300000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
chmod 666 /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo "1200000" > /sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq
echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo 2 > /sys/devices/system/cpu/cpufreq/interactive/boost
echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/boostpulse_duration
echo 70 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo 300000 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo 15000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo 60 > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 20000 > /sys/devices/system/cpu/cpufreq/interactive/timer_rate
echo 30000 > /sys/devices/system/cpu/cpufreq/interactive/timer_slack
chmod 666 /sys/module/lowmemorykiller/parameters/minfree
echo '7936,16384,37120,57088,58880,65536' > /sys/module/lowmemorykiller/parameters/minfree
Click to expand...
Click to collapse
What am I supposed to do with these lines? And can somebody please explain what they are doing specifically?
I was trying to find a way to enable zram to cope with the small amount of memory. swap ram is an alternative, but i heard zram is faster and not stressing the storage like swap ram would.

Badly made antivirus script I created

Bash:
#This script is satire. This is, like, the worst antivirus ever.
tput setaf 2
echo "Welcome to Web Antivirus."
echo "Make sure you are running this from a live Linux image as the root user."
lsblk
echo "Select your Windows drive: "
read drive
mount $drive /mnt
cd /mnt/Windows/system32/etc
wget https://github.com/T145/black-mirror/releases/download/latest/black_domain.txt >> /dev/null
wget https://github.com/T145/black-mirror/releases/download/latest/black_ipv4.txt >> /dev/null
echo "Downloaded blacklists."
cp hosts.txt hosts.txt.bak
mawk '{print "0.0.0.0 " $0}' black_domain.txt >> hosts.txt
echo "Wrote domain blacklist."
mawk '{print "0.0.0.0 " $0}' black_ipv4.txt >> hosts.txt
echo "Wrote IPv4 blacklist"
rm -f black_domain.txt black_ipv4.txt
echo "Deleted temporary files."
cd /mnt
echo "@echo off" > clean.bat
echo "del %userprofile%\\Downloads\\*.exe" >> clean.bat
echo "Created cleaner script."
echo "Put this in Task Scheduler so it runs at regular intervals."
echo "Options:"
echo "Type \"restore\" to restore original /etc/hosts."
echo "Type \"exit\" to leave."
echo "Select an option: "
alias restore="rm -f hosts.txt && mv hosts.txt.bak hosts.txt"
read option
$option

How To Guide How to configure the WiFI in Android via script

In the current version of Android the WiFi configuration is stored in the file
/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
e.g.
Code:
ASUS_I006D:/ # ls -lZtr /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
-rw------- 1 system system u:object_r:apex_system_server_data_file:s0 4884 2023-01-29 08:55 /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
ASUS_I006D:/ #
The file is in plain ASCII xml format so it can be processed by any executable to change text files (editor, sed, etc).
But IMHO it's better to configure the WiFi manually via GUI and then use the file WifiConfigStore.xml with that configuration for configuring the WiFi via script. Therefor I use this code in the post install script to install and configure my phone (see How to install and configure the Android OS via Script):
Spoiler: script commands to enable and configure WiFi
Bash:
#
# sample post install script for the customizing of the phone
#
# This script will be copied to the phone and executed there
#
# The script is executed by the user shell; use "su - -c <command>" to execute commands as user root
#
echo ""
echo "*** Postinstall script is running ..."
echo ""
# ... other customizations ....
#
# create the WiFi config file
#
# -rw------- 1 system system u:object_r:apex_system_server_data_file:s0 4884 2023-01-29 08:55 /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml
#
WIFI_CONFIG_FILE="/data/misc/apexdata/com.android.wifi/WifiConfigStore.xml"
WIFI_CONFIG_FILE_BACKUP="${WIFI_CONFIG_FILE}.$$.bkp"
NEW_WIFI_CONFIG_FILE="/sdcard/Download/WifiConfigStore.xml"
if [ -r "${WIFI_CONFIG_FILE}" ] ; then
echo "Creating a backup of the file \"${WIFI_CONFIG_FILE}\" in \"${WIFI_CONFIG_FILE_BACKUP}\" ...."
cp "${WIFI_CONFIG_FILE}" "${WIFI_CONFIG_FILE_BACKUP}"
fi
echo "Creating the file \"${NEW_WIFI_CONFIG_FILE}\" ..."
cat >"${NEW_WIFI_CONFIG_FILE}" <<-\EOT
*** add here the contents of the file /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml from the phone after manually configuring the WLAN
EOT
if [ $? -eq 0 ] ; then
echo "Creating the file \"${WIFI_CONFIG_FILE}\" ..."
su - -c cp "${NEW_WIFI_CONFIG_FILE}" "${WIFI_CONFIG_FILE}" && \
su - -c chmod 600 "${WIFI_CONFIG_FILE}" && \
su - -c chown system:system "${WIFI_CONFIG_FILE}" && \
su - -c chcon -v "u:object_r:apex_system_server_data_file:s0" "${WIFI_CONFIG_FILE}"
if [ $? -ne 0 ] ; then
echo "Error creating the file \"${WIFI_CONFIG_FILE}\" "
fi
else
echo "Error creating the file \"${NEW_WIFI_CONFIG_FILE}\" "
fi
# enable WiFi
#
echo "Enabling WiFi ..."
svc wifi enable
# optional: Disable mobile data connections
#
echo "Disabling mobile data ..."
svc data disable
# Now reboot the phone to activate the new WiFi config ..
#
echo "Waiting 15 seconds now before rebooting - press CTRL-C to abort ...."
i=0
while [ $i -lt 15 ] ; do
(( i = i + 1 ))
printf "."
sleep 1
done
printf "\n"
echo "Now rebooting the phone ..."
reboot
#
Notes:
Be aware the the file /data/misc/apexdata/com.android.wifi/WifiConfigStore.xml contains the passwords for all configured WLANs in plain text.
There should be a command to force Android to reread the file WifIConfigStore.xml but I don't know that.
Android can be forced to re-read the file WifIConfigStore.xml by killing the process system_server, e.g:
Bash:
pkill system_server
But that is more or less a warm reboot and I do not know what other side effects that restart triggers
There is an app to configure WiFi via adb command
https://github.com/steinwurf/adb-join-wifi
Bash:
adb shell am start -n com.steinwurf.adbjoinwifi/.MainActivity -e ssid myssid -e password mywlan_password -e password_type WPA
The app works but unfortunately it does not support enabling the setting to use the device MAC instead of the random MAC so it's not usable in my environment.
Another app to configure WiFi via adb command is available here:
https://github.com/pr4bh4sh/adb-wifi-setting-manager
Unfortunately that app also does not support enabling choosing the MAC address for the connection.
There is also a script to convert an old Android wpa_supplicant.conf file to the newer (post-Oreo) WifiConfigStore.xml file (not tested):
https://github.com/mnalis/android-wifi-upgrade
It's also possible to use the command wpa_cli to configure WiFi but be aware the wpa_cli only works if selinux is (temporary) disabled, example:
Spoiler: wpa_cli example
Code:
ASUS_I006D:/ $ su -
ASUS_I006D:/ #
ASUS_I006D:/ # setenforce 0
ASUS_I006D:/ #
ASUS_I006D:/ #
ASUS_I006D:/ # wpa_cli
wpa_cli v2.10-devel-11
Copyright (c) 2004-2019, Jouni Malinen <[email protected]> and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
Using interface 'wlan0'
Interactive mode
<3>Control interface command 'BSS RANGE=ALL MASK=0x2'
<3>Control interface command 'LIST_CREDS'
<3>Control interface command 'LIST_NETWORKS'
<3>Control interface command 'STA-FIRST'
>
> list_networks
network id / ssid / bssid / flags
0 Zeilsheim any [CURRENT]
1 any [DISABLED]
<3>Control interface command 'LIST_NETWORKS'
>
> quit
ASUS_I006D:/ #
Note: Use help to get list of known commands
Test Environment
I tested the WiFi config via script described above in these Android distributions:
OmniROM 13 (Android 13)
OmniROM 12 (Android 12)
ASUS Android 12
ASUS Android 13
This method seems not to work in Android 11

Categories

Resources