X6C-WEQ dual-lens camera based on XM530V200 dual-core SoC (ARMv7).

![Screenshot](images/wifi_camera.png)

Features:
- HTTP (port 80)
- Onvif (port 8899)
- RTSP (port 554, *rtsp://CAMERA-IP::554/user=admin&password=&channel=1&stream=0.sdp*)

Please note that many cameras look the same on the outside, but they have a different hardware and software (https://tehno32.ru/download/xm_ipc).


## Partitions
```
Partition	Size (bytes)  Name    Mount point   Update file
mtdblock0	262144        boot                  u-boot.bin.img, u-boot.env.img
mtdblock1	1572864       kernel                uImage.img
mtdblock2	1310720       romfs   /             romfs-x.cramfs.img
mtdblock3	4653056       user    /usr          user-x.cramfs.img
mtdblock4	262144        custom  /mnt/custom   custom-x.cramfs.img
mtdblock5	327680        mtd     /mnt/mtd   		
```
**Tip:** You can use `/mnt/mtd` partition (JFFS2) for your personal files  


## Telnet access
Even though I highly discourage playing around with bootloader, typical solution to `setenv telnetctrl 1` is not going to work as `telnetctrl` variable has been removed from U-boot.

In this firmware telnetd and ftpd are not compiled into busybox, so any tricks to enable them won't work. Solution is to run a different version either from microSD card or custom firmware.

Additionally, busybox has been modified and uses `/mnt/mtd/Log/ns` (**root/unknown password**) instead of `/etc/passwd` (**root/xmhdipc**) for login.
You can either remove root password by overwriting `/mnt/mtd/Log/ns` or run telnetd so that it goes directly to shell (check [microsd/sd_run.sh](microsd/sd_run.sh) file).


## Telnet (microSD card) 
`/usr/bin/dvrHelper` is responsible for mounting microSD card as `/home`. After mount it checks for existence of `/home/sd_upgrade_all.bin` (firmware image) and `/home/sd_run.sh` (custom script). You can use the latter for your modifications.
1. Copy contents of [microsd](microsd) directory to microSD card formatted as FAT32 
2. Edit `sd_run.sh` settings to your needs
3. Insert microSD card into your camera and turn it on


## Telnet (firmware update)
`/etc/init.d/rcS` executes `/mnt/custom/extapp.sh &` (if exists) - you can add `extapp.sh` to firmware image `custom-x.cramfs.img` and perform update.


## Easter Egg
A fun fact regarding custom tools (armbenv, debug, dvrHelper, netinit) as they include some interesting comments in Chinese and Thai language. If you'd like to learn something about 2020 Beijing International Expo, 1984 World Cup in Beijing or 2020 National Health and Family Planning Commission, then feel free to read them.