mewlips / nx-remote-controller-mod

Remote Controller Mod for NX1/NX500/NX300
https://mewlips.github.io/nx-remote-controller-mod
GNU Affero General Public License v3.0
21 stars 8 forks source link

remote storage #12

Open KinoSeed opened 8 years ago

KinoSeed commented 8 years ago

That's not an issue but more of an idea.

Using fuse, and curlftpfs or sshfs to mount FTP, and have the camera save to it directly.

without installing, load fuse

modprobe fuse

mount ftp

sshfs remote-username@remote-server-name:/remote/directory /mnt/mmc/DCIM_remote/

rename DCIM

mv /mnt/mmc/DCIM /mnt/mmc/DCIM_local

create sym-link pointer to local

ln -sf /mnt/mmc/DCIM_local /mnt/mmc/DCIM

switching to "save to remote location" (and back) will be simply changing the pointer:

ln -sf /mnt/mmc/DCIM_remote /mnt/mmc/DCIM

gallery web_root/DCIM will still link to the other pointer

ln -sf /mnt/mmc/DCIM /opt/usr/nx-ks/nx-rc/web_root/DCIM

Not sure if creating a gallery for the FTP will be possible (bandwidth issue), maybe generate gallery for the local, and leave the remote for browsing only.

when done:

ln -sf /mnt/mmc/DCIM /mnt/mmc/DCIM_local fusermount -u /mnt/mmc/DCIM_remote/ modprobe -rf fuse

what do you think?

ottokiksmaler commented 8 years ago

I have already done it with NFS with mount from my laptop instead of SD card DCIM directory and it works, but it's slow, very slow. Wifi speed was ~3MB/s so it took ~4s for a jpeg image to be saved.

This can be used when you need it, it even works without SD card (if exported fs is mounted in place of SD card root) but for best results one would have to switch the laptop into wifi AP and keep it close to the camera.

What I did (I'll document it more detailed when I find time) was to compile missing kernel modules, put them in /opt, run depmod with changed base directory then modprobe (also changed base), then mounted with bosybox mount -t nfs

I was actually trying to load modules in order to enable external mic / usb otg and the like, but this was a suitable test.

ottokiksmaler commented 8 years ago

Oh, side note - if you do anything to files the camera expect to exist in DCIM directories and then start the gallery (like, delete the last image you took from telnet then press PB button) the camera will hang - it blinks and blinks and buttons don't work, etc.

Only quick and dirty option I use is to "click" pwoff button from stapp as that will very quickly restart the camera and that will solve this particular issue (but be warned that restart is so quick that keyscan will not detect it). Alternatively, unmount - mount of the SD card.

mewlips commented 8 years ago

@KinoSeed Your idea is very good. In fact, I tried it some months ago. At that time, I used fuse and sshfs with NX500. The result was slow as @ottokiksmaler mentioned.

Today, I retried this hack with some another approach.

The result is VERY USABLE. I'll provide scripts and binary files I used.

KinoSeed commented 8 years ago

It looks like there is no problem for capturing, when just switching between save-directories, rm /mnt/mmc/DCIM; ln -sf /mnt/mmc/DCIM_local /mnt/mmc/DCIM rm /mnt/mmc/DCIM; ln -sf /mnt/mmc/DCIM_remote /mnt/mmc/DCIM

when "preview" (pb) is triggered, and the last picture was at the same dir (ex: you take a few on the remote, then switch to local, take a few more, and press PB), there is no crash, and the picture shows correctly, however the picture counter is "off" and if there is attempt to show more pics it crashes.

@ottokiksmaler , maybe it can be tricked by replacing/disabling the "format" function of the os, and triggering "st app format". (if PB is needed to be reset)

mewlips commented 8 years ago

Preview problem can be solved by using unionfs.

I made chroot environment using the buildroot. smbnetfs and unionfs binaries that I needed are in chroot enviroment

umount /opt/storage/sdcard
mount /dev/mmcblk1p1 /opt/usr/nx-ks/nx-netfs/jailed_root/sdcard
chroot /opt/usr/nx-ks/nx-netfs/jailed_root
smbnetfs /mnt/smb
unionfs /mnt/smb/WORKGROUP/COMPUTER/sdcard=RW:/sdcard=RW /mnt/sdcard
exit
mount -o bind /opt/usr/nx-ks/nx-netfs/jailed_root/mnt/sdcard /opt/storage/sdcard

New photos will be saved in remote storage, and preview shows all local and remote files.

KinoSeed commented 8 years ago

... but the problem will remain, as soon as you unmount the remote

mewlips commented 8 years ago

There is some differences between NX1 and NX500.

On NX1:

On NX500:

ottokiksmaler commented 8 years ago

TLDR - it's useful on NX1, not on NX500 currently.

mewlips commented 8 years ago

I created new repository for this hack. https://github.com/mewlips/nx-netfs

You can download initial release file. https://github.com/mewlips/nx-netfs/raw/master/nx-netfs.zip

To install

Edit: remote_storage.sh fixed. See https://github.com/mewlips/nx-netfs/commit/90f20e669b085abb2a6af3705fcf2640694c8d67

KinoSeed commented 8 years ago

for a nx500 user ... this is discouraging =/

but I integrated it in the menu, (it is requiring a separate install of nx-netfs) the credentials are editable and locally stored (no protection even of the password)

NX-KS2.v277beta.zip

To turn on: menu > Custom Functions > check Remote Save a new menu with credentials will show up, with the ones that are on file (press to edit) press start to remote connect If nx-netfs is missing, it will inform that it needs to be installed first. If it's there, nx-netfs start instructions are followed. To turn off - menu > Custom Functions > UNcheck Remote Save (All it does at the moment, is to run nx-netfs, it does not change the DCIM pointer to the remote location.)

It is a bit over my head, but NX1 users may find it easier if it is possible to run without installation. Unpack the nx-netfs on the sdcard/nx-netfs (maybe the credentials can be stored there too) and all someone needs to do is insert sdcard, and that option will be available to launch from the menu. (not sure if that is possible at all).