Camera WiFi in Client mode - WORKING .ash SCRIPT inside

ReNDaR

Member
Joined
Mar 28, 2015
Messages
45
Reaction score
5
Country
Philippines
so in effect , it would be like an IP Camera???
 
OP
Andy_S

Andy_S

Active Member
Joined
May 5, 2015
Messages
621
Reaction score
193
Country
Czech Republic
it didn't grab IP from my DHCP server, but ... that's just a minor issue, let me have a dinner & i will do some more testing.
 

reverend

Well-Known Member
Joined
Apr 22, 2014
Messages
5,609
Reaction score
3,966
Country
United Kingdom
Dash Cam
Too many
nope, i am not able to mount ubi (MTD) partition (LNX.a7s), if i would, i won't need the contact and release the fix for wifi myself :)
Are you ok with mounting that partition now mate - if not I have the instructions to do that here somewhere if they help?
 
OP
Andy_S

Andy_S

Active Member
Joined
May 5, 2015
Messages
621
Reaction score
193
Country
Czech Republic
i already mounted it safely, now i need to figure out how to safely re-create that image from existing partition :)
 

reverend

Well-Known Member
Joined
Apr 22, 2014
Messages
5,609
Reaction score
3,966
Country
United Kingdom
Dash Cam
Too many
In fact here they are:
Code:
sudo apt-get install mtd-utils
sudo modprobe nandsim first_id_byte=0x20 second_id_byte=0xaa third_id_byte=0x00 fourth_id_byte=0x15
cat /proc/mtd
sudo modprobe ubi mtd=0
sudo ubidetach /dev/ubi_ctrl -m 0
sudo ubiformat /dev/mtd0 -f LNX.a7s
sudo ubiattach /dev/ubi_ctrl -m 0
mkdir Yiroot
sudo mount -t ubifs ubi0 Yiroot
cd Yiroot
ls
sudo umount Yiroot
sudo ubidetach /dev/ubi_ctrl -m 0
You'd probably want to drop that last umount to have a play but that's the entire filesystem mounted.

I've noticed it doesn't actually update the original file when it's unmounted as I'm guessing the changes are only being written to the virtual NAND - worst case it would be a case of recreating the LNX partition but that could be risky while there are no tools like DirectUSB that work with the Yi currently (or at least that I've noticed lately).
 

reverend

Well-Known Member
Joined
Apr 22, 2014
Messages
5,609
Reaction score
3,966
Country
United Kingdom
Dash Cam
Too many
i already mounted it safely, now i need to figure out how to safely re-create that image from existing partition :)
Ah yes you just beat me to it there - seems to be mkfs.ubifs and ubinize should do it but it's just risky while there's no DirectUSB access :/
 
OP
Andy_S

Andy_S

Active Member
Joined
May 5, 2015
Messages
621
Reaction score
193
Country
Czech Republic
true, re-creating image is what i am VERY affraid of.
 

reverend

Well-Known Member
Joined
Apr 22, 2014
Messages
5,609
Reaction score
3,966
Country
United Kingdom
Dash Cam
Too many
I've created a new LNX.a7s now - it's bigger than the original as the first ubi partition is compressed, I'm guessing lzo in the factory firmware.

The second partition bloated up to over 20MB but the tools said there were only 33 LEBs in the second ubi partition so I've trimmed it to size.

I've then used the two new files to produce some output which seems to work and has a modified first partition - maybe Xiaomi will allow DirectUSB access soon and release the ELF (it would help every user who bricks their cameras for sure!) and would mean we could actually test this!

https://mega.co.nz/#F!hAV0gSCB!nXChV0Q-l32nDfzPJlFrKg

Seems to work and I've just dropped a new sub folder into the root filesystem.

