Pull recordings off a HiDock P1 mini voice recorder via your Android phone over USB,
transcode them to .m4a, upload to Google Drive, and delete from the device — all
fully automatic, on a cron schedule, with no PC needed.
The HiDock device speaks a proprietary "Jensen" USB protocol and only enumerates when
plugged into a phone-class USB host (it won't talk to a Mac/PC directly). This script
runs entirely inside Termux on the phone and uses Android's
UsbManager to grant the USB device a file descriptor that
libusb_wrap_sys_device
hands to pyusb, so we never need root.
The Jensen protocol implementation is consumed unmodified from
sgeraldes/hidock-next (MIT licensed) — this
repo is a thin Termux/Android adapter on top of it, plus a cron-friendly Drive uploader.
HiDock P1 mini ──USB──► Phone (Termux) ──HTTPS──► Google Drive
│
└─ ffmpeg .hda → .m4a (AAC 64k)
└─ delete_file on device after Drive 200 OK
Every file lands in Drive at:
{DRIVE_BASE}/YYYY-MM-DD/HH-MM-SS_RecNN.m4a
(parsed from the HiDock's native filename YYYYMmm DD-HHMMSS-RecNN.hda).
- The official HiNotes app holds your recordings in private app storage you can't easily back up. This script puts them in Drive permanently.
- Your phone has unlimited HiDock storage (just sync; device gets cleared automatically).
- Recordings become accessible on every device you own that can read Drive.
- No more dependence on the HiDock Cloud transcription quota — point any pipeline at your Drive folder.
| Hardware | Android phone with USB-C OTG, HiDock P1 mini (VID 0x3887 PID 0x2041) |
| Apps | Termux + Termux:API + Termux:Boot (install all three from F-Droid or all three from the Termux GitHub releases — they share signing keys; you cannot mix) |
| Account | A Google account with Drive |
Tested on Samsung Galaxy Z Fold 3 (Android 14) with HiDock P1 mini firmware 2.2.3.
In a Termux session:
# 1) Install package deps + clone this repo + clone hidock-next
pkg install -y git
git clone https://github.com/mavliev/hidock-android-sync.git ~/hidock-android-sync
cd ~/hidock-android-sync
bash setup.shsetup.sh installs python libusb termux-api ffmpeg rclone cronie termux-services,
pip install pyusb, and git clones sgeraldes/hidock-next (read-only — we only
import its hidock_device.py for the Jensen protocol).
# 2) Configure rclone Google Drive remote (interactive — opens a browser tab)
rclone config create gdrive drive scope driveThe OAuth tab will open. Sign in, allow access, done.
If you also have a Mac/PC, the easier path is to run rclone config there, then:
adb push ~/.config/rclone/rclone.conf /sdcard/
# then in Termux:
mkdir -p ~/.config/rclone && cp /sdcard/rclone.conf ~/.config/rclone/
# 3) (optional) Customize config
cp config.example.env ~/.config/hidock-sync/config
$EDITOR ~/.config/hidock-sync/config # change DRIVE_BASE etc. if you wish# 4) Plug in the HiDock and grant USB permission once (a system dialog pops up)
bash run_sync.sh request
# 5) Test: dry-run lists what would be uploaded
bash run_sync.sh --dry-run --limit 3If the dry-run looks right:
# 6) Real run with a single file
bash run_sync.sh --limit 1Open the Drive web UI and confirm the .m4a appeared at {DRIVE_BASE}/YYYY-MM-DD/.
# 7) Enable cron + boot autostart
bash setup-cron.shbash run_sync.sh # manual full sync
tail -f ~/.config/hidock-sync/sync.log
crontab -l # see schedule~/.config/hidock-sync/config (created by step 3 above; defaults sane):
DRIVE_REMOTE=gdrive # name of your rclone remote
DRIVE_BASE=HiDock/Documents # path inside the Drive
STAGING_DIR=/sdcard/Download/hidock_staging
LOG_DIR=$HOME/.config/hidock-sync
CRON_INTERVAL_MIN=30 # only used by setup-cron.shPlug in HiDock and reseat. termux-usb -l should print the /dev/bus/usb/X/Y path.
You haven't granted the persistent permission yet. Run bash run_sync.sh request
once — Android will pop an "Allow Termux:API to access HiDock P1 mini?" dialog. Tap
OK. The grant is per device; survive reboots.
The HiNotes app auto-attaches to the HiDock on USB-attach and locks it. You have three options:
- Recommended: uninstall HiNotes — you don't need it once this script is running.
- Make Termux:API the default handler for the HiDock USB device (Settings → Apps → Default apps → USB device assistance → HiDock P1 mini → Termux:API).
- Force-stop HiNotes manually before each cron tick (not feasible for unattended use
without root or
adb).
setup-cron.shcallstermux-wake-lock. If you see no Termux notification, wake-lock is not held.- Settings → Apps → Termux → Battery → Unrestricted (Samsung) or Don't optimize.
- Same for Termux:API and Termux:Boot.
Termux:Boot must be opened at least once after install (it then registers the
BOOT_COMPLETED receiver). If you've never tapped its icon, do so. To verify the boot
script will run, check ~/.termux/boot/start-crond exists and is executable.
rclone saves OAuth refresh tokens in ~/.config/rclone/rclone.conf. If Drive
returns 401, run rclone config reconnect gdrive: and re-auth.
run_sync.shdiscovers the HiDock USB device withtermux-usb -l, then runs the sync script as a child oftermux-usb -e. Termux:API opens the device throughUsbManager.openDevice()and passes the resulting file descriptor to our process.hidock_sync.pyparses that fd, callslibusb_wrap_sys_devicevia ctypes, and constructs a fully-functionalusb.core.Device. A small monkey-patch onbackend.open_devicekeeps pyusb from re-opening the (already open) handle.HiDockJensenfromsgeraldes/hidock-nextis then driven directly: list files, stream-pull each one, anddelete_fileon success.- Each pulled
.hdais transcoded to.m4a(AAC 64 kbps mono) withffmpeg, thenrclone copyto'd to Drive with--ignore-existing(idempotent). delete_fileon the device runs only after the Drive copy returns 200, so a network failure never destroys data.
hidock-android-sync/
├── README.md
├── LICENSE
├── config.example.env # default config; user copies to ~/.config/hidock-sync/config
├── hidock_sync.py # main worker, run via `termux-usb -e`
├── run_sync.sh # cron-friendly wrapper
├── setup.sh # one-shot installer (pkg install + clone hidock-next)
└── setup-cron.sh # enables cron + boot autostart + wake-lock
- The Jensen USB protocol implementation lives in
sgeraldes/hidock-next. - The libusb fd-passing recipe is the standard Termux ↔ Android USB pattern documented in the pyusb FAQ.
MIT — see LICENSE.