Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add WiFi confg #48

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Add WiFi confg #48

wants to merge 7 commits into from

Conversation

MastaaK
Copy link

@MastaaK MastaaK commented May 30, 2018

It's my modification to take account of the WiFi parameters.
We now can configure wifi without a phone, just with midguar.ini

MastaaK added 7 commits May 30, 2018 12:05
Add the 4 parameters declared in midguard.ini + a little explaination for the ledctl command
Add AP_SSID to configure the SSID that will be broadcasted if miio_ssid mode is not configured
Take aacount of the AP_SSID, miio_ssid, miio_key_mgmt and miio_passwd to create an AP (with configured name) or go in STA mode
Copy link
Collaborator

@willthrom willthrom left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look as this changes will not work with the latest version (plus the duplication of init the network)

@@ -15,14 +15,16 @@ CONFIG_LINE=-b4098 -f20 -w1920 -h1080 -m1
## Root password for SSH Server (at least length 8)
SSH_ROOT_PASS=qwerty123456
## DISABLED OTA (0/1)
DISABLED_OTA=0
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better leave the default without activating the RTSP, disabling OTA, etc.etc
We don´t want to break anything without the user anabled/disabling on their own will

@@ -114,30 +118,4 @@ start()
fi
}

start_valhalla()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this script was deleted? is has been moved somewhere else? it is required for the latest version of Xiaomi to initialise the scripts....

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've deleted this otherwise the boot sequence will loop, first it will launch valhalla.sh wich call wifi_start.sh wich call valhalla.sh and again and again. I'm sure ther is a better way to do this, like maybe implementing a thinner verson of wifi_start.sh inside valhalla.sh.

Copy link
Collaborator

@willthrom willthrom Jun 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

flow changed after the version 148 and finally fixed after 158.

Before (still is in 0099), /etc/init.d/rcS-> check SDCARD and set flag to use custom boot.
S50gm with flag, call custom ft_boot.sh inside SDCARD, which calls valhalla.sh

Due to the change in the firmware (xiaomi after 148). Custom boot ft_boos.sh was tricky to make work and most of the time failed so the flow changed to. (this is done when upgrading under pos_ota.sh)

/etc/init.d/rcS -> S41wifi -> /mnt/data/ot_wifi_tool/wifi_start.sh (custom file done at upgrading through OTA). -> Valhalla.sh

wifi_start.sh is modified to call valhalla and add a protection for looping. You might take a look to the wifi_start.sh inside the release under the tool folder.

#Loop protection.
[ -f /tmp/valhalla.pid ] && return
echo 1 > /tmp/valhalla.pid

This code:

## in Mode 3, the wifi is configured in AP. Restart Wifi in default mode (0).
echo 0 > /tmp/ft_mode
/etc/init.d/S41wifi restart

was there in the past for something different, now it should be to reconfigure the wifi.

Summarizing.. all the changes can be done under wifi_start.sh to allow WIFI dynamic configuration and the already changes in valhalla.sh

@@ -88,6 +100,10 @@ echo $ft_mode > /tmp/ft_mode
# cp -rf /mnt/data $sd_mountdir/tff2
#fi

echo -e "Starting WiFi Config" >> $sd_mountdir/$LOGFILE 2>&1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is the other way. The sdcard/tools/wifi_start.sh is been called by the init scripts Network/Wifi. Then wifi_star.sh calls valhalla. This changes will not work in the latest Xiaomi Version.
Actually Valhalla.sh will call the network init script to set up again.

## in Mode 3, the wifi is configured in AP. Restart Wifi in default mode (0).
echo 0 > /tmp/ft_mode
/etc/init.d/S41wifi restart

You might not know this:... but the logic for .099 version is ft_boot calling valhalla.sh but when upgrading to the latest 15X version, that approach is not used any more because the security added by Xiaomi regarding the Private Key.

@xtrapowa
Copy link

Hi, I just received my brand new xiaomi mijia 1080p with firmware 3.4.5_0046. I tried your hack but nothing seems working. No ssh after using tools & .img on sd root. I tried to edit .ini to activate rtsp but nothing too. Sorry for my noobiest answers. Thank you. Kind regards. Xtra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants