Coder Social home page Coder Social logo

g2h-camera-mods's Introduction

g2h-camera-mods

This camera supports Homekit Secure Video for a reasonable price - but it has a couple of things that needed fixing.

These steps modify the G2H camera to enable RTSP, telnet, lock a few things down and not to call home. To undo these changes you should be able to do a factory reset as two full (A/B) images are stored in the SPI flash - though I have not tested this.

Accessing serial console

Conveniently the USB port exposes a 3.3v TTL serial console on the D- and D+ pins. You don't even need to open the case! I spliced an old USB cable to provide the 5V input and also interface to a 3.3v FTDI adapter.

alt text

Here you will see boot logs, output logs from the camera processes.

As expected, you also get a password protected login prompt.

Unlike many other cameras, the UBoot bootloader has no wait / interrupt configured so this will not let you in.

Dumping the firmware

I tried guessing the password (which locks after 3 incorrect attempts), uBoot was locked and not much in the way of services to probe, I took to reading the SPI flash.

Using a SOIC clip I was unable to reliably dump the firmware with the chip in place, even with a high current power supply. Finding and holding the reset pin on the Mstar SOC might have helped but removing the chip was an easier way. Once removed the firmware was dumped using flashrom and a Pi Zero and extracted with binwalk.

alt text

alt text

Getting root

My first thoughts were to modify the firmware directly, something like patching the root entry in the shadow file and boot from a modified firmware. However I didn't have a spare 32 Mbyte SPI flash to mess with and didn't want to overwrite the original as I wasn't sure the flashrom read/write was 100% accurate. This is because I saw some inconsistencies in the data dumps (this ended up being caused by a floating reset pin).

The shadow file had a dated descrypt hash for the root password - nothing came up online. I put John the ripper to the task of cracking it while I tried another way in...

I started sifting through the filesystem looking for a way in. One obvious entry point was the SD card. I could see the SD card is mounted to /mnt/sdcard, so searching the scripts and binaries for this string was a good start and pointed to the /etc/profile.

./fs_3/etc/profile:PATH="/usr/bin:/usr/sbin:/bin:/sbin:/local/bin:/local/sbin:/system/bin:/mnt/sdcard:/tmp/out"

This is useful, any file in /mnt/sdcard/ will be included in the execution path, the only problem being this is one of the last paths to be evaluated - so I can't really override a normally used command. Time to find one that is missing.

Checking the boot logs from the serial console and doing a search for 'not found'

2021-03-07 10:30:48.399775 [HK DBG]hk_exec_shell_command_and_get_result:hostname "Camera-Hub-G2H-3CB8"   ---(misc.cpp:230)
sh: hostname: not found

Bingo. All I need to do is create a file with this name in the root of the sdcard and it should be executed. I created a simple script that would echo the date into another test file on the same card. I booted and checked the contents of the sdcard and it worked.

No need for John the Ripper ...

The next part was to change the root password so I can log in from the console.

echo "root:password" | chpasswd

And to test...

Camera-Hub-G2H login: root
Password:
login[133]: root login on 'ttyS0'
 
 
BusyBox v1.24.1 (2020-09-12 16:31:03 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.
 
Welcome to Linux.
#
#

Changing the voice to English

The default Chinese language was fixed with no way to change it. Which is fine but when you do certain tasks it would be nice to be able to understand what it was doing.

The audio files are stored in /etc/ch which are all in Mandarin. In a later version of the firmware the new audio files appeared (in folders en, es and ru). There is also German, Italian and French in another partition /customer/voice.

Using a symbolic link to point each file in /etc/ch/en/ to the corresponding file in the parent directory is an easy way to change the language to english.

Note that these other languages only existed after a software update, and you use the Aquara app to do the update. So I copied these from one device to another.

Fixing Wifi

The device would not join my home wifi and it seems to be a common issue online with suggestions ranging from removing special characters from the SSID to using the Aqara app, registering and changing the country to China. This eventually ended up working but who has time for that!

The homekit enrollment process uses 801.11aq to announce and do network discovery, it should work really well. For some reason the scripts seem to fudge the wpa_supplicant.conf file and won't allow you to join a hidden network. A simple workaround is to constantly overwrite this file with valid details during the Homekit enrollment processes. I used a simple while sleep 0.3 loop to do this

Enabling RTSP

Other Homekit cameras I have come across wont allow RTSP when Homekit mode is enabled and I assume this is for performance reasons. But this SOC seems to be fast... Doing a string search on the main binaries that are running for rtsp revealed the camera binary may support rtsp.

Loading the binary into Ghidra and looking for references to this I can see where the function is called, and it appears to be when homekit is enabled, it wont start rtsp!

alt text

Patching this binary is trivial. As I don't want to use any of the Xiaomi/Aqara cloud functions, I will simply replace one of the other calls miio_task with rtsp_task.

It was harder to find a tool built into the shell that supported raw byte manipulation of these files (the stripped down sed/awk did not, there was no dd). Fortunately the included version of hexdump supported an experimental reverse (-R) function that made this possible. But with a 2MB binary this takes about 15 seconds.

There was also an annoying message filling the logs. I replaced this call with a NOP instruction (0xf3af8000) to stop it spamming.

hexdump -vC /tmp/out/camera.1 | sed -e 's/e3 f7 65 ff/f3 af 80 00/' -e 's/6d 69 69 6f 5f 74 61 73  6b 00 00 00/72 74 73 70 5f 74 61 73  6b 00 00 00/' | hexdump -R > /tmp/out/camera

And now the process is listening on port 554. And not spamming the logs.

# netstat -anl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 127.0.0.1:101           0.0.0.0:*               LISTEN     
tcp        0      0 0.0.0.0:554             0.0.0.0:*               LISTEN     
tcp        0      0 127.0.0.1:54355         0.0.0.0:*               LISTEN     

The service is running, but what is the URL?

$ ffplay rtsp://10.32.67.68/
ffplay version 4.2.2 Copyright (c) 2003-2019 the FFmpeg developers
rtsp://10.99.99.99/: Server returned 400 Bad Request

After some trial and error and searching Ghidra and online, I found the paths /10 ...to... /15 provide different resolutions, with and without audio.

$ ffplay rtsp://10.99.99.99/14
ffplay version 4.2.2 Copyright (c) 2003-2019 the FFmpeg developers
Input #0, rtsp, from 'rtsp://10.99.99.99/14': 0KB sq=    0B f=0/0  
 Metadata:
   title           : ww live test
 Duration: N/A, start: 0.000000, bitrate: N/A
   Stream #0:0: Video: h264 (Main), yuvj420p(pc, progressive), 1280x720, 20 fps, 20 tbr, 90k tbn, 180k tbc
   Stream #0:1: Audio: aac (LC), 16000 Hz, mono, fltp
[swscaler @ 0x7fab1e10d000] deprecated pixel format used, make sure you did set range correctly
  2.78 A-V: -0.012 fd=   0 aq=    3KB vq=   85KB sq=    0B f=0/0  

There is a bug when an RTSP connection is started while the camera is in night mode, the IR led/filter would be switched off after a short time after connecting. A bit of digging revealed a function that simply switched off night mode after 6 seconds.

image

Using the hexdump + sed + load hack this is "fixed" by replacing the off with another on by flipping the second paramter on L22 from 1 to a 0: 's/20 46 01 21 bd e8 38 40/20 46 00 21 bd e8 38 40/'

Do not call home

The binaries include a bunch of chinese IPs and domain names - I am not sure if they are used when Homekit only mode is enabled (my 5 minute from boot traffic traces indicated they did not). But I removed them anyway, just in case, simply by patching the strings in the binary to point variations of home 127.0.0.1 and pointing these domain names to localhost also. If you don't want to do this you could also route <dst> lo to send the traffic to a black hole.

# /etc/hosts
127.0.0.1 cm.iotcplatform.com gm.iotcplatform.com aiot-coap-test.aqara.cn

The binary also referenced some public DNS servers, these were changed to fake addresses.

One of these must have been used for NTP, so manually adding NTP to the boot process solves this.

homekit_ntp au.pool.ntp.org

Disabling other Miio/Xiaomi cloud processes

A tool called monitor ensures every process in /etc/normal.xml is running. Remove the processes that aren't needed. I just leave the camera, property and Zigbee process running.

Rotating the picture

I have one of these cameras hanging upside down. The rotate function was not available without the Aqara app. Change flip = 0 to flip = 3 in the file /mnt/config/flash_config.ini. Generate a new md5sum and replace the last line of the file after the change.

TL;DR

Note this is a hack and you risk locking yourself out! If doubt don't use this! Check the issues page for some detailed adventures of things that can go wrong.

Clone this repo to the root of an SD card. Insert the card, power on the camera. The camera will reboot when it's done and remove the SD card. Or keep it in.. up to you.

To reverse the hack, the backup save files can be manually restored to their original location by following the actions in the script. Use at your own risk.

Unfortunately this will probably be patched when Xiaomi is aware. But as a low risk vulnerability (need physical access to the sd card) it won't be a priority. If you want to patch your own camera against this hack, just remove /mnt/sdcard from the PATH variable in /etc/profile

g2h-camera-mods's People

Contributors

mcchas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

g2h-camera-mods's Issues

homekit_ntp

Hey,

Do you have a bit more info on the homekit_ntp command?

After adding 127.0.0.1 cm.iotcplatform.com gm.iotcplatform.com aiot-coap-test.aqara.cn to hosts the time stamp reset itself to 1970.

homekit_ntp au.pool.ntp.org doesn't seem to fix this, when I try to run it manually via telnet it just hangs.

deleted tar_app.sh, can this be solved?

Hi,
I needed to do a factory reset and dit like #22 but by accident I deleted the tar_app.sh and now it won't boot.
Is there a way to restore this?

I can still telnet into the device, so if someone can post the file here I can copy it for the sd card back.

MQTT credentials

I succesfully have the script running and can access the RTSP streams (firmware 2.0.9).
I saw a mosquitto broker running. Anyone have the user & pass to connect to this broker?
Ofcourse I tried "root" and the "newrootpassword"

Available commands

By browsing the folders I found these commands:

cd /local/bin

ls

sdk_test_search get_lumi_info set_led_r get_sn iperf_client
get_zig_chipid zig_permit_join_pre set_led_b wpa_cli sdk_test_liveview
rtwpriv get_model zig_set_pa set_homekit_info debuger
hotplug factory_test zig_get_pa get_homekit_info zig_leave_all_device
iwspy monitor set_product_info avahi-autoipd get_dev_status
zigbee_lqi iwlist get_product_info key_test set_language
qrcode ota_checker sdk_test_func key_state get_language
audio_test modify_bootargs homekit_ntp mfi_test sdk_test_audio
sdcard_test get_soft_ver sdk_test_playback led_test restore
iperf_server ifrename speaker set_lens hostapd
iwconfig wpa_supplicant wifi_rssi get_lens zig_permit_join
zig_leave_device sdk_test_param wifi_test fac_console iwpriv
asetprop iwgetid set_hd_ver property_service iperf
agetprop get_zig_ver get_hd_ver uboot_tools mic
set_lumi_info get_zig_mac set_sn iwevent

Especially the set_language was handy to put it in English.

"get_language" to read the current lang and "set_language en" to put it in English

G2H Stuck on a loop

I've accidentally overwritten the S90app file with the hostname file. I tried getting access through UART but no luck, I can read the logs but can't write into it. It loads fine until it loads the S90app script and it gets stuck in the loop. Is there a way I can access this file and revert what I did?
It literally has the normal log, I overwrote the S90app with a code that had a loop, so when it starts that it gets stuck, I would need to find a way to reoverwrite that file but I can't seem to be able to, any ideas?
I tried booting with rootfs and no luck also...
UART_ROOTFS.txt
UART_DUMP.txt

cant edit flash_config.ini - g2h

Hey there,
noob here trying to flip a g2h image, my camera is installed upside down.
My issue is that using the vi editor it always says that the file is "read only" and I can't save it after editing "flip = 3"
How can i change it ?

Thanks in advance !

How do I change WiFi settings via Telnet?

I've tried to change SSID/PWD both on /mnt/config/wifi.config and /mnt/config/wpa_supplicant.conf

Still, it doesn't change access point, continues to connect to the old one...

G2H does not start

Hello. Foolishly deleted the /tmp/out/ folder and the /etc/normal.xml file. The yellow indicator is now on all the time, it does not appear on the network. What can I do?

Can IR be disabled?

Hi,

I want to disable IR totally on my cams.
Only way I've found are echo 1 > /sys/class/gpio/gpio62/value
But after a cycle of daylight, it turn on again at night.

Are there a way to permanently disable IR, from flash_config.ini ?

Can't connect to Aqara App

Hi!
How can I reverse change to be able to pair Camera back to Aqara App?
Camera works fine with HomeKit but I need to pair another Aqara Devices to the camera.
If I reset it to factory, it will connect to wifi just fine, but not to the Aqara App. What can I do? Can you please provide hostname file to reverse these changes? Or is there any other way to pair Aqara devices to camera?

Blocking IPs

Hey!

I was looking at the hostname file

You block a load of IPs, could these go into the etc/hosts file instead? Or was there a particular reason you put them where you did?

Image flip in Homekit

I followed the steps outlined in #5 to do the image flip via Telnet, but the value doesn't seem to stay at 3. Just changes back to 0. Can anyone help?

Problem with IR led #2

Hi!
I did it:
mv /tmp/out/camera /tmp/out/camera.1
hexdump -vC /tmp/out/camera.1 | sed 's/20 46 01 21 bd e8 38 40/20 46 00 21 bd e8 38 40/' | hexdump -R > /tmp/out/camera
chmod 755 /tmp/out/camera
reboot
I restarted the camera in the dark, connected to it
ffplay rtsp://192.168.1.138/12
and after 6 seconds the backlight turned off. Did I do something wrong?
Firmware 2.1.1_0002.0515

Rotate only for HomeKit?

Is it possible to get a version of this that only rotates the camera, for HomeKit users who want to mount upside down but don't want to use the Aqara app at all?
In a way that could just be easily cloned to an SD without any other changes or requirements (telnet, rtsp, etc)

Also curious if you've seen any way to disable the mic (without messing with the hardware) for cameras that could be mounted in sensitive areas? (facing out of window in bedroom or bathroom)
In @oneminc issue with IR light, the firmware shows in the Audio section, In-Mute = 0.
Also in @fluppie issue, there seems to be a mic command of some sort.

Just curious, appreciate your work on this.

[Solved] How to connect to Telnet ?

Hi everyone,

And thanks for the author for this amazing work.

I'm trying to patch my camera (2.2.1),
I just put the hostname file in a newly formated SD Card (8GB) in FAT32. I can succesfully add the camera to HomeKit, but it seems there's no RTSP stream available (I'm trying to connect to rtsp://<ip>/10 trough VLC).

I tried to connect with Putty using Telnet, but it just says "Connection refused" after a few seconds and there's no login prompt at all.
Should I create a cable like the author did to connect trough telnet, or should I be able to do it over IP as I tried if the patch is successfull ?

Otherwise, I'm not really sure how can I check what is really hapening since I have no access whatsoever,
So far my guess is the cam is just not patched

EDIT (Solved) : The camera was indeed not patched, there was two partition on the SD (16GB) card, one of which I forgot. You need to have an SD card with only one FAT32 partition.
The patch won't reset HomeKit association, which is great.
As for telnet connection, I can indeed connect with Putty to telnet over IP now and RTSP is working at the same time.

Thanks for your work !

Is there anyway to do OTA?

Hi,

Is there anyway to do OTA from the patched camera? I tried resetting the camera and add it to Aqara app but I wasn't able to do so because the stock IPs were replaced to 127*

Thanks!

Problem with IR light

After hack my G2H, IR light turns on only for 5 seconds after connecting via RTSP

Enabling RTSP is not working

Hi @mcchas !
Could you help me?
I have downloaded your file 'hostname' on sdcard in G2H. After that I opened terminal and executed the command 'netstat -anl'. But I can't see any process is listening on port 554. What am I doing wrong?

image

Removal of accessories

Thanks a lot on the effort you did!

do you happen to know where the accessories are stored in the device?
I cant remove 4 temp sensors I had added, and also the Aqara app refuses to unbind them.

i was looking around in the directories via telnet, but cant seem to find it

Set Audio volume without app

Hello, is there a way to change the in_vol or out_vol without the app? In my tries it gets reset with every reboot while image flip for example works.
Thanks

Factory reset

Firstly great work by the way!

You've mentioned that there's A/B images stored in the SPI flash, is there a way to trigger a restoration of the image by any chance as neither holding the reset pin for 5-seconds nor pressing the top button 10-times consecutively does a proper "factory" reset to remove all modifications.

Both reset process above appears to only remove HomeKit pairing data and Wi-Fi configuration only.

Disable IR

I use one of my G2H's behind glass. For this reason I need to disable IR. Is there a way to do it without restoring the Aqara app?

no ssh

Hey, first of i want to thank you for your hard work. you did incredible job!
i was copy hostname to the sdcard root folder.
its seems like the camera does not listen on port 22 for SSH at all.

any suggestions?

Help with image flip

Hey, thank you for figuring this all out!

I am a bit lost enabling the image to flip - do you add a command to "hostname" or is there a way through telnet?

Also, is there a way to enable the timestamp?

[edit]
Ok figured it out

Connect via Telnet

vi /mnt/config/flash_config.ini

under [video] highlight 0 value for flip -> press r on your keyboard and then 3 to swap the value to 3

if you want to enable the timestamp change OSD to 1

Scroll to the bottom, press i on the keyboard and delete the line with the checksum

press esc, then type :wq

generate a new checksum using md5sum /mnt/config/flash_config.ini

Open the file again: vi /mnt/config/flash_config.ini
At the bottom press i on the keyboard and add a new line checksum = your MD5HASH


On another note: if you edit the language to English in /mnt/config/factory_config.ini it remains after a factory reset.

I wonder if there is a way to swap the CN G2H to EU like someone has done for the Hub: https://kaspa.rs/xiaomi-aqara-hub-cn-on-european-server/ -> this would possibly permanently change the firmwares to the European version.

[edit 2]
To swap to the EU servers you need to edit mentions of lumi.camera.gwagl02 to lumi.camera.gwag03

cd ../
vi /mnt/config/miio/device.conf
vi /mnt/config/hostapd.conf
vi /etc/build.prop

[Off Topic - Need Advice] Reset Firmware: Unable to Pair G2H to Homekit

Hello - I understand this is Off Topic but would really appreciate some help. Newbie Alert.

I got this camera about a month back. About 2 weeks back, this camera dropped off the network. I could not bring it back online so I removed it from homekit hoping I could pair it again.

But, try as I might with multiple resets, it just looping through "ready to connect. please open the aqara home app" and does not get paired on Homekit. Same goes with the Aqara app - it just wont add the camera (QR scan fails).

My presumption is that the firmware is corrupt. Is there a way to reset the firmware in some way or load the default firmware from SD Card? Totally out of ideas and open to any suggestion! Thanks.

PS: Wifi is 2Ghz only and has no underscores.

Is it possible to switch regions to US or other server?

I have one G2H with firmware settings set for China, and using this guide, able to get working (Telnet, RTSP) and able to make useful -- Thank you !!

Homekit also works, but the Aqara features for the unit only support Chinese region, won't register in the Aqara app otherwise (some features being unavailable)

I'm wondering if it's possible to update, mod or amend the firmware and settings -- to get this unit working under the US region or other region instead, I also have a working US version to compare with, could serve as a source. The IP addresses in the script appear to be the same for both versions.

I didn't realize when I bought the 'Blue' version on AE, the camera would be configured for China only and wouldnt work -- as most other Aqara zigbee devices are not tied to a region -- bit of a surprise there.

The camera hardware is the same, so should be just a matter of getting the right settings on the device?

Increasing video bitrates

Hello,

Once again, thank you for the hard work so far.

I've been trying to find ways to increase both the streaming and recording bitrate from the camera as the video quality of rapidly moving subjects within the frames (e.g. foliage) tend to result in a hot mess, indicative of low video bitrate.

Below are my ventures so far:

Querying using getprop returns the following data with MaxBitrate highlighted:

[Video.0.H264VBR.ChangePos]: [80] 
[Video.0.H264VBR.Gop]: [40] 
[Video.0.H264VBR.IPQPDelta]: [0]
**[Video.0.H264VBR.MaxBitrate]: [2000000]**
[Video.0.H264VBR.MaxIQp]: [51]
[Video.0.H264VBR.MaxPQp]: [51]
[Video.0.H264VBR.MinIQp]: [10]
[Video.0.H264VBR.MinPQp]: [10]
[Video.0.H264VBR.StatTime]: [0]
[Video.0.RC.RcVersion]: [0]
[Video.0.RC.RowQpDelta]: [0]
[Video.0.RC.method]: [H264_VBR]
[Video.1.H264VBR.ChangePos]: [80]
[Video.1.H264VBR.Gop]: [40]
[Video.1.H264VBR.IPQPDelta]: [0]
**[Video.1.H264VBR.MaxBitrate]: [487192]**
[Video.1.H264VBR.MaxIQp]: [51]
[Video.1.H264VBR.MaxPQp]: [51]
[Video.1.H264VBR.MinIQp]: [10]
[Video.1.H264VBR.MinPQp]: [10]
[Video.1.H264VBR.StatTime]: [0]
[Video.1.RC.RcVersion]: [0]
[Video.1.RC.RowQpDelta]: [0]
[Video.1.RC.method]: [H264_VBR]
[Video.2.H264VBR.ChangePos]: [80]
[Video.2.H264VBR.Gop]: [40]
[Video.2.H264VBR.IPQPDelta]: [0]
**[Video.2.H264VBR.MaxBitrate]: [655360]**
[Video.2.H264VBR.MaxIQp]: [51]
[Video.2.H264VBR.MaxPQp]: [51]
[Video.2.H264VBR.MinIQp]: [10]
[Video.2.H264VBR.MinPQp]: [10]
[Video.2.H264VBR.StatTime]: [0]
[Video.2.RC.RcVersion]: [0]
[Video.2.RC.RowQpDelta]: [0]
[Video.2.RC.method]: [H264_VBR]

From what I can determine Video.0 stream is the main stream recorded to iCloud, Video.1 is the primary preview stream in Home app, couldn't figure out what Video.2 stream does but I have a hunch that it might be a secondary preview stream for a second user in the Home app.

The bitrate values appears to be in bytes based on saved footage retrieved from iCloud as they seem to hover around the 1.8Mbps region.

Trying to use the setprop command to change the respective MaxBitrate properties didn't quite work - setprop did indeed change the value, but upon starting a preview stream the values reverted again, the Video.1.H264VBR.MaxBitrate value did notably vary when the preview stream is active but it never seem to exceed 1046201 (just shy of 1Mbps).

Going through the /mnt/config/flash_config.ini file reveals two entries - bitrate0 and bitrate1 which by default is set to 0. The system seem to retain new values specified here (after figuring out that one has to remove the checksum = xxx line along with any blank spaces before running md5sum on the file) however it didn't seem to make any difference to the maximum video bitrate.

I then tried to grep the whole file system to look for the string 2000000 and found references in the camera log referring to bitrates set by the /tmp/out/camera binary.

As I'm not quite versed in inspecting data within binaries, any chance that you could please have a look @mcchas ?


On a side note, I've figured out how to set the time zone so the correct time appears when the time stamp is enabled (osd = 1).

The time zone appears to be specified in /etc/profile

After setting up the correct NTP server and confirming that the unit has the correct UTC time via the date -u command, I was able to determine that the default time zone data is set TZ=GMT-8 (for the EU unit I have) actually results in a GMT+8 time instead.

So setting the time involves changing the TZ= entry to your local time zone and invert the +/- prefix.

If you are located in a time zone with daylight savings, this would also help too:

As an alternative method to the specification of timezones using a pathname to a description file, SUSv3 describes the POSIX model. In this format, a string is defined as:

std offset [dst[offset][,start-date[/time],end-date[/time]]]
where std is the standard component name and dst is the daylight saving one. Each name consists of three or more characters. The offset is positive for timezones west of the prime meridian and negative for those east of the meridian. The offset is added to the local time to obtain UTC (formerly known as GMT). The start and end time fields indicate when the standard/daylight transitions occur.

For example, in the Eastern United States, standard time is 5-hours earlier than UTC, and we can specify EST5EDT in lieu of America/New_York. These alternatives are not always recognized, however, especially for zones outside of the United States and are best avoided.

HP-UX (an SUSv3 compliant UNIX) uses textual rules in /usr/lib/tztab and the POSIX names like EST5EDT, CST6CDT, MST7MDT, PST8PDT. The file includes all of the historical rules for each time zone, akin to the Olson database.

For someone residing in the Australian Central Standard/Daylight Time, the entry would be TZ=ACST-9:30ACDT

Reboot the unit after making the changes to see the updated changes.

Not work with 2.1.1_0002.0515

Hi

Thanks for your awesome mods.

I tried use the hostname trick but not worked. (2.1.1_0002.0515)

Any idea please?

Enable ssh or ftp

Hello
Thanks for hack!

Is it possible to enable ssh or ftp or netcat for download video from camera?

From original app aqara I can access to the sd card. Maybe ftp already up?

no entry point, no way in

hey, had a look onto the boot up log, but can't find the hostname command not found entry. What do I need to do to get the hostname changed or to trigger this the rename of the host ?

I am on the version 2.2.1 and 2.1.x before also do not work ...

r Stefan

G2H Pro - working or not ???

Hi all,

did anyone get tis SD card hostname hack working on G2H Pro? Which firmware version?

Mine FW 3.4.6 seems not to work. No time to play with attaching the serial console for debugging :( ...

Did anyone dumped whole file system to tgz of some FW where the hack worked ??

Can anyone / author post the serial console boot log here ???

Any other ways how to get root / RTSP working on G2H Pro ?

Thanx for sharing any experience.

RTSP server not starting

Nice to see that it should be finally possible to use the g2h as a rtsp cam. Telnet is working fine on my end but I'm unable to start the rtsp server on startup. Your hostname file seems to load fine as all the other files are correctly backuped or created. But after using netstat -anl I don't see the rtsp service running on port 554.

# netstat -anl
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:101           0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:54355         0.0.0.0:*               LISTEN
tcp        0      0 0.0.0.0:23              0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:1883          0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:48383         127.0.0.1:1883          ESTABLISHED
tcp        0      0 127.0.0.1:1883          127.0.0.1:48383         ESTABLISHED
tcp        0    328 10.0.0.152:23           10.0.0.13:58851         ESTABLISHED
tcp        0      0 127.0.0.1:1883          127.0.0.1:48384         ESTABLISHED
tcp        0      0 127.0.0.1:48384         127.0.0.1:1883          ESTABLISHED
udp        0      0 0.0.0.0:32869           0.0.0.0:*
udp        0      0 0.0.0.0:5353            0.0.0.0:*
udp        0      0 127.0.0.1:51858         0.0.0.0:*
udp        0      0 0.0.0.0:55707           0.0.0.0:*
udp        0      0 0.0.0.0:10020           0.0.0.0:*
Active UNIX domain sockets (servers and established)
Proto RefCnt Flags       Type       State         I-Node Path
unix  2      [ ACC ]     STREAM     LISTENING       1825 /dev/socket/property_service
unix  2      [ ACC ]     STREAM     LISTENING       1893 /var/run/mdnsd
unix  3      [ ]         DGRAM                      2714 /var/run/wpa_supplicant/wlan0
unix  2      [ ]         DGRAM                      2718 /tmp/wpa_ctrl_123-1
unix  2      [ ACC ]     STREAM     LISTENING       2138 @property_service
unix  3      [ ]         STREAM     CONNECTED       2143
unix  3      [ ]         STREAM     CONNECTED       2152
unix  3      [ ]         STREAM     CONNECTED       2658
unix  3      [ ]         STREAM     CONNECTED       1827
unix  3      [ ]         STREAM     CONNECTED       2144
unix  3      [ ]         STREAM     CONNECTED       2185
unix  3      [ ]         STREAM     CONNECTED       1828
unix  3      [ ]         STREAM     CONNECTED       2184
unix  3      [ ]         STREAM     CONNECTED       2145
unix  3      [ ]         STREAM     CONNECTED       2153 @property_service
unix  3      [ ]         STREAM     CONNECTED       2146
unix  3      [ ]         STREAM     CONNECTED       2659 /var/run/mdnsd

To me it seems that the whole homekit stuff is still running... not sure what I'm doing wrong.

Is there any difference if I'm connecting the Wifi of the Cam via hostname file, homekit or Aqara Mobile App? Should the sdcard be inserted at the very beginning or only after successfully connecting Wifi?

inaccessible 2.2.1_0001.0515

Camera went offline after using the script. I am unable to connect the camera to either aqara app or homekit. I did a factory reset and still cannot connect to it. Any steps I can take to fix this?

Can't get my device to load hostname

Hi,

Unpacked and added my device to the Aqara Home app, I see the firmware are 2.2.1_0001_0515

Formatted a new SD as a single partition (tried both MBR and GPT) formatted as FAT32, copied the hostname, inserted to the device and plugged in the power (also tried to reset to factory default (did hear the message) and had the SD card inserted during startup).

Can't see there are any services running either Telnet or RTSP.
Should 2.2.1_0001_0515 work?

If I look at the SD afterwards. there are a /log and /record folder in addition to the hostname on SD root.

What am I missing?

EDIT: Damn, tried another time, and it did work!

G2H RTSP

Hello. Can you please help me: how to enable the sound by RTSP?

Hostname script not enabling RTSP

Hi,

First off, thanks for taking the time to do this! Telnet access was successful.

Was unable to get RTSP running using the hostname file. After a few hours of tinkering i noticed that the changes weren't being made the the relevant files.

The line test -f /etc/tar_app.sh_save || cat << EOF > /etc/tar_app.sh doesn't change tar_app.sh as the save file is created in the earlier command and this only executes if the save file isn't there.

Same for the previous command test -f /etc/normal.xml_save || cat << EOF > /etc/normal.xml

I modified it to execute by changing to test -f /etc/tar_app.sh_save && cat << EOF > /etc/tar_app.sh and test -f /etc/normal.xml_save && cat << EOF > /etc/normal.xml

Not sure if there is something i'm missing.

However I have a problem that i hope you might be able to shed some light on. During this time tinkering, a simple copy paste error meant that I now have an unbootable device.

Modifying the tar_app.sh file, I missed the cd off cd /local. So i think it did a chmod on root /. So now during boot i get init: skipping insecure file /init.rc so it hangs and nothing loads.

Wondering if you have any ideas on how i could recover from this? I'm a bit over my head on this one.

Thanks again for your work!

[edit]

Seems i was mistaken.. Hexdump code is fine.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.