1
0
mirror of https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks.git synced 2025-09-01 20:23:11 +02:00

Merge remote-tracking branch 'origin/master' into beta

run markdown lint
This commit is contained in:
Julian Tatsch
2022-09-17 11:48:31 +02:00
22 changed files with 228 additions and 140 deletions

View File

@@ -2,7 +2,7 @@
[![Join the chat at https://gitter.im/Xiaomi-Dafang-Hacks/Lobby](https://badges.gitter.im/Xiaomi-Dafang-Hacks/Lobby.svg)](https://gitter.im/Xiaomi-Dafang-Hacks/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
This repository contains custom firmwares for the following devices:
This repository contains custom firmware for the following devices:
Name | Picture
--- | ---

View File

@@ -9,3 +9,6 @@ PATH=/system/sdcard/bin:$PATH
# Add our custom libraries to path
LD_LIBRARY_PATH=/system/sdcard/lib:$LD_LIBRARY_PATH
# Allow "nano" to run
TERM=xterm-256color

View File

@@ -178,13 +178,17 @@ record_video () {
fi
}
if [ -f /tmp/last-night -a -n "$night_mode_event_delay" -a "$night_mode_event_delay" -gt 0 ]; then
now_ts="$(date +%s)"
night_ts="$(/system/sdcard/bin/busybox stat -c %Y /tmp/last-night)"
dt="$(($now_ts-$night_ts))"
if [ "$dt" -lt "$night_mode_event_delay" ]; then
exit 0
fi
if [ -f /tmp/last-night ]; then
if [ -n "$night_mode_event_delay" ]; then
if [ "$night_mode_event_delay" -gt 0 ]; then
now_ts="$(date +%s)"
night_ts="$(/system/sdcard/bin/busybox stat -c %Y /tmp/last-night)"
dt="$(($now_ts-$night_ts))"
if [ "$dt" -lt "$night_mode_event_delay" ]; then
exit 0
fi
fi
fi
fi
# Turn on the amber led

View File

@@ -37,7 +37,7 @@
$MQTT_COMMAND "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/motion_send_mail/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME Motion Send Emails\", \"unique_id\": \"$MAC_SIMPLE-motion-send-mail\", $DEVICE_INFO, \"icon\": \"mdi:email-send\", \"state_topic\": \"$TOPIC/motion/send_mail\", \"command_topic\": \"$TOPIC/motion/send_mail/set\"}"
# Motion send telegram alert on/off switch
$MQTT_COMMAND "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/motion_send_telegram/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME Motion Send Telegram\", \"unique_id\": \"$MAC_SIMPLE-motion-send-telegram\", $DEVICE_INFO, \"icon\": \"mdi:telegram\", \"state_topic\": \"$TOPIC/motion/send_telegram\", \"command_topic\": \"$TOPIC/motion/send_telegram/set\"}"
$MQTT_COMMAND "$AUTODISCOVERY_PREFIX/switch/$DEVICE_NAME/motion_send_telegram/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME Motion Send Telegram\", \"unique_id\": \"$MAC_SIMPLE-motion-send-telegram\", $DEVICE_INFO, \"icon\": \"mdi:send\", \"state_topic\": \"$TOPIC/motion/send_telegram\", \"command_topic\": \"$TOPIC/motion/send_telegram/set\"}"
# Motion detection snapshots
$MQTT_COMMAND "$AUTODISCOVERY_PREFIX/camera/$DEVICE_NAME/motion_snapshot/config" ${MOSQUITTOPUBOPTS} ${MOSQUITTOOPTS} -r -m "{\"name\": \"$DEVICE_NAME Motion Snapshot\", \"unique_id\": \"$MAC_SIMPLE-motion-snapshot\", $DEVICE_INFO,\"topic\": \"$TOPIC/motion/snapshot/image\"}"

Binary file not shown.

View File

@@ -1,17 +1,17 @@
Adding of Sensor:
```
``` sh
insmod /driver/sensor_jxf22.ko data_interface=2 pwdn_gpio=-1 reset_gpio=18 sensor_gpio_func=0
```
Get information about the Sensor:
Get Info about the Sensor:
echo 1 >/proc/jz/sinfo/info
Enable more RAM:
```
``` sh
echo 100 > /proc/sys/vm/swappiness
echo 16777216 > /sys/block/zram0/disksize
@@ -21,6 +21,7 @@ swapon /dev/zram0
```
Params of the Motor:
```
Insmod Motor:
hmaxstep = 2600

View File

@@ -1,42 +1,56 @@
### How does the CFW work?
# How does the CFW work?
The CFW consists of two parts:
1. The Custom Firmware, which alters the stock firmware to boot from a Micro SD card and needs to be flashed over the stock firmware. It doesn't contain any custom software, it just allows you to boot from a Micro SD card. This will only need to be done once.
2. The CFW Files, which contains the custom software. You will have to install them onto your Micro SD card after you complete step 1. You can easily modify the software by editing the files on the Micro SD card.
### Does the CFW contain a RTSP-Server?
## Does the CFW contain a RTSP-Server?
Yes, you can watch it through VLC Player.
### Does the CFW connect to any Xiaomi Servers?
## Does the CFW connect to any Xiaomi Servers?
No. It does not connect to anything.
### Does the CFW remove the stock firmware?
## Does the CFW remove the stock firmware?
No. You can still boot the stock firmware if you remove the Micro SD card.
### Is it possible to run the stock firmware and the CFW at the same time?
## Is it possible to run the stock firmware and the CFW at the same time?
No, it's not possible and it's very unlikely that this will change in the future.
### Can I revert the CFW back to stock firmware?
## Can I revert the CFW back to stock firmware?
Yes, you can. However there is no need to revert it back. If your Micro SD card does not contain the CFW Files, you will just boot the stock software. If you still want to revert back to a stock firmware just flash the appropriate one for your camera from the firmware_original folder the same way you flashed the custom firmware.
### Is it possible to run the CFW without a Micro SD card?
## Is it possible to run the CFW without a Micro SD card?
While it can be done, there will be a lot of trouble in getting it to work and is outside the scope of this project.
### Can I have FullHD resolution?
## Can I have FullHD resolution?
Yes, but you must [flash a custom bootloader](/hacks/flashinguboot.md) to achieve this.
### Can the camera send a multicast stream?
## Can the camera send a multicast stream?
Yes, uncomment and customize the multicast destination IP and port in /system/sdcard/config/rtspserver.conf and restart.
### Can I use USB ethernet cards?
## Can I use USB ethernet cards?
Yes, just create a usb_eth_driver.conf file in /system/sdcard/config.
```
``` sh
cp /system/sdcard/config/usb_eth_driver.conf.dist /system/sdcard/config/usb_eth_driver.conf
reboot
```
If this file exists the run.sh won't start the WIFI driver but will instead load the usb ethernet driver. Currently only the asix.ko driver is supported but others can be built.
### Which Features does the CFW contain?
- Full working RTSP with H264/MJPEG. Based on https://github.com/mpromonet/v4l2rtspserver
## Which Features does the CFW contain?
- Full working RTSP with H264/MJPEG. Based on <https://github.com/mpromonet/v4l2rtspserver>
- SSH-Server(dropbear) with username: root password: ismart12
- FTP-Server(bftpd) with username: root password: ismart12
- Webserver(lighttpd) with username: root password: ismart12
@@ -44,10 +58,13 @@ If this file exists the run.sh won't start the WIFI driver but will instead load
- Horizontal/vertical motor rotation / move to center
- Turn on/off blue/yellow/IR LEDs/IR-Cut
- Local h264 recording possible:
```
``` sh
/system/sdcard/bin/h264Snap > /system/sdcard/video.h264
```
- Audio recording/playing possible:
```
Playing Audio:
/system/sdcard/bin/audioplay /usr/share/notify/CN/init_ok.wav volume
@@ -55,11 +72,57 @@ Playing Audio:
Recording Audio:
/system/sdcard/bin/ossrecord /system/sdcard/test.wav
```
- Curl
- MQTT
- Telegram
- Any additional software that you may want can be compiled separately, and there is a toolchain available but you will need to do this yourself.
### What if my scripts in config/userscripts/motiondetection are not executed or mqtt/telegram messages/emails are not sent on motion?
## What are the URLs I can use to integrate with the camera?
| Type | URLs |
| --- | --- |
| RTSP video stream | `rtsp://dafang/unicast` |
| HTTP live streaming | (not available) |
| Current image (image/jpeg) | `https://dafang/cgi-bin/currentpic.cgi` |
| Get camera state | `https://dafang/cgi-bin/state.cgi?cmd=all` |
| Get system info | `https://dafang/cgi-bin/api.cgi?action=systeminfo` |
## What if my scripts in config/userscripts/motiondetection are not executed or mqtt/telegram messages/emails are not sent on motion?
Your camera probably runs out of memory when processing the motion event. This is likely in cameras with 64MB e.g. the Xiaofang 1s. Try to [enable some swap memory](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/firmware_mod/config/swap.conf.dist#L4) by copying `swap.conf.dist` to `swap.conf` and setting `SWAP=true`.
## What MQTT messages does the camera use?
### Sent by the camera
| MQTT topic | Comments |
| --- | --- |
| `<location>/<device_name>/`| General device status |
| `<location>/<device_name>/motion` | Motion detection status. Payload is either `ON` or `OFF`. |
| `<discovery_prefix>/<entity_type/<device_name>/<entity_name>/config` | Home Assistant MQTT auto discovery messages. More info: <https://www.home-assistant.io/docs/mqtt/discovery/> |
| `<location>/<device_name>/leds/blue` <br /> `<location>/<device_name>/leds/yellow` <br /> `<location>/<device_name>/leds/ir` <br /> `<location>/<device_name>/ir_cut` <br /> `<location>/<device_name>/rtsp_server` <br /> `<location>/<device_name>/night_mode` <br /> `<location>/<device_name>/night_mode/auto` <br /> `<location>/<device_name>/recording` <br /> `<location>/<device_name>/timelapse` | Camera configuration and status. Payload is either `ON` or `OFF` |
| `<location>/<device_name>/motion/detection` <br/ > `<location>/<device_name>/motion/led` <br/ > `<location>/<device_name>/motion/snapshot` <br/ > `<location>/<device_name>/motion/video` <br/ > `<location>/<device_name>/motion/mqtt_publish` <br/ > `<location>/<device_name>/motion/mqtt_snapshot` <br/ > `<location>/<device_name>/motion/send_mail` <br/ > `<location>/<device_name>/motion/send_telegram` <br/ > `<location>/<device_name>/motion/tracking` | Motion detection configuration. Payload is either `ON` or `OFF` |
| `<location>/<device_name>/motion/snapshot/image` | Sending an image via MQTT when motion is detected. |
| `<location>/<device_name>/motion/video` | Sending an video via MQTT when motion is detected. |
| `<location>/<device_name>/brightness` | Brigtness level, given as a percentage. Disabled by default. |
| `<location>/<device_name>/motors/vertical` <br/> `<location>/<device_name>/motors/horizontal` | Status of motors and alignment |
### Received by the camera
| MQTT topic | Comments |
| --- | --- |
| `<discovery_prefix>/set` | Trigger Home Assistant MQTT auto discovery announcement |
| `<location>/<device_name>/set status` | Get the device's system status |
| `<location>/<device_name>/play` | Play the audio file configured in the camera's settings |
| `<location>/<device_name>/leds/blue` | Get the device's system status |
| `<location>/<device_name>/timelapse/set` <br/> `<location>/<device_name>/recording/set` <br/> `<location>/<device_name>/rtsp_server/set` <br/> `<location>/<device_name>/rtsp_server/set` <br/> `<location>/<device_name>/night_mode/set` <br/> `<location>/<device_name>/night_mode/auto/set` <br/> `<location>/<device_name>/ir_cut/set` <br/> `<location>/<device_name>/leds/ir/set` <br/> `<location>/<device_name>/leds/yellow/set` <br/> `<location>/<device_name>/leds/blue/set` <br/> `<location>/<device_name>/motion/tracking/set` <br/> `<location>/<device_name>/motion/send_mail/set` <br/> `<location>/<device_name>/motion/detection/set` <br/> `<location>/<device_name>/motion/send_telegram/set` <br/> `<location>/<device_name>/motion/snapshot/set` <br/> `<location>/<device_name>/motion/video/set` <br/> `<location>/<device_name>/motion/mqtt_publish/set` <br/> `<location>/<device_name>/motion/mqtt_snapshot/set` <br/> `<location>/<device_name>/motion/mqtt_snapshot/set` <br/> | Enable or disable a setting. Payload must be `ON` or `OFF`. |
| `<location>/<device_name>/snapshot/image GET` | Trigger a snapshot image to be sent over MQTT. |
| `<location>/<device_name>/motors/horizontal/set` | Rotate the camera. Payload must be either `left` or `right`. |
| `<location>/<device_name>/motors/vertical/set` | Rotate the camera. Payload must be either `up` or `down`. |
| `<location>/<device_name>/motors/set calibrate` | Re-calibrate the motors. |
| `<location>/<device_name>/remount_sdcard/set ON` | Remount the SD card. |
| `<location>/<device_name>/reboot/set ON` | Reboot the camera. |
| `<location>/<device_name>/update/set ON` | Update the camera's firmware. |
| `<location>/<device_name>/set (command)` | Invoke the command using `/system/sdcard/www/cgi-bin/action.cgi` |

View File

@@ -1,6 +1,7 @@
# Dumping Firmware:
# Dumping Firmware
## The Partition Table
## The Partition Table:
```
[root@Ingenic-uc1_1:dev]# cat /proc/mtd
dev: size erasesize name
@@ -20,7 +21,8 @@ mtd10: 00010000 00008000 "flag"
Attention: The Values are in Hex. Convert into Decimal for using DD
`
## Dump everything:
## Dump everything
```
dd if=/dev/mtdblock0 of=uboot.bin
dd if=/dev/mtdblock1 of=kernel.bin
@@ -34,7 +36,3 @@ dd if=/dev/mtdblock8 of=config.bin
dd if=/dev/mtdblock9 of=para.bin
dd if=/dev/mtdblock10 of=flag.bin
```

View File

@@ -1,7 +1,7 @@
## Custom Firmware Creation:
# Custom Firmware Creation
Install following:
```
apt-get install python-click
apt-get install u-boot-tools
Install the following:
``` sh
sudo apt-get install python-click u-boot-tools
```

View File

@@ -0,0 +1,10 @@
#!/usr/bin/env bash
FIRMWARE_ROOT=$(pwd)/../../firmware_original/Neos_Smartcam/Orig_4.15.2.45/
TMPDIR=./rootfs
OUTFILE=./rootfs.bin
rm -r $TMPDIR $OUTFILE
unsquashfs -d $TMPDIR $FIRMWARE_ROOT/rootfs.bin
cp ./rcfile.sh $TMPDIR/etc/init.d/rcS
mksquashfs $TMPDIR $OUTFILE -b 131072 -comp xz -Xdict-size 100%
./packer.py $FIRMWARE_ROOT/kernel.bin $OUTFILE $FIRMWARE_ROOT/driver.bin $FIRMWARE_ROOT/appfs.bin firmware_hacked.bin
rm -r $TMPDIR $OUTFILE

View File

@@ -11,11 +11,13 @@
7. It is completely [open source](https://github.com/Dafang-Hacks/uboot)
## What are the disadvantages?
If you flash the wrong u-boot, you can brick your device. I am not taking any responsibility for that!
## Requirements:
## Requirements
1. Determine how much RAM your device has by running the following command via SSH:
```$bash
cat /proc/cmdline
```
@@ -32,9 +34,10 @@ mem + ispmem +rmem = 104M + 8M +16M = 128M
i.e. you have a device with 128 Mb RAM.
## Flashing the U-Boot bootloader:
## Flashing the U-Boot bootloader
1. Login via SSH
```bash
ssh root@dafang.local
cd /system/sdcard/
@@ -58,6 +61,7 @@ wget https://github.com/Dafang-Hacks/uboot/raw/master/compiled_bootloader/NAME_O
```bash
md5sum NAME_OF_YOUR_NEW_BOOTLOADER_FILE.bin
```
The `md5sum` command will output a string of hex. That should match the hash listed next to the bin file you downloaded for your [bootloader](https://github.com/Dafang-Hacks/uboot/tree/master/compiled_bootloader) Again, do not proceed unless the MD5 matches the version you downloaded.
6. Now erase and write the bootloader. Do not do anything else between these commands once you have erased your bootloader. Your device will be unable to boot until you have written a new bootloader.
@@ -75,9 +79,11 @@ dd if=/system/sdcard/dafang_128mb_v2.bin of=/dev/mtd0
```
7. Rename the uEnv.bootfromnand.txt in your minisd card root to uEnv.txt to enable booting from NAND:
```bash
mv uEnv.bootfromnand.txt uEnv.txt
```
## Verify that the U-Boot-Loader works correctly
Reboot your camera
@@ -91,14 +97,14 @@ If the led turns blue -> The custom configuration from uEnv.txt is used.
If the led is not turning blue despite having an uEnv.txt on your microsd - try to format the sdcard as FAT16 and try again.
## Enable FullHD (on 128 Mb devices only):
## Enable FullHD (on 128 Mb devices only)
Open the uEnv.txt file
```$bash
vi /system/sdcard/uEnv.txt
```
and change the "boot-line" from:
`mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000`
@@ -114,4 +120,5 @@ cat /proc/cmdline
```
## My camera doesn't boot/I have failed to flash the bootloader. What can I do now?
You will need to desolder your bootrom, [reflash it](https://github.com/Dafang-Hacks/spiflasher) and solder it back.

View File

@@ -1,10 +1,16 @@
# Getting Root Access
## Using U-Boot
1. Boot into Uboot(press a Key when booting)
2. Use the following Command to get a Root-Shell
### 128MB Devices
`setenv bootargs console=ttyS1,115200n8 mem=104M@0x0 ispmem=8M@0x6800000 rmem=16M@0x7000000 init=/bin/sh rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256k(boot),2048k(kernel),3392k(root),640k(driver),4736k(appfs),2048k(backupk),640k(backupd),2048k(backupa),256k(config),256k(para),-(flag)`
### 64MB Devices (S1 etc)
`setenv bootargs console=ttyS1,115200n8 mem=41700K@0x0 ispmem=8M@0x28B9000 rmem=15644K@0x30B9000 init=/bin/sh rootfstype=squashfs root=/dev/mtdblock2 rw mtdparts=jz_sfc:256k(boot),2048k(kernel),3392k(root),640k(driver),4736k(appfs),2048k(backupk),640k(backupd),2048k(backupa),256k(config),256k(para),-(flag)`
3. Boot into the Root-Shell using "boot"
@@ -18,4 +24,3 @@ Password: ismart12
Attention: You will get a lot of debug messages, and you wont be able to work "normal".
To cirvumvent this, it's recommended to start a telnet daemon: `telnetd &` and connect to the device via telnet.

View File

@@ -1,4 +1,4 @@
## Installation of the microSD bootloader
# Installation of the microSD bootloader
1. Download the CFW-Binary for your Camera
@@ -6,9 +6,10 @@
--- | ---
[Xiaomi DaFang](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/dafang/cfw-1.3.bin) | d45826d5b471564366b3b9435509df7e8a2c0720656ea2b4bcac6dd0b42cc3eb
[Xiaomi XiaoFang T20](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/xiaofang/cfw-1.0.bin) | 333053c3e98af24e0e90746d95e310a3c65b61f697288f974b702a5bcbba48a9
[Wyzecam V2/Neos SmartCam](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/wyzecam_v2/cfw-1.2.bin) | ca8fd695fe1903bd12aca2752c86b62c9694430c9c41b2804b006c22e84f409d
[Wyzecam V2](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/wyzecam_v2/cfw-1.2.bin) | 3b2deb32d0cd3ef75afef8788854883d868c09cf78c690f4b78fc26862793af3
[Neos SmartCam](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/neos_smartcam/cfw-1.0.bin) | 141072077ad12e343d90c7905d0f747e5dfa07853f013328638fb16cbe26a2cd
[Wyzecam Pan](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/wyzecam_pan/cfw-1.0.bin) | f76990d187e763f160f5ad39331d6a3209d3025fe3719cb43c92dbad92cebba2
Xiaomi XiaoFang T20L | [Start here](/hacks/install_cfw_t10l.md.md)
Xiaomi XiaoFang T20L | [Start here](/hacks/install_cfw_t20l.md)
Sannce & clones | [Start here](/hacks/install_sannce.md)
Other Ingenic T10/T20 Device | [Start here](/hacks/newdevices.md)
@@ -28,6 +29,7 @@
2. Copy everything from "firmware_mod" folder into the **root** of the microSD
It should look like this:
```
E:/
├── autoupdate.sh
@@ -48,7 +50,7 @@ E:/
3. Copy config/wpa_supplicant.conf.dist to config/wpa_supplicant.conf
4. Modify the file config/wpa_supplicant.conf on the microSD card to match your wifi-settings. Make sure wpa_supplicant.conf does not have windows line endings.
5. Insert the microSD card and power up the camera.
6. You can now login at https://dafang or your cameras ip adress with the default credentials root/ismart12
6. You can now login at <https://dafang> or your cameras ip adress with the default credentials root/ismart12
Hint: The security warning about the unsafe https certificate can safely be ignored. A self-signed certificate is automatically generated on your camera during the first startup. By its nature your little camera's own certificate authority is not and never will be among the trusted ones delivered with the major browsers.
@@ -60,7 +62,6 @@ You can just update through the MI-Home App.
If you are on original firmware below 5.5.200, you will have to "reflash" the microsd-bootloader afterwards
If you are on original firmware 5.5.200 and update to 5.5.243, the bootloader won't be affected.
## Updating Firmware
If you already have a current custom firmware with custom bootloader installed, you only need to update the content of the microSD card
@@ -70,7 +71,6 @@ If you already have a current custom firmware with custom bootloader installed,
3. Put everything from "firmware_mod" folder into the **root** of the microSD card
4. Copy the backed up wpa_supplicant.conf from step 1 back into the config folder
## Uninstallation
Remove the "run.sh" file from the microSD card.
@@ -81,25 +81,23 @@ Remove the "run.sh" file from the microSD card.
2. If the bootloader step is not working, double check the microSD card again for files or folders created by the stock firmware. (Sometimes if your timing is off with the setup press the camera will create a time stamp related folder that needs to be deleted before trying again).
3. Make a note of the MAC for the camera and if possible set up DHCP to assign a specific IP address that can be monitored visually in DHCP logs.
4. Start with fewer entries in your wpa_supplicant.conf to isolate WiFi issues.
5. SD card troubles may be fixed by formatting the card using the <a href = 'https://www.sdcard.org/downloads/formatter/'>official SD Memory Card Formatter</a>
5. SD card troubles may be fixed by formatting the card using the <https://www.sdcard.org/downloads/formatter/>official SD Memory Card Formatter</a>
```
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
ap_scan=1
network={
ssid="enteryourssidherebutrememebertokeepthequotes"
psk="enteryourpasswordherebutremembertokeepthequotes"
ssid="enteryourssidherebutrememebertokeepthequotes"
psk="enteryourpasswordherebutremembertokeepthequotes"
key_mgmt=WPA-PSK
}
```
5. Inspect you sdcard for logs/startup.log
5. Inspect you sdcard for logs/startup.log
### Advanced Installation
Attention: For experienced users/developers only:
[Start here](/hacks/install_sdcard.md)

View File

@@ -1,15 +1,16 @@
##安装microSD bootloader
# 安装microSD bootloader
1.下载相机的CFW-Binary
名称| SHA3-256
Name | SHA3-256
--- | ---
[Xiaomi DaFang]https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/dafang/cfw-1.3.bin| d45826d5b471564366b3b9435509df7e8a2c0720656ea2b4bcac6dd0b42cc3eb
[Xiaomi XiaoFang T20]https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/xiaofang/cfw-1.0.bin| 333053c3e98af24e0e90746d95e310a3c65b61f697288f974b702a5bcbba48a9
[Wyzecam V2]https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/wyzecam_v2/cfw-1.1.bin| ca8fd695fe1903bd12aca2752c86b62c9694430c9c41b2804b006c22e84f409d
[Wyzecam Pan]https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/wyzecam_pan/cfw-1.0.bin| f76990d187e763f160f5ad39331d6a3209d3025fe3719cb43c92dbad92cebba2
Sannceclones | [从这里开始]/ hacks / install_sannce.md
其他Ingenic T10 / T20设备| [从这里开始]/ hacks / newdevices.md
[Xiaomi DaFang](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/dafang/cfw-1.3.bin) | d45826d5b471564366b3b9435509df7e8a2c0720656ea2b4bcac6dd0b42cc3eb
[Xiaomi XiaoFang T20](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/xiaofang/cfw-1.0.bin) | 333053c3e98af24e0e90746d95e310a3c65b61f697288f974b702a5bcbba48a9
[Wyzecam V2/Neos SmartCam](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/wyzecam_v2/cfw-1.2.bin) | 3b2deb32d0cd3ef75afef8788854883d868c09cf78c690f4b78fc26862793af3
[Wyzecam Pan](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/raw/master/hacks/cfw/wyzecam_pan/cfw-1.0.bin) | f76990d187e763f160f5ad39331d6a3209d3025fe3719cb43c92dbad92cebba2
Xiaomi XiaoFang T20L | [Start here](/hacks/install_cfw_t10l.md.md)
Sannce & clones | [Start here](/hacks/install_sannce.md)
其它君正 T10/T20 设备 | [Start here](/hacks/newdevices.md)
2.将microSD格式化为FAT32。 NTFSEXFAT等不起作用。尝试使用较小的旧SD卡如512 MB或仅在其上创建一个主512 MB分区以获得最大成功率。
@@ -27,30 +28,30 @@
9.取出microSD卡并打开相机电源
10.你应该看到蓝色LED闪耀5秒钟不闪烁** **基地开始移动DaFang / Wyzecam Pan。如果没有出了点问题。您应该尝试使用另一张microSD卡然后查看页面底部的社区提示。从第1步开始。
10.你应该看到蓝色LED闪耀5秒钟不闪烁****基地开始移动DaFang / Wyzecam Pan。如果没有出了点问题。您应该尝试使用另一张microSD卡然后查看页面底部的社区提示。从第1步开始。
##安装新固件
## 安装新固件
1.从github克隆存储库。如果您在Windows上请将存储库下载为zip文件。确保没有任何东西获得Windows行结尾。
2.将“firmware_mod”文件夹中的所有内容复制到microSD的**根**中
它应该如下所示:
```
E/
├──媒体
├──autoupdate.sh
├──
├──配置
├──对照
├──司机
├──run.sh
├──脚本
├──uEnv.bootfromnand.txt
├──uEnv.bootfromsdcard.txt
├──uboot-flash
└──www
E:/
├── autoupdate.sh
├── bin
├── config
├── controlscripts
├── driver
├── media
├── run.sh
├── scripts
├── uEnv.bootfromnand.txt
├── uEnv.bootfromsdcard.txt
├── uboot-flash
└── www
```
@@ -62,23 +63,19 @@ E/
6.您现在可以使用默认凭据root / ismart12登录https// dafang或您的摄像机IP地址
提示可以安全地忽略有关不安全的https证书的安全警告。首次启动时相机会自动生成自签名证书。就其本质而言您的小型相机自己的证书颁发机构并非永远不会成为主流浏览器提供的可信赖的证书。
##更新microsd-bootloader
## 更新microsd-bootloader
通常它不需要更新microsd-bootloader。但是如果您使用的是原始固件则可能对新版本感兴趣。
您可以通过MI-Home应用程序进行更新。
如果您的原始固件低于5.5.200则必须在之后“重新刷新”microsd-bootloader
如果您使用的是原始固件5.5.200并更新到5.5.243,则引导加载程序不会受到影响。
##更新固件
## 更新固件
如果您已安装了安装了自定义引导加载程序的当前自定义固件则只需更新microSD卡的内容即可
@@ -90,12 +87,11 @@ E/
4.将备份的wpa_supplicant.conf从步骤1复制回config文件夹
##卸载
## 卸载
从microSD卡中删除“run.sh”文件。
##社区提示
## 社区提示
1.使用小于1 GB的microSD卡如512 MB并覆盖相同的卡以最大限度地减少变化。仅格式化前512 MB也适用于某些人。
@@ -104,6 +100,7 @@ E/
3.记下摄像机的MAC如果可能设置DHCP以分配可在DHCP日志中直观监视的特定IP地址。
4.从wpa_supplicant.conf中的较少条目开始以隔离WiFi问题。
```
ctrl_interface =的/ var /运行/的wpa_supplicant
ctrl_interface_group = 0

View File

@@ -1,5 +1,3 @@
### Current State:
Please go to https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/625
# Current State
Please go to <https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/625>

View File

@@ -1,4 +1,4 @@
## Installation of the Open Source Camera Firmware
# Installation of the Open Source Camera Firmware
1. Install the classic Xiaomi-Dafang-Hacks custom firmware appropriate for your camera (if not already done) and [flash the open source bootloader](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/flashinguboot.md)
@@ -6,15 +6,15 @@
Hint: Use a different MicroSD card than your normal Xiaomi-Dafang-Hacks one to debug issues faster.
3. Mount your EXT3 partition and clone https://github.com/Dafang-Hacks/rootfs right into it.
3. Mount your EXT3 partition and clone <https://github.com/Dafang-Hacks/rootfs> right into it.
Try not to use Windows due to symlinks, line endings etc.
4. Put your credentials on etc/wpa_supplicant.conf in your EXT3 partition
5. Unmount the MicroSD card
6. Put the MicroSD card in your camera and boot it
## Features
## Features:
* Complete open source
* Audio should be working now
* No more /system/sdcard/ paths. Everything will have its own place.
@@ -22,5 +22,6 @@ Try not to use Windows due to symlinks, line endings etc.
* IPKG-Manager : Install it using following [tutorial](https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/issues/542).
It will provide a lot of cool software without compiling (git, python etc.)
## Known issues:
## Known issues
* A lot of scripts classic Xiaomi-Dafang-Hacks are broken and need refactoring - mostly paths.

View File

@@ -1,18 +1,18 @@
## Installattion of Telnet
# Installattion of Telnet
1. Go to /system/bin/
2. Copy file "iCamera" to "iCamera.old"
3. Create new File "iCamera" and give it chmod 777:
```
``` sh
#!/bin/sh
busybox telnetd &
```
## Connect to your network:
## Connect to your network
Copy following File into /system/dafang/wpa_supplicant.conf
```
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
@@ -28,10 +28,10 @@ network={
priority=2
}
```
Run following Commands:
```
``` sh
wpa_supplicant -B -i wlan0 -c /system/dafang/wpa_supplicant.conf -P /var/run/wpa_supplicant.pid
udhcpc -i wlan0 -p /var/run/udhcpc.pid -b
```

View File

@@ -1,13 +1,13 @@
# Install new Version using the SD-Card
## Install new Version using the SD-Card
```$xslt
flash_eraseall /dev/mtd4
dd if=appfs.bin of=/dev/mtd4
```
## Install new Version using the Bootloader
### Install new Version using the Bootloader:
```$xslt
fatls mmc 0:1
fatload mmc 0:1 0x80600000 dafang_128mb_v2.bin

View File

@@ -1,22 +1,25 @@
### Installation on generic T10/T20 Devices
# Installation on generic T10/T20 Devices
It should be possible to install this hack to any T10 or T20 based devices. If you want to do so, begin with the porting tutorial:
The process consists of 3 steps:
### Information gathering
## Information gathering
1. Disassemble the Device and make a lot of photos.
2. Connect via TTL to the camera. You can use the following blog article as a reference: https://nm-projects.de/2016/12/hacking-digoo-bb-m2-mini-wifi-part-1-identify-the-serial-interface/
3. Get root access: https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/getroot.md
2. Connect via TTL to the camera. You can use the following blog article as a reference: <https://nm-projects.de/2016/12/hacking-digoo-bb-m2-mini-wifi-part-1-identify-the-serial-interface/>
3. Get root access: <https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/getroot.md>
4. Dump the firmware:
https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/firmware-dump.md
<https://github.com/EliasKotlyar/Xiaomi-Dafang-Hacks/blob/master/hacks/firmware-dump.md>
5. Dump a bootlog of your camera
6. Collect all the information together in a github issue in this repository
### Finding a method to boot into a CFW:
### Finding a method to boot into a CFW
1. Check the bootlog of your camera. Its often has an option to flash the whole firmware. Often it can be triggered by having a special file on your microsd / holding some button.
In Xiaomi based devices its often called "demo.bin"
```
Hit any key to stop autoboot: 0
jiabo_do_auto_update!!!!!!!!!!!!!!!!!!!!!!!!
@@ -49,6 +52,7 @@ SF: Detected GD25Q128
```
Other manufacturers have often some other routine like:
```
Hit any key to stop autoboot: 0
>>>>Auto upgrade start!
@@ -81,11 +85,10 @@ SF: 2097152 bytes @ 0x40000 Read: OK
If there is a possibility of upgrading the firmware trough the bootloader, you can try to modify the rootfs and include some script to boot from the microsd. Here is a tutorial. You will probably need to adjust the scripts:
![Tutorial](/hackshowto_modfirmware.md)
2. If there is no option for an upgrade of your firmware, you can still try to flash something on your device by stopping the bootloader and flashing a different bootloader, which can boot from microsd.
To do so, please collect the following informations:
1. Which SOC is your device running? T10 or T20?
2. How much ram does the device has?
@@ -93,11 +96,12 @@ Both informations can be collected from the bootlog.
As soon as you know how much ram it has, you can try to flash a different bootloader by stopping the bootloader and using the following commands:
First you need to collect a bootloader which is suitable for your device. You can find different bootloaders here:
https://github.com/Dafang-Hacks/uboot/tree/master/compiled_bootloader
<https://github.com/Dafang-Hacks/uboot/tree/master/compiled_bootloader>
Ask for help if needed.
Here are the commands for flashing the bootloader:
```
fatls mmc 0:1
fatload mmc 0:1 0x80600000 bootloader.bin
@@ -105,8 +109,6 @@ sf probe
sf update 0x80600000 0x0 0x40000
```
##Attention: You may brick your camera!! Please consider that before flashing a different bootloader. We are not responsible for a brick. ##
## Attention: You may brick your camera!! Please consider that before flashing a different bootloader. We are not responsible for a brick
3. Booting into CFW: As soon as you have a possibility to boot your device, you can try to boot into the CFW. Use one of the tutorials depending on your booting method.

View File

@@ -1,10 +1,11 @@
## Testpoints on Board:
# Testpoints on Board
![Headers](/hacks/serial/headers_sample.jpg)
## Hardware required for debugging
## Hardware required for debugging:
FTDI-Adapter with 3.3V
## Connection command
picocom -b 115200 /dev/ttyUSB0

View File

@@ -1,6 +1,6 @@
## Xiaomi Dafang Integration in Home Assistant
# Xiaomi Dafang Integration in Home Assistant
### On the Home Assistant side
## On the Home Assistant side
First let's set up your camera stream. Make sure the _rtsp_ service in the _Services control panel_ is running and you can connect to it via a media player (like [VLC](https://www.videolan.org/)) using the address `rtsp://dafang:8554/unicast`.
@@ -50,7 +50,7 @@ MOSQUITTOOPTS="-V mqttv311"
in `mqtt.conf`.
### On the Xiaomi Dafang Camera side:
### On the Xiaomi Dafang Camera side
Connect to your camera via SSH (or your preferred FTP client):
@@ -65,7 +65,7 @@ cp /system/sdcard/config/mqtt.conf.dist /system/sdcard/config/mqtt.conf
```
Set up your broker, LOCATION and DEVICE_NAME
and uncomment AUTODISCOVERY_PREFIX (only then the dafang configurations will be published):
and uncomment AUTODISCOVERY_PREFIX (only then the dafang configurations will be published, IMPORTANT: LOCATION and DEVICE_NAME need to be snake case!):
```shell
vi /system/sdcard/config/mqtt.conf
@@ -103,7 +103,7 @@ Dafang3:
- cover.dafang3_move_up_down
```
### To set up MQTT motion detection alerts:
### To set up MQTT motion detection alerts
copy `/system/sdcard/config/motion.conf.dist` to `/system/sdcard/config/motion.conf`: