From 8cef236f4db2029340a4c11be28b83b144554168 Mon Sep 17 00:00:00 2001 From: anzz1 Date: Fri, 12 May 2023 12:11:28 -0400 Subject: [PATCH] improve tools, move wifi setup to wifi.pak --- extras/Tools/FTP.pak/launch.sh | 11 ++-- extras/Tools/Telnet.pak/launch.sh | 11 ++-- extras/Tools/WiFi Setup.pak/launch.sh | 62 -------------------- extras/Tools/WiFi.pak/launch.sh | 73 +++++++++++++++-------- extras/Tools/WiFi.pak/wifi.png | Bin 0 -> 6910 bytes extras/Tools/WiFi.pak/wifi2.png | Bin 0 -> 5749 bytes extras/Tools/WiFi.pak/wifireload.sh | 23 ++++++++ extras/Tools/WiFi.pak/wifisetup.sh | 54 +++++++++++++++++ skeleton/.system/res/toggle.png | Bin 0 -> 5305 bytes src/confirm/main.c | 80 ++++++++++++++------------ src/keyboard/keyboard.c | 10 ++-- 11 files changed, 185 insertions(+), 139 deletions(-) delete mode 100644 extras/Tools/WiFi Setup.pak/launch.sh create mode 100644 extras/Tools/WiFi.pak/wifi.png create mode 100644 extras/Tools/WiFi.pak/wifi2.png create mode 100644 extras/Tools/WiFi.pak/wifireload.sh create mode 100644 extras/Tools/WiFi.pak/wifisetup.sh create mode 100644 skeleton/.system/res/toggle.png diff --git a/extras/Tools/FTP.pak/launch.sh b/extras/Tools/FTP.pak/launch.sh index 410d5b6..7e567ea 100644 --- a/extras/Tools/FTP.pak/launch.sh +++ b/extras/Tools/FTP.pak/launch.sh @@ -5,7 +5,7 @@ cd "$DIR" mkdir -p "$USERDATA_PATH/.wifi" -show confirm.png +show toggle.png if [ -f "$USERDATA_PATH/.wifi/ftp_on.txt" ]; then say "FTP: Enabled" else @@ -13,18 +13,17 @@ else fi while confirm; do - show confirm.png + show toggle.png if [ -f "$USERDATA_PATH/.wifi/ftp_on.txt" ]; then rm -f "$USERDATA_PATH/.wifi/ftp_on.txt" - say "FTP: ..." LD_PRELOAD= killall ftpd > /dev/null 2>&1 LD_PRELOAD= killall tcpsvd > /dev/null 2>&1 - show confirm.png say "FTP: Disabled" else touch "$USERDATA_PATH/.wifi/ftp_on.txt" - LD_PRELOAD= tcpsvd -E 0.0.0.0 21 ftpd -w /mnt/SDCARD > /dev/null 2>&1 & + if [ -f "$USERDATA_PATH/.wifi/wifi_on.txt" ]; then + LD_PRELOAD= tcpsvd -E 0.0.0.0 21 ftpd -w /mnt/SDCARD > /dev/null 2>&1 & + fi say "FTP: Enabled" fi - sleep 1 done diff --git a/extras/Tools/Telnet.pak/launch.sh b/extras/Tools/Telnet.pak/launch.sh index 4659a7c..af6c005 100644 --- a/extras/Tools/Telnet.pak/launch.sh +++ b/extras/Tools/Telnet.pak/launch.sh @@ -5,7 +5,7 @@ cd "$DIR" mkdir -p "$USERDATA_PATH/.wifi" -show confirm.png +show toggle.png if [ -f "$USERDATA_PATH/.wifi/telnet_on.txt" ]; then say "Telnet: Enabled" else @@ -13,17 +13,16 @@ else fi while confirm; do - show confirm.png + show toggle.png if [ -f "$USERDATA_PATH/.wifi/telnet_on.txt" ]; then rm -f "$USERDATA_PATH/.wifi/telnet_on.txt" - say "Telnet: ..." LD_PRELOAD= killall telnetd > /dev/null 2>&1 - show confirm.png say "Telnet: Disabled" else touch "$USERDATA_PATH/.wifi/telnet_on.txt" - (cd / && LD_PRELOAD= telnetd -l sh) + if [ -f "$USERDATA_PATH/.wifi/wifi_on.txt" ]; then + (cd / && LD_PRELOAD= telnetd -l sh) + fi say "Telnet: Enabled" fi - sleep 1 done diff --git a/extras/Tools/WiFi Setup.pak/launch.sh b/extras/Tools/WiFi Setup.pak/launch.sh deleted file mode 100644 index 083b917..0000000 --- a/extras/Tools/WiFi Setup.pak/launch.sh +++ /dev/null @@ -1,62 +0,0 @@ -#!/bin/sh - -DIR=$(dirname "$0") -cd "$DIR" - -mkdir -p "$USERDATA_PATH/.wifi" - -CONFIRM=0 -WIFI_SSID="$(keyboard "Enter WiFi network name:" 32)" - -if [ $? -eq 0 ] && [ ! -z "$WIFI_SSID" ]; then - show confirm.png - say "WiFi network name set:"$'\n'"${WIFI_SSID:0:16}"$'\n'"${WIFI_SSID:17}" - if confirm; then - CONFIRM=1 - fi -fi - -if [ $CONFIRM == 0 ]; then - show okay.png - say "WiFi network settings were not changed"$'\n'"Exiting setup ..." - sleep 3 - exit 0 -fi - -CONFIRM=0 -WIFI_PASS="$(keyboard "Enter WiFi network pass:" 63)" - -if [ $? -eq 0 ]; then - show confirm.png - if [ ! -z "$WIFI_PASS" ]; then - say "WiFi network password set:"$'\n'"${WIFI_PASS:0:16}"$'\n'"${WIFI_PASS:17:16}"$'\n'"${WIFI_PASS:33:16}"$'\n'"${WIFI_PASS:48}" - else - say "WiFi network password set to empty" - fi - if confirm; then - CONFIRM=1 - fi -fi - -if [ $CONFIRM == 0 ]; then - show okay.png - say "WiFi network settings were not changed"$'\n'"Exiting setup ..." - sleep 3 - exit 0 -fi - -echo "ctrl_interface=/var/run/wpa_supplicant" > /appconfigs/wpa_supplicant.conf -echo "update_config=1" >> /appconfigs/wpa_supplicant.conf -echo $'\n'"network={" >> /appconfigs/wpa_supplicant.conf -echo $'\tssid="'"$WIFI_SSID"$'"' >> /appconfigs/wpa_supplicant.conf -if [ ! -z "$WIFI_PASS" ]; then - echo $'\tpsk="'"$WIFI_PASS"$'"' >> /appconfigs/wpa_supplicant.conf -else - echo $'\t'"key_mgmt=NONE" >> /appconfigs/wpa_supplicant.conf -fi -echo "}" >> /appconfigs/wpa_supplicant.conf - -show okay.png -say "WiFi network settings saved"$'\n'"Exiting setup ..." -sleep 3 -exit 0 diff --git a/extras/Tools/WiFi.pak/launch.sh b/extras/Tools/WiFi.pak/launch.sh index f90e553..5624efa 100644 --- a/extras/Tools/WiFi.pak/launch.sh +++ b/extras/Tools/WiFi.pak/launch.sh @@ -5,33 +5,58 @@ cd "$DIR" mkdir -p "$USERDATA_PATH/.wifi" -show confirm.png -if [ -f "$USERDATA_PATH/.wifi/wifi_on.txt" ]; then - WIFI_ON=1 - say "WiFi: Enabled" -else - WIFI_ON=0 - say "WiFi: Disabled" +if [ ! -f /mnt/SDCARD/.system/paks/WiFi.pak/8188fu.ko ]; then + show okay.png + say "WiFi driver is missing!"$'\n'"Please reinstall DotUI." + confirm any + exit 0 fi -while confirm; do - show confirm.png - if [ $WIFI_ON == 1 ]; then - WIFI_ON=0 - say "WiFi: Disabled" - else - WIFI_ON=1 - say "WiFi: Enabled" - fi - sleep 1 -done - +WIFI_ON=0 if [ -f "$USERDATA_PATH/.wifi/wifi_on.txt" ]; then - if [ $WIFI_ON == 0 ]; then + if [ -f /appconfigs/wpa_supplicant.conf ]; then + WIFI_ON=1 + else LD_PRELOAD= ./wifioff.sh > /dev/null 2>&1 & fi -else - if [ $WIFI_ON == 1 ] && [ -f /mnt/SDCARD/.system/paks/WiFi.pak/8188fu.ko ] && [ -f /appconfigs/wpa_supplicant.conf ]; then - LD_PRELOAD= ./wifion.sh > /dev/null 2>&1 & - fi fi + +while :; do + if [ ! -f /appconfigs/wpa_supplicant.conf ]; then + show ./wifi2.png + say "WiFi: Not configured"$'\n'$'\n'"Please configure your WiFi network"$'\n'"by pressing SELECT." + else + show ./wifi.png + if [ $WIFI_ON == 1 ]; then + say "WiFi: Enabled" + else + say "WiFi: Disabled" + fi + fi + while :; do + confirm any + KEY=$? + if [ $KEY -eq 57 ]; then # 57 = A + if [ -f /appconfigs/wpa_supplicant.conf ]; then + WIFI_ON=$(( ! WIFI_ON )) + break + fi + elif [ $KEY -eq 97 ]; then # 97 = SELECT + ./wifisetup.sh + break + elif [ $KEY -eq 29 ]; then # 29 = B + if [ -f /appconfigs/wpa_supplicant.conf ]; then + if [ -f "$USERDATA_PATH/.wifi/wifi_on.txt" ]; then + if [ $WIFI_ON == 0 ]; then + LD_PRELOAD= ./wifioff.sh > /dev/null 2>&1 & + fi + else + if [ $WIFI_ON == 1 ]; then + LD_PRELOAD= ./wifion.sh > /dev/null 2>&1 & + fi + fi + fi + exit 0 + fi + done +done diff --git a/extras/Tools/WiFi.pak/wifi.png b/extras/Tools/WiFi.pak/wifi.png new file mode 100644 index 0000000000000000000000000000000000000000..21f753b17252a3dd816fb2341b007de840eabb09 GIT binary patch literal 6910 zcmeHL_dgrz_m5GuR);;il-8!;W@K0;_6Q;xzHUFS?{A;~;QM`kdY<#cIq!3x^E~IAchdcPrh+G=P5=M^L9^S& z)&Kx!900&U`2!0Dx4tnX!>g_{0j?@TKf11^^SijJiK{{zbC=80~z5{n&c4 z#L(EQ^Up+1{r%}2_-Y;B7w}cJ=Vl(pCoWh^Ons3M=V`tA75s;qK*7(ythr~uoE7IO zzg-VbR<-tj=T1FboqTJ!`|XX^`~Z24&DP`deY&=c2>~920DpdK@;gHD|LgxF@P8=+ zxa49L;)v#BLCi@yJm1x!f=hRZLF@#@!pkhwpVIMX+4g_uoyTNWh;K0_QtDKO`r;W# zFg#iTgSvefolRLLRz<@x7P^O(*)f!I-3#PJqWTH?irZw=ewq<$&I%6A2v8lW+kA3k zsE)|k(PVpPP^2rUCh$s2`6u+6n{E4OQUr@_)z*Axjl562*>;$y9sTLfni>%r&GN`! zRU__)$qNwQs*xjKSAgc|R(Zho;!2SE(2hCFKLhAwhCnm&fQAkg2=Q3pUih`>;OwH9 z&2^>d{7PsBFgCkVJ$-1vYJ##CtgsSFuNr1-&j44->2=ZYp>p zs^Um}+1jU?_kZYKirxzTP7{EnE zSEw_}E6B8p#QIFRsg;9`C5)4Y^@2}2nj6jIHRWUzD#ddzAAe|CTS-5={y2?kmM6y1 zh^SlwQ~jbDs>f(GOHBahm!CTU26FMr9Ly#!sotbVjJMKp)a8RhK3rhC<8j>D-yF=m zERJvmo>4BC0xM?SPL*|uqeUjZkAo>35BL>u4q#f)WCd_-ESQrhn>G*4 zv>Tb{Iw^CEW*wT%wQgDtXqSpNEn7Q&j5fGX&_kOZek>nf$+_;ssNtpU-qQq(daOT; z*B>gy=6BPMRKm{zI&@^?+=_&7bvB&qY1#m)1P@I*g3<5pc9|6*Sh}XcORKSF$nxW= zG{Uu66bWOhk$@`?Ew3OF*S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M!*!o!wq3Uzux<)=-i?Pt^L#4B!uQt#Q*`~+r zb2Uvg{Ab#6OO88>)iEVmL~h_{XJ96G_9MPcb?7MJrA5btLv=%Q8`Ia)sXTKY*#Rg;DAChtK{84vsug literal 0 HcmV?d00001 diff --git a/extras/Tools/WiFi.pak/wifireload.sh b/extras/Tools/WiFi.pak/wifireload.sh new file mode 100644 index 0000000..1648e7f --- /dev/null +++ b/extras/Tools/WiFi.pak/wifireload.sh @@ -0,0 +1,23 @@ +#!/bin/sh + +killall telnetd > /dev/null 2>&1 & +killall ftpd > /dev/null 2>&1 & +killall tcpsvd > /dev/null 2>&1 & +killall wpa_supplicant > /dev/null 2>&1 +killall udhcpc > /dev/null 2>&1 +ifconfig wlan0 down + +ifconfig lo up +ifconfig wlan0 up +/customer/app/wpa_supplicant -B -D nl80211 -iwlan0 -c /appconfigs/wpa_supplicant.conf +udhcpc -i wlan0 -s /etc/init.d/udhcpc.script > /dev/null 2>&1 & + +# Telnet +if [ -f "$USERDATA_PATH/.wifi/telnet_on.txt" ] && [ -f "$TOOLS_PATH/Telnet.pak/launch.sh" ]; then + (cd / && telnetd -l sh) +fi + +# FTP +if [ -f "$USERDATA_PATH/.wifi/ftp_on.txt" ] && [ -f "$TOOLS_PATH/FTP.pak/launch.sh" ]; then + tcpsvd -E 0.0.0.0 21 ftpd -w /mnt/SDCARD > /dev/null 2>&1 & +fi diff --git a/extras/Tools/WiFi.pak/wifisetup.sh b/extras/Tools/WiFi.pak/wifisetup.sh new file mode 100644 index 0000000..58bf038 --- /dev/null +++ b/extras/Tools/WiFi.pak/wifisetup.sh @@ -0,0 +1,54 @@ +#!/bin/sh + +DIR=$(dirname "$0") +cd "$DIR" + +mkdir -p "$USERDATA_PATH/.wifi" + +WIFI_SSID="$(keyboard "Enter WiFi network name:" 32)" + +if [ $? -eq 0 ] && [ ! -z "$WIFI_SSID" ]; then + show confirm.png + say "WiFi network name set:"$'\n'"${WIFI_SSID:0:16}"$'\n'"${WIFI_SSID:17}" + if confirm; then + WIFI_PASS="$(keyboard "Enter WiFi network pass:" 63)" + if [ $? -eq 0 ]; then + show confirm.png + if [ ! -z "$WIFI_PASS" ]; then + say "WiFi network password set:"$'\n'"${WIFI_PASS:0:16}"$'\n'"${WIFI_PASS:17:16}"$'\n'"${WIFI_PASS:33:16}"$'\n'"${WIFI_PASS:48}" + else + say "WiFi network password set to empty" + fi + if confirm; then + echo "ctrl_interface=/var/run/wpa_supplicant" > /appconfigs/wpa_supplicant.conf + echo "update_config=1" >> /appconfigs/wpa_supplicant.conf + echo $'\n'"network={" >> /appconfigs/wpa_supplicant.conf + echo $'\tssid="'"$WIFI_SSID"$'"' >> /appconfigs/wpa_supplicant.conf + if [ ! -z "$WIFI_PASS" ]; then + echo $'\tpsk="'"$WIFI_PASS"$'"' >> /appconfigs/wpa_supplicant.conf + else + echo $'\t'"key_mgmt=NONE" >> /appconfigs/wpa_supplicant.conf + fi + echo "}" >> /appconfigs/wpa_supplicant.conf + show okay.png + if [ ! -f /appconfigs/wpa_supplicant.conf ]; then + if [ -f "$USERDATA_PATH/.wifi/wifi_on.txt" ]; then + LD_PRELOAD= ./wifioff.sh > /dev/null 2>&1 & + fi + say "Error:"$'\n'"Could not save WiFi network settings!" + else + if [ -f "$USERDATA_PATH/.wifi/wifi_on.txt" ]; then + LD_PRELOAD= ./wifireload.sh > /dev/null 2>&1 & + fi + say "WiFi network settings saved." + fi + confirm only + exit 0 + fi + fi + fi +fi + +show okay.png +say "WiFi network settings"$'\n'"were not changed." +confirm only diff --git a/skeleton/.system/res/toggle.png b/skeleton/.system/res/toggle.png new file mode 100644 index 0000000000000000000000000000000000000000..53076ac407f8fc9cd189c8e42d575ebc8764ecb6 GIT binary patch literal 5305 zcmeHK`8(9>|9%fiMW#;HvZN9viO9~8WfI03%9hH$jAiU=)DcOikln~w6O*N}ju{ar z6OycB%veUY8Dp8T&dkU8{`~n5zMt1`&;2a-eci9?dR_OEVhM$uJaP5}001XV?igAF z09OJ4fXK(V4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&$CS7mN2!0)qmmMuh1YBA!#|`yIMecFu*EzmwJHb_aX@IL}HWM+PHJo}F zpRX!`nYPzsQwnpes}q5o^VdhyMntcUee1hkCYbLS`R8Grug=oLo;KzB+Io<+ZJwI^ zHA!UqcHr&9SpKQQp;3+|aLy+5(JqE46}}xm?P|tzsEd=LIG4YUjKHnt4vm(Cz7uC^`0v`p2x?e+`(fgL0E_K4(*OVf literal 0 HcmV?d00001 diff --git a/src/confirm/main.c b/src/confirm/main.c index e881b46..9f71abf 100644 --- a/src/confirm/main.c +++ b/src/confirm/main.c @@ -8,54 +8,62 @@ #include #include -#define BUTTON_A KEY_SPACE -#define BUTTON_B KEY_LEFTCTRL +#define BUTTON_A KEY_SPACE +#define BUTTON_B KEY_LEFTCTRL + +#define E_RELEASE 0 +#define E_PRESS 1 +#define E_REPEAT 2 int main(int argc , char* argv[]) { int any = 0; int only = 0; - - if (argc<1) { - puts("Usage: confirm [any|only]"); - puts(" default: only A button confirms, only B button cancels"); - puts(" any: any button confirms, none cancel"); - puts(" only: only the A button confirms, none cancel"); - return 0; - } - + + // if (argc<1) { + // puts("Usage: confirm [any|only]"); + // puts(" default: only A button confirms, only B button cancels"); + // puts(" any: any button confirms, none cancel"); + // puts(" only: only the A button confirms, none cancel"); + // return 0; + // } + if (argc>1) { char mode[4]; strncpy(mode,argv[1],4); - any = strncmp(mode, "any", 4)==0; - only = strncmp(mode, "only", 4)==0; + any = !strncmp(mode, "any", 3); + only = !strncmp(mode, "only", 4); } - - int confirmed = 0; // true in shell + + int ret = 0; // true in shell int input_fd = open("/dev/input/event0", O_RDONLY); - struct input_event event; - while (read(input_fd, &event, sizeof(event))==sizeof(event)) { - if (event.type!=EV_KEY || event.value>1) continue; - if (event.type==EV_KEY) { - if (any || event.code==BUTTON_A) break; - else if (!only && event.code==BUTTON_B) { - confirmed = 1; // false in shell terms - break; + if (input_fd != -1) { + struct input_event event; + while (read(input_fd, &event, sizeof(event))==sizeof(event)) { + if (event.type==EV_KEY && event.value==E_PRESS) { + if (any) { + ret = event.code; + break; + } else if (event.code==BUTTON_A) { + break; + } else if (!only && event.code==BUTTON_B) { + ret = 1; // false in shell terms + break; + } } } + close(input_fd); } - + // clear screen - int fb0_fd = open("/dev/fb0", O_RDWR); - struct fb_var_screeninfo vinfo; - ioctl(fb0_fd, FBIOGET_VSCREENINFO, &vinfo); - int map_size = vinfo.xres * vinfo.yres * (vinfo.bits_per_pixel / 8); // 640x480x4 - char* fb0_map = (char*)mmap(0, map_size, PROT_READ | PROT_WRITE, MAP_SHARED, fb0_fd, 0); - memset(fb0_map, 0, map_size); - munmap(fb0_map, map_size); - close(fb0_fd); - - close(input_fd); - - return confirmed; + // int fb0_fd = open("/dev/fb0", O_RDWR); + // struct fb_var_screeninfo vinfo; + // ioctl(fb0_fd, FBIOGET_VSCREENINFO, &vinfo); + // int map_size = vinfo.xres * vinfo.yres * (vinfo.bits_per_pixel / 8); // 640x480x4 + // char* fb0_map = (char*)mmap(0, map_size, PROT_READ | PROT_WRITE, MAP_SHARED, fb0_fd, 0); + // memset(fb0_map, 0, map_size); + // munmap(fb0_map, map_size); + // close(fb0_fd); + + return ret; } diff --git a/src/keyboard/keyboard.c b/src/keyboard/keyboard.c index 7e8df9d..8c00a7e 100644 --- a/src/keyboard/keyboard.c +++ b/src/keyboard/keyboard.c @@ -215,10 +215,7 @@ int main(int argc , char* argv[]) { if (event.code==BUTTON_MENU || event.code==KEY_POWER) { quit = 1; break; - } else if (event.code==BUTTON_START) { - quit = 0; - break; - } else if (event.value==0 || event.value==2) { + } else if (event.value==1 || event.value==2) { if (event.code==KEY_UP) { prev_key = key; if (key > 20) key -= 21; @@ -243,7 +240,7 @@ int main(int argc , char* argv[]) { back(); printstr(fb0_map, font, white); break; - } else if (event.value==0) { + } else if (event.value==1) { if (event.code==BUTTON_X || event.code==BUTTON_L1 || event.code==BUTTON_R1 || event.code==BUTTON_L2 || event.code==BUTTON_R2 || event.code==BUTTON_SELECT) { memset(fb0_map+(640*24*4), 0, 640*kLineHeight*3*4); @@ -260,6 +257,9 @@ int main(int argc , char* argv[]) { break; } } + } else if (event.value==0 && event.code==BUTTON_START) { + quit = 0; + break; } } }