Advertisements

Xiaomi Dafang Hacks: Hostname for OSD and Filename

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:

Xiaomi Dafang - 15-04-2019_13.26.18
Xiaomi Dafang – 15-04-2019_13.26.18

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!

Advertisements

  1. Leave a comment

Spam comments always vanish. Comment moderation may cause a delay.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s