The config/hostname.conf
file (found under /system/sdcard/
when the camera is running) file defines the camera’s name:
Cam4
That file overrides the contents of the usual etc/hostname.conf
file, somewhat to my surprise, which remains the default Ingenic-uc1_1
.
The bin/hostname
utility returns the hostname:
[root@Cam4 ~]# which hostname
/bin/hostname
[root@Cam4 ~]# hostname
Cam4
You can automagically get the hostname in the on-screen display by modifying the OSD
formatting variable in config/osd.conf
:
OSD="$(/bin/hostname) %Y-%m-%d %H:%M:%S"
Which works because the main OSD script sources the config file to set the variable:
It’s also helpful (at least for my purposes) to add the hostname to the image filenames. A one-line tweak in the scripts/detectionOn.sh
script does the trick:
snapshot_filename=$(/bin/hostname)_$(date "$snapshot_pattern")
Which produces names along these lines:
-rwxr-xr-x 1 ed root 246K Apr 23 2019 Cam4_2019-04-23_17.51.02.jpg*
Having source code makes simple changes like this … simple!
One thought on “Xiaomi Dafang Hacks: Hostname for OSD and Filename”
Comments are closed.