Brain dumping this in case it is ever useful to anyone (and I'll forget after sleeping!)

To save the contents from simulated NAND I used (after unmounting the filesystem):
cat /dev/ubi0_0 > ubi0_0
cat /dev/ubi0_1 > ubi0_1

To trim the second large file down I used:
dd count=4257792 bs=1 if=ubi0_1 of=ubi0_1_trimmed

The contents of bi.ini were:
Code:
[linux]
mode=ubi
image=ubi0_0
vol_id=0
vol_size=35739648
vol_type=dynamic
vol_name=linux
vol_alignment=1

[pref]
mode=ubi
image=ubi0_1
vol_id=1
vol_size=222566400
vol_type=dynamic
vol_name=pref
vol_alignment=1
vol_flags=autoresize
And then the command to generate the new LNX.a7s was:

sudo /usr/sbin/ubinize -o my.LNX.a7s -p 131072 -m 2048 -s 512 -O 512 ubi.ini
 
OP
Andy_S

Andy_S

Active Member
Joined
May 5, 2015
Messages
621
Reaction score
193
Country
Czech Republic
Nice work! Will keep this for later mods ;)
 

luckylz

Active Member
Joined
Apr 8, 2015
Messages
414
Reaction score
106
Country
China
Hi @Andy_S Can try to control multiple cams now?

What this means in the sta.sh
Code:
MyMAC="04:E6:76:01:01:01"
Should I need to change this MAC address for my own Yi Cam?
 
Last edited:

luckylz

Active Member
Joined
Apr 8, 2015
Messages
414
Reaction score
106
Country
China
Tested with cc.pyw in wifi station mode, works great !!!
 

Excelsior

New Member
Joined
Jun 22, 2015
Messages
1
Reaction score
0
Country
Indonesia
Now I can tinker with C&C while still connected to the internet, NICE!
1 question, why the VLC live feed delayed so much? The mobile app can stream much better with less delay. Is there any buffer settings in the VLC that can be configured to make it more "real-time"?
 
OP
Andy_S

Andy_S

Active Member
Joined
May 5, 2015
Messages
621
Reaction score
193
Country
Czech Republic
@luckylz: I will try that today, not like C&C, but i will try to make some easy app just for triggering recording / shooting all cameras at once. MyMAC is for the case, when your camera does not have static MAC address and you want it to have static, so you set it in this variable and then set "CustomMAC=1". But it applies only, when your camera does not have static MAC.

@Excelsior: Yes, VLC has some buffer that you can manually lower. I am not sure if i can do that by command tho... standard is IIRC 300ms. Realtime? No idea, will have to try.
 

4netk

New Member
Joined
Jun 24, 2015
Messages
16
Reaction score
1
Location
Ferrara
Country
Italy
@Andy_S Thanks so much for this, triggering them all at once (i have multiple) was exactly what I was looking for. desperately.
 

luckylz

Active Member
Joined
Apr 8, 2015
Messages
414
Reaction score
106
Country
China
Understood, the sta.sh will get 2 MAC address from:
Code:
mac=`cat /tmp/wifi0_mac`

mac2=`cat /proc/ambarella/board_info  | grep wifi_mac | awk '{ print $2 }' | tr '[:lower:]' '[:upper:]'`
Only if mac2 is blank & CustomerMAC=1 then can use manual MyMAC.
In normal situation, Yi Cam has its own MAC address.
 
OP
Andy_S

Andy_S

Active Member
Joined
May 5, 2015
Messages
621
Reaction score
193
Country
Czech Republic
exactly. mac2 is taken directly from hardware info, if hw does not have mac assigned by chip manufacturer, then it is random and allows you to set your own mac address.

Also note that you can set static IP at the end ;)
 

funnel

Active Member
Joined
Apr 21, 2015
Messages
122
Reaction score
111
Country
Slovenia
Nice, it works!

Tried yesterday myself before you posted how to do it but put /usr/bin/ path in wpa_supplicant.conf too and that doesn't work apparently. Plus you must not press the wifi button or the connection shuts off.
 
Top