From 452a5c7930b6dcfd4e748de10cc95066524cf745 Mon Sep 17 00:00:00 2001 From: Roger Mingorance Date: Mon, 21 Sep 2026 12:00:05 -0400 Subject: [PATCH] first commit --- README.md | 0 androidscreen.plx | 83 +++++++++++++++++++++++++++++++++++++++++++++++ restart_adb.sh | 6 ++++ 3 files changed, 89 insertions(+) create mode 100644 README.md create mode 100755 androidscreen.plx create mode 100755 restart_adb.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..e69de29 diff --git a/androidscreen.plx b/androidscreen.plx new file mode 100755 index 0000000..6d39be0 --- /dev/null +++ b/androidscreen.plx @@ -0,0 +1,83 @@ +#!/usr/bin/perl + +#use Modern::Perl; +use List::Util 1.33 'any'; + +########################### +# verify the parameter sent +########################### +my $num_args = $#ARGV + 1; +if ($num_args != 2) { + print 'Usage: androidscreen.plx last_ip phone'; + exit; +} +my $last_ip = $ARGV[0]; +my $cell = $ARGV[1]; + +unless ($last_ip > 0 and $last_ip < 256) { + print 'IP has to be a valid value: 0-255'; + exit; +} + +my @choices = ('pixel7', 'p7side', 'motog'); +unless (any {$cell eq $_} (@choices)) { + print "Invalid cell phone: ${cell}\n"; + print 'Allowed values are: ' . join(' ', @choices) . "\n"; + exit; +} + +###### +# vars +###### +my @params = (); +if ($cell eq 'pixel7') { + @params = ( + # '--audio-source=playback', #??? stopped working! + '--audio-dup', + # '--require-audio', + '--audio-codec=raw', + '--audio-output-buffer=10', + '--window-width=432', # 30% + '--window-height=936' + ); +} elsif ($cell eq 'p7side') { + @params = ( + # '--audio-source=playback', #??? stopped working! + '--audio-dup', + # '--require-audio', + '--audio-codec=raw', + '--audio-output-buffer=10', + '--window-width=936', + '--window-height=432' + ); +} elsif ($cell eq 'motog') { + @params = ( + '--audio-source=playback', + '--audio-dup', + '--audio-codec=raw', + '--audio-output-buffer=10', + '--window-width=432', # 40% + '--window-height=955' + ); +} else { + @params = ( + # '--audio-source=playback', + # '--audio-dup', + '--audio-codec=aac', + #'--audio-output-buffer=10' + ); +} + +my $ip3 = '192.168.50'; +my $port = '5555'; +my $comm1 = "adb connect ${ip3}.${last_ip}:${port}"; +my $comm2 = "scrcpy -s ${ip3}.${last_ip}:${port} " . join(' ', @params); + +###### +# main +###### +# print $comm1 . "\n"; +qx {$comm1}; + +# print $comm2 . "\n"; +qx {$comm2}; diff --git a/restart_adb.sh b/restart_adb.sh new file mode 100755 index 0000000..ad31b16 --- /dev/null +++ b/restart_adb.sh @@ -0,0 +1,6 @@ +#!/usr/bin/bash + +adb kill-server +adb start-server +sleep 2 +adb tcpip 5555