- Replaced usb-serial-for-android library with raw Android USB API
(UsbDeviceConnection.bulkTransfer) — the library's testConnection()
sent a get_status CDC request that the ESP32-S3 USB-JTAG/serial
controller does not support, causing read failures
- Added CDC control interface setup (line coding + DTR/RTS) to enable
data flow before sending KEY? command
- Added retry logic: 5 attempts, 1s delay between retries, to handle
other apps grabbing the USB device first (JTAG/serial debug unit
triggers multiple system dialogs before our app gets permission)
- Re-lookup ESP device on each retry to handle device path changes
- Removed usb-serial-for-android dependency and JitPack repository
USB auto-read:
- ESP responds to 'KEY?\n' over USB serial with 'HMAC_KEY:<hex>'
- Android UsbKeyReceiver (manifest BroadcastReceiver) catches USB_DEVICE_ATTACHED
- Filters on Espressif vendor 0x303a, requests USB permission
- Opens CDC-ACM serial (115200), sends KEY?, parses response, saves to SharedPreferences
- Works even when app not in foreground
- usb-serial-for-android v3.7.3 via JitPack
UI redesign:
- activity_main.xml: FrameLayout with settings icon top-right, relay button center, status bottom-left (14sp)
- Scan & Connect button moved to SettingsActivity
- SettingsActivity: hint text 'Voer de HMAC sleutel in of sluit de relaismodule aan op de telefoon'
- SettingsActivity: scan button saves key + returns RESULT_OK to trigger scanning
- MainActivity: removed scanButton, auto-scan on onResume when key is set
- Back button removed from settings (ActionBar up navigation only)
README updated with USB protocol docs, new UI description, and updated setup guide