wz_mini_hacks/README.md

288 lines
14 KiB
Markdown
Raw Normal View History

2022-03-30 06:06:53 +00:00
# wz_mini_hacks
2022-04-13 06:26:15 +00:00
### v3/PANv2 devices ONLY
2022-03-30 06:06:53 +00:00
Run whatever firmware you want on your v3/PANv2 and have root access to the device. This is in early stages of testing, use CAUTION if you are unsure of what you are doing. No support whatsoever is offered with this release.
2022-04-21 21:29:32 +00:00
**Do not contact the manufacturer for information or support, they will not be able to assist or advise you!**
## Important matters related to security
Using this project can potentially expose your device to the open internet depending on the configuration of your network. You alone are responsible for the configuration and security of your network, make sure you are aware of the risks involved before using.
2022-04-13 04:13:18 +00:00
2022-04-21 21:38:36 +00:00
## Related Projects:
2022-04-13 06:26:15 +00:00
* wz_mini_debian: run full debian in a chroot, on the camera!
* wz_mini_utils: various statically compiled binaries for use with the camera (mipsel)
2022-04-13 04:13:18 +00:00
## Features
* No modification is done to the device filesystem. **_Zero!_**
* Custom kernel loads all required files from micro-sd card at boot time
* Wireguard and IPv6 support enabled
* Supports the following USB Ethernet adapters:
* ASIX AX88xxx Based USB 2.0 Ethernet Adapters
* ASIX AX88179/178A USB 3.0/2.0 to Gigabit Ethernet
* Realtek RTL8152 Based USB 2.0 Ethernet Adapters
2022-04-15 08:51:18 +00:00
* USB gadget support, connect the camera directly to a supported router to get an internet connection, no USB Ethernet Adapter required, using USB CDC_NCM.
2022-04-13 04:13:18 +00:00
* Easy uninstall, just remove files from micro-sd card, or don't use a micro-sd card at all!
* Add your own changes to run at boot into the script on the micro sd card located at /media/mmc/run_mmc.sh, mount nfs, run ping, whatever you want
* Ability to update to the latest stable or beta firmware, this mod should survive updates as long as the bootloader remains the same
* Ability to block remote AND app initiated firmware updates
2022-04-13 06:26:15 +00:00
* Works on ANY firmware release (so far!)
2022-04-13 04:13:18 +00:00
* DNS Spoofing or Telnet mod are *not* required prior to installation
2022-04-20 02:00:30 +00:00
* RTSP Server included, stream video and or audio over LAN
* Tethering to android phones via RNDIS
* USB Mass storage enabled, mount USB SSD/HDD/flash drives
* CIFS Supported
2022-05-07 08:23:49 +00:00
* Play .WAV files using "aplay <file> <vol>" command
2022-05-08 07:56:55 +00:00
* iptables included
2022-05-18 20:05:38 +00:00
* Use your camera as a spare USB Web Camera on your PC!
2022-04-15 08:51:18 +00:00
* Inspired by HclX, bakueikozo, and mnakada!
2022-03-30 06:06:53 +00:00
2022-04-13 19:59:04 +00:00
## Coming Soon
2022-05-12 10:05:16 +00:00
* onvif - maybe
* overlayfs support
2022-04-21 21:29:32 +00:00
## How you can help!
2022-04-24 00:30:57 +00:00
* Vertical Tilt on the PANv2 doesn't work properly. Only does this on the modified kernel. Need investigation why this happens.
2022-04-21 21:29:32 +00:00
2022-04-05 16:40:59 +00:00
## Prerequisites
2022-04-13 04:13:18 +00:00
* Person
* Computer
* 256MB or larger Micro-SD Card is required!
2022-04-05 16:40:59 +00:00
2022-04-24 00:30:57 +00:00
## What Works / What Doesn't Work
* Everything works except:
2022-05-07 08:23:49 +00:00
1. PAN v2:
2022-04-24 00:30:57 +00:00
- Tilt (Vertical) only works at motor speed 9
2022-03-30 06:06:53 +00:00
## Setup
2022-04-13 04:13:18 +00:00
1. git clone the repo or download the repo zip
2022-05-02 00:52:34 +00:00
2. format micro-sd card as fat-32 ( this is a hard requirement, the bootloader does not support ex-fat or ext, and thus will not load wz_mini ), volume name does not matter.
2022-04-03 04:44:06 +00:00
2. copy all the files inside of SD_ROOT to your micro sd card
2022-04-22 04:05:36 +00:00
3. __SSH is enabled, but is secured using public key authentication for security. Edit the file ```wz_mini/etc/ssh/authorized_keys``` and enter your public key here. If you need a simple guide, [how to use public key authentication](https://averagelinuxuser.com/how-to-use-public-key-authentication/)__
2022-03-30 06:06:53 +00:00
2022-04-03 04:44:06 +00:00
## Installation
2022-04-13 06:26:15 +00:00
1. Turn off the camera
2. Insert the micro sd memory card into the camera
3. Turn on the camera
2022-04-22 04:05:36 +00:00
4. The camera will proceed to boot, then you may connect via the IP address of your device using SSH, port 22. The username is root. It may take a few minutes for the device to finish booting and connect to Wi-Fi, then launch the SSH server. Be patient.
5. You may also login via the serial console, password is WYom2020
2022-04-13 04:13:18 +00:00
## Removal
1. Delete the files you copied to the memory card, or remove the memory card all together. The next time you boot the camera, you will return to stock firmware.
2022-04-13 04:13:18 +00:00
2022-04-03 04:44:06 +00:00
## Customization
Edit run_mmc.sh, this is a script stored on the micro sd card that is run when the camera boots. You can change the hostname of the camera, mount NFS, add ping commands, anything you like.
2022-04-21 21:29:32 +00:00
---
Wireguard support is available as a kernel module:
```
2022-05-08 07:56:55 +00:00
ENABLE_WIREGUARD="true"
```
Use the command ```wg``` to setup. See [https://www.wireguard.com/quickstart/](https://www.wireguard.com/quickstart/) for more info.
2022-04-21 21:29:32 +00:00
2022-05-08 07:56:55 +00:00
Some users have asked about tailscale support, I have tested and it works. See the issue #30 for further information.
2022-05-08 07:58:12 +00:00
---
2022-05-08 07:58:12 +00:00
Disable automatic firmware updates:
```
2022-05-08 07:56:55 +00:00
DISABLE_FW_UPGRADE="true"
```
2022-04-21 10:01:51 +00:00
If a remote or app update is initiated, the camera will reboot due to the failure of the update. The firmware update should not proceed again for some time, or at all.
2022-05-08 07:56:55 +00:00
When a firmware update is initiated, due to a bootloader issue (bug?), we intercept the update process and flash it manually. This should now result in a successful update, if it doesn't, please restore the unit's firmware manually using demo_wcv3.bin on the micro sd card.
2022-04-13 04:13:18 +00:00
---
USB Ethernet Adapter support:
```
2022-05-08 07:56:55 +00:00
ENABLE_USB_ETH="true"
```
2022-04-14 08:35:27 +00:00
the next time you boot your camera, make sure your USB Ethernet Adapter is connected to the camera and ethernet. The camera has to be setup initially with Wi-Fi for this to work. After setup, Wi-Fi is no longer needed, as long as you are using the USB Ethernet Adapter. Note that using USB Ethernet disables the onboard Wi-Fi.
2022-04-15 08:51:18 +00:00
---
USB Direct Support:
2022-04-15 08:51:18 +00:00
```
2022-05-08 07:56:55 +00:00
ENABLE_USB_DIRECT="true"
2022-04-15 08:51:18 +00:00
```
the next time you boot your camera, make sure your USB cable is connected to the router. Remember, the camera has to be setup initially with Wi-Fi for this to work. After setup, Wi-Fi is no longer needed. Note that using USB Direct disables the onboard Wi-Fi. Change the MAC Address if you desire via USB_DIRECT_MAC_ADDR variable.
2022-04-15 08:51:18 +00:00
2022-04-15 08:59:10 +00:00
Connectivity is supported using a direct USB connection only... this means a single cable from the camera, to a supported host (An OpenWRT router, for example) that supports the usb-cdc-ncm specification. (NCM, not ECM) If you have an OpenWrt based router, install the ```kmod-usb-net-cdc-ncm``` package. The camera should automatically pull the IP from the router with most configurations. You can also use any modern linux distro to provide internet to the camera, provided it supports CDC_NCM. enjoy!
2022-04-15 08:51:18 +00:00
2022-05-08 07:56:55 +00:00
Note: In my testing, the micro-usb cables included with the various cameras do not pass data, so they will not work. Make sure you have a micro-usb cable that passes data!
2022-04-15 08:51:18 +00:00
---
Remote Accessories:
When USB Direct connectivity is enabled, the camera will be unable to communicate with accessories. To enable remote spotlight accessory support, enable the following variable and set the IP Address of the host as follows:
```
REMOTE_SPOTLIGHT="true"
REMOTE_SPOTLIGHT_HOST="0.0.0.0"
```
Then, run the following command on the host where the spotlight is attached to:
2022-04-15 08:51:18 +00:00
```
socat TCP4-LISTEN:9000,reuseaddr,fork /dev/ttyUSB0,raw,echo=0
```
Change ```/dev/ttyUSB0``` to whatever path your spotlight enumerated to if necessary. The camera will now be able to control the spotlight.
---
USB Mass Storage Support:
```
2022-05-08 07:56:55 +00:00
ENABLE_USB_STORAGE="true"
```
If you would like to mount an EXT3/4 filesystem, also change:
```
2022-05-08 07:56:55 +00:00
ENABLE_EXT4="true"
```
---
CIFS is now supported:
```
2022-05-08 07:56:55 +00:00
ENABLE_CIFS="true"
```
---
iptables (ipv4 and ipv6) is available:
```
ENABLE_IPTABLES="true"
```
2022-04-20 01:58:48 +00:00
---
2022-05-08 07:56:55 +00:00
NFSv4 support is available:
```
ENABLE_NFSv4="true"
2022-04-20 01:58:48 +00:00
```
2022-05-08 07:56:55 +00:00
---
RTSP streaming:
2022-05-16 03:37:57 +00:00
The RTSP server supports the two video streams provided by the camera, 1080p/360p (1296p/480p for the DB3). You can choose to enable a single stream of your choice, or both. Audio is also available. Set your login credentials here, server listening port, and the stream bitrate.
2022-05-16 01:36:36 +00:00
(ENC_PARAMETER variable accepts numbers only. 0=FIXQP, 1=CBR, 2=VBR, 4=CAPPED VBR, 8=CAPPED QUALITY. Currently only 2, 4, and 8 are working)
2022-05-08 07:56:55 +00:00
```
2022-04-22 04:05:36 +00:00
RTSP_LOGIN="admin"
RTSP_PASSWORD=""
RTSP_PORT="8554"
2022-05-16 01:36:36 +00:00
RTSP_HI_RES_ENABLED="true"
RTSP_HI_RES_ENABLE_AUDIO="true"
RTSP_HI_RES_MAX_BITRATE="2048"
RTSP_HI_RES_TARGET_BITRATE="1024"
RTSP_HI_RES_ENC_PARAMETER="2"
RTSP_LOW_RES_ENABLED="false"
RTSP_LOW_RES_ENABLE_AUDIO="false"
RTSP_LOW_RES_MAX_BITRATE=""
RTSP_LOW_RES_TARGET_BITRATE=""
RTSP_LOW_RES_ENC_PARAMETER=""
2022-05-15 06:10:03 +00:00
2022-04-20 01:58:48 +00:00
```
the singular stream will be located at ```rtsp://login:password@IP_ADDRESS:8554/unicast```
multiple streams are located at ```rtsp://login:password@IP_ADDRESS:8554/video1_unicast``` and ```rtsp://login:password@IP_ADDRESS:8554/video2_unicast```
2022-04-20 01:58:48 +00:00
Note: If you don't set the password, the password will be set to the unique MAC address of the camera, in all uppercase, including the colons... for example:. AA:BB:CC:00:11:22. It's typically printed on the camera. Higher video bitrates may overload your Wi-Fi connection, so a wired connection is recommended.
2022-05-08 07:56:55 +00:00
Huge credit to @mnakada for his libcallback library: [https://github.com/mnakada/atomcam_tools](https://github.com/mnakada/atomcam_tools)
2022-04-20 01:58:48 +00:00
---
2022-05-18 20:05:38 +00:00
Use as a USB Web Camera for your PC is supported. I have tested with Windows 10 and Linux, and it appears as a Generic HD Camera. Audio is supported. This mode disables all other functionality, and only works as a USB Web Camera for your PC. Experimental. Note that the cables typically included with the camera do not data, use a known working micro-usb cable which supports data.
2022-05-18 20:14:55 +00:00
Supported modes: MJPG 360p/720p/1080p, Video 360p/720p/1080p
```
ENABLE_WEB_CAM="true"
2022-05-18 20:14:55 +00:00
WEB_CAM_BIT_RATE="8000"
WEB_CAM_FPS_RATE="25"
```
---
2022-04-05 16:40:59 +00:00
## Latest Updates
* 05-18-22: Added PC Web Camera functionality, changed RTSP server, when you use enable more than one stream, they share the port and use different paths.
2022-05-16 07:24:51 +00:00
* 05-15-22: fixed rtsp audio for low-res rtsp stream, patched libcallback sources for audio channel 1.
2022-05-16 01:36:36 +00:00
* 05-15-22: patched libcallback to support both video streams from the camera. Added support for them in run_mmc.sh.
2022-05-15 06:10:03 +00:00
* 05-14-22: Added ability to specify RTSP bitrate parameters. Note that changing bitrate in the mobile app will briefly reset the bitrate for the RTSP stream.
* 05-14-22: Update v4l2rtspserver, tinyalsa, alsa-lib. Patch busybox for older official FW's failing to run scripts, fix choppy/static audio in libcallback
2022-05-09 10:24:10 +00:00
* 05-09-22: fix bug in run_mmc.sh that did not store the wlan mac when using a wired usb or ethernet connection for the rtsp server
* 05-09-22: update libcallback sources with patch to fix rtsp across multiple firmware versions for all devices (v3/panv2/db)
2022-05-08 08:25:48 +00:00
* 05-08-22: update libcallback sources with patch to enable pan v2 rtsp functionality.
2022-05-08 07:56:55 +00:00
* 05-08-22: Include iptables and NFSv4 kernel modules, enable swap ON by default.
2022-05-07 08:23:49 +00:00
* 05-07-22: RTSP Server fixed, ported latest full libcallback from @mnakada with modifications.
2022-05-02 02:41:38 +00:00
* 05-01-22: Removed dropbearmulti, replaced with individual binaries. dropbear dbclient dropbearkey dropbearconvert scp now included.
2022-04-30 14:23:00 +00:00
* 04-30-22: Recompiled uClibc with LD_DEBUG enabled. Enable in v3_post.sh, for debugging.
* 04-30-22: Move built-in kernel stuff to modules, usb_direct kernel no longer needed, modules now included. Added usb-storage support for usb hdd/ssd/flash drive, cifs support, and rndis support for tethering camera directly to a mobile device.
* 04-26-22: Add customization of PATH via hook in v3_init.sh, and add audioplay_t31 binary for playing audio files before iCamera loads.
2022-04-22 04:08:43 +00:00
* 04-21-22: Add authentication to rtsp server. use default password as unique device mac address.
2022-04-22 04:05:36 +00:00
* 04-21-22: Updated dropbear ssh, enabled public key authentication, disable password auth.
2022-04-21 23:21:25 +00:00
* 04-21-22: wz_mini/tmp folder was missing in git, preventing the camera from booting. Fixed.
2022-04-21 10:01:51 +00:00
* 04-21-22: Workaround for bootloader F/W upgrade bug, F/W blocking is now disabled by default.
2022-04-20 01:58:48 +00:00
* 04-19-22: Add RTSP Server functionality
* 04-17-22: Add remote spotlight accessory capability
2022-04-15 08:51:18 +00:00
* 04-15-22: Enable USB Direct functionality. Allows you to connect camera using a USB cable to a device supporting CDC_NCM devices to get an internet connection, no USB Ethernet Adapter required.
* 04-14-22: Fix kernel command line memory mappings, resolves stability issues
2022-04-14 08:35:27 +00:00
* 04-14-22: Possible memory leak with some USB adapters used, added 128MB swap file and logic as workaround to prevent oom killing
2022-04-13 19:59:04 +00:00
* 04-13-22: Firmware updates are disabled by default, there is a bug in the bootloader that corrupts the kernel partition requiring the re-flash of the camera if an update is processed and the memory card is removed before next boot. The bootloader proceeds to copy the partitions and the system will not boot unless re-flashed. pending investigation.
* 04-12-22: Updated, custom kernel loads all required items from micro sd card. System modification no longer needed.
2022-05-08 07:56:55 +00:00
* 04-05-22: Update readme to indicate that telnet mod nor DNS spoofing is required for installation, and add pre-requisites section.
* 04-02-22: Update to automatic install method, remove manual install.
2022-04-03 04:44:06 +00:00
2022-04-15 08:51:18 +00:00
## BYO
Build your own!!
2022-04-15 08:51:18 +00:00
2022-04-21 21:29:32 +00:00
[https://github.com/mnakada/atomcam_tools](https://github.com/mnakada/atomcam_tools) has a great repo with docker images which include kernel sources, config, and a whole bunch of other stuff. Check it out.
2022-04-15 08:51:18 +00:00
2022-03-30 06:06:53 +00:00
## WARNING
```
2022-04-21 21:38:36 +00:00
AS WITH ANY UNSUPPORTED SYSTEM MODIFICATIONS, USING THIS MAY LEAD TO A DEVICE BRICK
2022-03-30 06:06:53 +00:00
IF YOU DON'T KNOW WHAT YOU ARE DOING ( HAVEN'T BRICKED MY DEVICE YET! ) PLEASE
BE AWARE THAT NO ONE ON THE INTERNET IS RESPONSIBLE FOR ANY DAMAGE TO YOUR
UNIT. ANY PROBLEMS WILL BE CONSIDERED USER ERROR OR ACTS OF WHATEVER GOD YOU BELIEVE IN.
2022-03-30 06:25:21 +00:00
USE AT YOUR OWN RISK. NO WARRANTY OF ANY KIND IS EXPRESSED OR IMPLIED.
DO NOT USE THIS SOFTWARE IF YOU ARE NOT CONFIDENT IN RESTORING YOUR DEVICE FROM A FAILED STATE.
2022-03-30 06:06:53 +00:00
```
## Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
2022-04-03 04:44:06 +00:00
## Thank You
2022-04-13 04:13:18 +00:00
Thank you to everyone who is passionate about Wyze products for making the devices popular, and thank you to Wyze for producing them. Sign up for CamPlus, show some love and support to the company.
2022-04-03 04:44:06 +00:00
2022-04-21 21:29:32 +00:00
Thanks for HclX for WyzeHacks! [https://github.com/HclX/WyzeHacks/](https://github.com/HclX/WyzeHacks/)
Thank you mnakada for his atomcam_tools fork! [https://github.com/mnakada/atomcam_tools](https://github.com/mnakada/atomcam_tools)
Thank you bakueikozo for his atomcam_tools repo! [https://github.com/bakueikozo/atomcam_tools](https://github.com/bakueikozo/atomcam_tools)
2022-04-13 04:13:18 +00:00
Thank you to virmaior for the atomcam_tools tip!