Skip to content

Commit

Permalink
First release
Browse files Browse the repository at this point in the history
  • Loading branch information
roleoroleo committed Oct 5, 2020
0 parents commit ff0070f
Show file tree
Hide file tree
Showing 271 changed files with 16,639 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.sh text eol=lf
17 changes: 17 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@

/build/*
!/build/.gitkeep

/out
/bin

# The following files are ignored because they need some cleanup
REQUIRED_PACKAGES
INIT_SUBMODULES.md

*.DS_Store
*.o
.idea
src/h264grabber/h264grabber/h264grabber
src/ipc_cmd/ipc_cmd/ipc_cmd
src/snapshot/snapshot/imggrabber
24 changes: 24 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[submodule "src/busybox/busybox"]
path = src/busybox/busybox
url = https://github.com/mirror/busybox
[submodule "src/dropbear/dropbear"]
path = src/dropbear/dropbear
url = https://github.com/mkj/dropbear
[submodule "src/ftpd/pure-ftpd"]
path = src/ftpd/pure-ftpd
url = https://github.com/jedisct1/pure-ftpd
[submodule "src/mosquitto/mosquitto"]
path = src/mosquitto/mosquitto
url = https://github.com/eclipse/mosquitto
[submodule "src/mqtt/mqttv4"]
path = src/mqtt/mqttv4
url = https://github.com/roleoroleo/mqttv4
[submodule "src/onvif_srvd/onvif_srvd"]
path = src/onvif_srvd/onvif_srvd
url = https://github.com/roleoroleo/onvif_srvd
[submodule "src/proxychains-ng/proxychains-ng"]
path = src/proxychains-ng/proxychains-ng
url = https://github.com/rofl0r/proxychains-ng
[submodule "src/wsdd/wsdd"]
path = src/wsdd/wsdd
url = https://github.com/KoynovStas/wsdd
24 changes: 24 additions & 0 deletions .gitmodules.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[submodule "src/busybox/busybox"]
path = src/busybox/busybox
url = https://github.com/mirror/busybox
[submodule "src/dropbear/dropbear"]
path = src/dropbear/dropbear
url = https://github.com/mkj/dropbear
[submodule "src/ftpd/pure-ftpd"]
path = src/ftpd/pure-ftpd
url = https://github.com/jedisct1/pure-ftpd
[submodule "src/mosquitto/mosquitto"]
path = src/mosquitto/mosquitto
url = https://github.com/eclipse/mosquitto
[submodule "src/proxychains-ng/proxychains-ng"]
path = src/proxychains-ng/proxychains-ng
url = https://github.com/rofl0r/proxychains-ng
[submodule "src/onvif_srvd/onvif_srvd"]
path = src/onvif_srvd/onvif_srvd
url = https://github.com/roleoroleo/onvif_srvd
[submodule "src/mqtt/mqttv4"]
path = src/mqtt/mqttv4
url = https://github.com/roleoroleo/mqttv4
[submodule "src/wsdd/wsdd"]
path = src/wsdd/wsdd
url = https://github.com/KoynovStas/wsdd
26 changes: 26 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Contributing

## Bug Reports and Issues
Bug Reports are welcome and appreciated! However, due to an influx of poor quality report, we have some processes in place to help.

#### Search for Related Issues
Your bug or issue may have already been reported by another user. Please make sure to search through the "Issues" tab for similar issues to the one you're submitting

#### One Bug/Report per Issue
In order to keep the conversation relevant on an issue and to make issues easier to find, please create one issue per bug that you're encountering. If you're unsure if your issue is two seperate problems or one, err on the side of caution and submit multiple bug reports.

#### Be Responsive
We want to fix problems as fast as possible, but all contributors are volunteers for this project. Please respect their time and be reasonably responsive to questions that a contributor may ask. Issues that don't have a response may be closed if there hasn't been a response for 14 days to keep things clean.

#### Provide Detail
Similar to the prior note, please provide as much information as possible in your initial report. Things like:
- Logs
- Hack Version
- Camera Model
- Camera Version

This helps us diagnose issues faster and provide resolutions. If needed information isn't provided, it's going to get asked for anyways.

## Pull Requests

Code changes and improvements are welcome and encouraged! If you plan on changing a large section of the project (swapping around components, removing features), please file an issue with us so we can discuss a path forward and implementation details.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2010-2020 Google, Inc. http://angularjs.org

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
119 changes: 119 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
<p align="center">
<img height="200" src="https://user-images.githubusercontent.com/39277388/80304933-cb6f7400-87b9-11ea-878b-75e48779e997.png">
</p>

yi-hack-Allwinner is a modification of the firmware for the Allwinner-based Yi Camera platform.

## Table of Contents
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Update Procedure](#update-procedure)
- [Contributing](#contributing-and-bug-reports)
- [Features](#features)
- [Performance](#performance)
- [Supported cameras](#supported-cameras)
- [Build your own firmware](#build-your-own-firmware)
- [License](#license)
- [Disclaimer](#disclaimer)
- [Donation](#donation)


## Installation

### Update Procedure
1. Format an SD Card as FAT32. It's recommended to format the card in the camera using the camera's native format function. If the card is already formatted, remove all the files.
2. Download the latest release from [the Releases page](https://github.com/roleoroleo/yi-hack-Allwinner/releases)
3. Extract the contents of the archive to the root of your SD card.
4. Insert the SD Card and reboot the camera
5. Wait for the camera to update. It will reboot a couple of times as the camera is rooted and the new firmware is applied. It can take up to an hour to update. Once the light is solid blue for at least a minute it is complete.


## Contributing and Bug Reports
See [CONTRIBUTING](CONTRIBUTING.md)

---

## Features
This custom firmware contains features replicated from the [yi-hack-MStar](https://github.com/roleoroleo/yi-hack-MStar) project and similar to the [yi-hack-v4](https://github.com/TheCrypt0/yi-hack-v4) project.

- FEATURES
- RTSP server - allows a RTSP stream of the video (high and/or low resolution) and audio (thanks to @PieVo for the work on MStar platform).
- rtsp://IP-CAM/ch0_0.h264 (high res)
- rtsp://IP-CAM/ch0_1.h264 (low res)
- rtsp://IP-CAM/ch0_2.h264 (only audio)
- ONVIF server (with support for h264 stream, snapshot, ptz, presets and WS-Discovery) - standardized interfaces for IP cameras.
- Snapshot service - allows to get a jpg with a web request.
- http://IP-CAM:8080/cgi-bin/snapshot.sh?res=low&watermark=yes (select resolution: low or high, and watermark: yes or no)
- http://IP-CAM:8080/cgi-bin/snapshot.sh (default high without watermark)
- MQTT - Motion detection and baby crying detection through mqtt protocol.
- Web server - web configutation interface (port 8080).
- SSH server - dropbear.
- Telnet server - busybox.
- FTP server.
- FTP push: export mp4 video to an FTP server (thanks to @Catfriend1).
- Authentication for HTTP, RTSP and ONVIF server.
- Proxychains-ng - Disabled by default. Useful if the camera is region locked.
- The possibility to change some camera settings (copied from official app):
- camera on/off
- video saving mode
- detection sensitivity
- AI human detection (thanks to @BenjaminFaal)
- baby crying detection
- status led
- ir led
- rotate
- Management of motion detect events and videos through a web page.
- View recorded video through a web page (thanks to @BenjaminFaal)
- PTZ support through a web page (if the cam supports it).
- The possibility to disable all the cloud features.
- Swap File on SD
- Online firmware upgrade
- Load/save/reset configuration


## Performance

The performance of the cam is not so good (CPU, RAM, etc...). Low ram is the bigger problem.
If you enable all the services you may have some problems.
For example, enabling both rtsp streams is not recommended.
Disable cloud is recommended to save resources.
If you notice problems and you have a SD to waste, try to enable swap file.


## Supported cameras

Currently this project supports only the following cameras:

| Camera | Firmware | File prefix | Remarks |
| --- | --- | --- | --- |
| **Yi 1080p Home 9FUS** | 8.2.0* | y20ga | - |
| **Yi 1080p Home BFUS** | 8.2.0* | y20ga | - |

USE AT YOUR OWN RISK.

**Do not try to use a fw on an unlisted model**

**Do not try to force the fw loading renaming the files**


## Build your own firmware

If you want to build your own firmware, clone this git and compile using a linux machine. Quick explanation:

1. Download and install the SDK as described [here](https://github.com/roleoroleo/yi-hack-Allwinner/wiki/Build-your-own-firmware-(thanks-to-@Xandrios))
2. clone this git: `git clone https://github.com/roleoroleo/yi-hack-Allwinner`
3. Init modules: `git submodule update --init`
4. Compile: `./scripts/compile.sh`
5. Pack the firmware: `./scripts/pack_fw.all.sh`

----

## License
[MIT](https://choosealicense.com/licenses/mit/)

## DISCLAIMER
**NOBODY BUT YOU IS RESPONSIBLE FOR ANY USE OR DAMAGE THIS SOFTWARE MAY CAUSE. THIS IS INTENDED FOR EDUCATIONAL PURPOSES ONLY. USE AT YOUR OWN RISK.**

## Donation
If you like this project, you can buy Roleo a beer :)
[![paypal](https://www.paypalobjects.com/en_US/i/btn/btn_donateCC_LG.gif)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=JBYXDMR24FW7U&currency_code=EUR&source=url)
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.2.0
Binary file added assets/yi-hack-allwinner-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/yi-hack-allwinner-logo.sketch
Binary file not shown.
76 changes: 76 additions & 0 deletions scripts/cleanup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

#
# This file is part of yi-hack-v4 (https://github.com/TheCrypt0/yi-hack-v4).
# Copyright (c) 2019 densanki.
# Copyright (c) 2019 Davide Maggioni.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

#set -e

get_script_dir()
{
echo "$(cd `dirname $0` && pwd)"
}

source "$(get_script_dir)/common.sh"

require_root

echo ""
echo "------------------------------------------------------------------------"
echo " YI-HACK - CLEANUP"
echo "------------------------------------------------------------------------"
echo ""

BASE_DIR=$(get_script_dir)/../
BASE_DIR=$(normalize_path $BASE_DIR)

STATIC_DIR=$BASE_DIR/static
BUILD_DIR=$BASE_DIR/build
OUT_DIR=$BASE_DIR/out

echo "Cleaning build dir ..."
rm -rf $BUILD_DIR
echo "Cleaning out dir ..."
rm -rf $OUT_DIR

echo "Cleaning src/*/_install folders ..."

SRC_DIR=$(get_script_dir)/../src

for SUB_DIR in $SRC_DIR/* ; do
if [ -d ${SUB_DIR} ]; then # Will not run if no directories are available
echo -n "Cleaning _install in $(basename \"$SUB_DIR\") ..."
rm -rf $SUB_DIR/_install
echo "done!"
fi
done

echo ""

for SUB_DIR in $SRC_DIR/* ; do
if [ -d ${SUB_DIR} ]; then # Will not run if no directories are available
echo -n "Cleaning $(basename \"$SUB_DIR\") ..."
cd $SUB_DIR
MOD_DIR=$(basename $SUB_DIR)
./cleanup.$MOD_DIR
echo "done!"
fi
done

echo ""
echo "Finished!"
echo ""
76 changes: 76 additions & 0 deletions scripts/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

#
# This file is part of yi-hack-v4 (https://github.com/TheCrypt0/yi-hack-v4).
# Copyright (c) 2018-2019 Davide Maggioni.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

###############################################################################
# Cameras list
###############################################################################

declare -A CAMERAS

CAMERAS["y21ga"]="y21ga"

###############################################################################
# Common functions
###############################################################################

require_root()
{
if [ "$(whoami)" != "root" ]; then
echo "$0 must be run as root!"
exit 1
fi
}

normalize_path()
{
local path=${1//\/.\//\/}
local npath=$(echo $path | sed -e 's;[^/][^/]*/\.\./;;')
while [[ $npath != $path ]]; do
path=$npath
npath=$(echo $path | sed -e 's;[^/][^/]*/\.\./;;')
done
echo $path
}

check_camera_name()
{
local CAMERA_NAME=$1
if [[ ! ${CAMERAS[$CAMERA_NAME]+_} ]]; then
printf "%s not found.\n\n" $CAMERA_NAME

printf "Here's the list of supported cameras:\n\n"
print_cameras_list
printf "\n"
exit 1
fi
}

print_cameras_list()
{
for CAMERA_NAME in "${!CAMERAS[@]}"; do
printf "%s\n" $CAMERA_NAME
done
}

get_camera_id()
{
local CAMERA_NAME=$1
check_camera_name $CAMERA_NAME
echo ${CAMERAS[$CAMERA_NAME]}
}
Loading

0 comments on commit ff0070f

Please sign in to comment.