Skip to content

Instantly share code, notes, and snippets.

@KyonLi
Created April 26, 2025 01:56
Show Gist options
  • Save KyonLi/24aff765a9ea757fadf24bad103dd304 to your computer and use it in GitHub Desktop.
Save KyonLi/24aff765a9ea757fadf24bad103dd304 to your computer and use it in GitHub Desktop.
Kindle stuff
#!/bin/sh
# WiFi interface name
INTERFACE="wlan0"
# Path to the operstate file
OPERSTATE="/sys/class/net/$INTERFACE/operstate"
# WiFi ESSID
WIFIESSID="ASUS_E8_2G"
# Check if the interface exists
if [ ! -f "$OPERSTATE" ]; then
echo "WiFi interface $INTERFACE does not exist"
exit 1
fi
# Read operstate content
STATE=$(cat "$OPERSTATE")
# Check if the state is up
if [ "$STATE" != "up" ]; then
echo "WiFi not connected (state: $STATE), try connecting to $WIFIESSID"
lipc-set-prop com.lab126.wifid cmConnect "$WIFIESSID"
else
echo "WiFi connected (state: $STATE)"
fi
exit 0

Check battery capacity

cat /sys/class/power_supply/bd7181x_bat/capacity

Time sync

ntpdate -u time.apple.com && hwclock -w

List number of WIFI profiles:

lipc-get-prop com.lab126.wifid profileCount

Show contents of a WIFI profile:

echo "{index=(0)}" | lipc-hash-prop com.lab126.wifid profileData

Delete a WIFI profile:

lipc-set-prop com.lab126.wifid deleteProfile WIFIESSID

Create a WIFI profile:

echo '{essid="WIFIESSID", smethod="wpa2", secured="yes", psk="WIFIPSK"}' | lipc-hash-prop com.lab126.wifid createProfile

smethod can be one of open,wep,wpa,wpa2 (if you choose open, set secured to “no”)

WIFIPSK is the WIFI PSK as generated with the wpa_passphrase utility (which is actually on the kindle): a normal “wifi passphrase” will not work.

Connect a WIFI profile:

lipc-set-prop com.lab126.wifid cmConnect WIFIESSID

Show WIFI connection status:

echo "{index = (0)}" | lipc-hash-prop -n com.lab126.wifid currentEssid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment