mcchas / g2h-camera-mods

Modifying the G2H camera with rtsp, security and not to call home
MIT License
107 stars 14 forks source link

Problem with IR light #9

Closed oneminc closed 2 years ago

oneminc commented 3 years ago

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

mcchas commented 3 years ago

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

I haven't seen that issue on mine. Can you share what version of firmware you are running and the contents of /mnt/config/flash_config.ini ?

oneminc commented 3 years ago

If you connect in the dark, the IR light goes out after five seconds. But if you connect during daylight hours, and then darkness falls, the backlight will work correctly, but until the next connection

https://www.youtube.com/watch?v=scSjIGCFUeo

firmware 2.1.1_0002.0515

git_head = 23c88446c0c00834a739e2772fddb4b07e2b2851
build_time = 2020/12/01 14:11:48
firmware_version = 2.1.1
[misc]
cloud                          = 1
language                       = en

[network]
ip                             = 192.168.0.239
netmask                        = 255.255.255.0
gateway                        = 192.168.0.1
dns1                           = 4.4.4.4
dns2                           = 8.8.8.8
dhcp                           = 1

[wifi]
auth                           = 2
enc                            = 3

[test]
var1                           =
var2                           =
var3                           = 0x0
var4                           = 0x0

[video]
video_on                       = 1
osd                            = 1
ldc                            = 1
wdr                            = 1
flip                           = 0
pwr_freq                       = 0
codec                          = 0
brightness                     = 50
contrast                       = 50
saturation                     = 50
hue                            = 50
fps0                           = 0
fps1                           = 0
bitrate0                       = 0
bitrate1                       = 0
motion_region                  = 111111111111111111111111
md_sensitivity                 = 1

[audio]
in_vol                         = 80
out_vol                        = 80
in_mute                        = 0
out_mute                       = 0
sd_sensivity                   = 1

[gpio]
led                            = 1
nightvision                    = 2

[gateway]

[record]
enable                         = 1
mode                           = 1
cover                          = 1
tlp_enable                     = 0
tlp_starttime                  = 00:00
tlp_endtime                    = 23:59
tlp_day                        = 1111111

[alarm]
peroid                         = 180
sound_enable                   = 0
motion_enable                  = 0
sound_push                     = 0
motion_push                    = 0
starttime                      = 00:00
endtime                        = 23:59
day                            = 1111111

[rtsp]
port                           = 554

[samba]
server                         =
path                           =
user                           =
passwd                         =
enable                         = 0
sync_interval                  = 60
video_save_time                = 86400

[miio]
reserve                        =

[tutk]
live_ch                        = 1
playback_ch                    = 0

[aiot]
ota                            = 0

[ppcs]
uid                            = AQARA-******-*****
apilicense                     = ******
initstring                     = ****************************************:aqara_p2p_key
crckey                         = aqaraCRC
live_ch                        = 0
playback_ch                    = 0

[homekit]
paird_status                   = 1
mfi_address                    = 0x10
camera_active                  = 1
iseverpaired                   = 1

checksum = be7bc4396547c0ff78d6bc702e10f21b
mcchas commented 3 years ago

I just tested two of my cameras and can replicate your issue - IR goes off after a few seconds. I suspect this could be another simple patch to the camera binary hopefully, I will fire up Ghidra and do some debugging when I get some spare time.

oneminc commented 3 years ago

Thanks, I will wait for the fix

mcchas commented 2 years ago

Managed to find some time for this. From what it looks like the RTSP connection triggers this function - which turns on the IR LED, waits 6 seconds and then turns it off (??). If I patch the 'off / 0x01' to an 'on / 0x00' this problem goes away. From my limited testing it will switch off again when it senses brightness.

image

Using the hexdump + sed hack this works around the issue 's/20 46 01 21 bd e8 38 40/20 46 00 21 bd e8 38 40/' - I've tested this on two firmware versions and it seems ok. I'll update the script - Let me know if this works for you.

oneminc commented 2 years ago

It works! Thanks!