ottokiksmaler / nx500_nx1_modding

Samsung NX500 and NX1 Modding
GNU Affero General Public License v3.0
123 stars 42 forks source link

fix nx-on-wake daemon #85

Closed mewlips closed 6 years ago

mewlips commented 7 years ago

The problem is nx-on-wake executes 'on-wake' on every mount/umount events except when sdcard is not mounted. I think this is a bug.

vasile-gh commented 7 years ago

@mewlips I need to better understand what you want to do - what is the behaviour you want to see?

The reason I am running the event on every mount is because there's no userland means to detect when the camera wakes up - I am using the mount as a proxy to the real wake up because the SD card is unmounted when the camera goes to sleep.

So again, what is it that you want to actually see?

rgds

On 14 October 2016 at 17:08, mewlips - notifications@github.com < github.vasile.064e24ed9c.notifications#github.com@ob.0sg.net> wrote:

The problem is nx-on-wake executes 'on-wake' on every mount/umount events except when sdcard is not mounted.

I think this is a bug.

You can view, comment on, or merge this pull request online at:

https://github.com/ottokiksmaler/nx500_nx1_modding/pull/85 Commit Summary

  • nx-on-wake: run on-wake scripts on iff when sdcard is mounted

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/ottokiksmaler/nx500_nx1_modding/pull/85, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0St24IVobpFmPt6ObXKTUWr2sNYAn_ks5qz5rkgaJpZM4KXHY9 .

mewlips commented 7 years ago

When I hacking the camera, i need to mount/umounts partitions. for example, when i execute 'mount -o remount,rw /' command on telnet, nx-on-wake executes the nx-patch's on-wake. Then telnet process kllied by on-wake script.

And, I need to run some appplication in chroot environment. At this time, I need to mount /sys and /proc to chroot's root with bind option. There is no reason to execute 'on-wake' again.

So, I modified nx-on-wake to run 'on-wake' if and only if sdcard mount event occurs.

vasile-gh commented 7 years ago

@mewlips the current implementation only launches on-wake when the SD card is mounted. It does nothing when the card is unmounted.

From what I can see your code basically replaces the functionality that already exists.

mewlips commented 7 years ago

I modified two part of the original code.

First, isSdMounted() function, this is removal of possible overflow of buf when file read. maybe, this dose not change the action of nx-on-wake.

Second, I added sdMounted variable for tracking the sdcard mount/umount state. When sdcard unmounted, sdMounted set to zero. This occurs when power off by switch. (or cold boot from hibernation image, at this time sdMounted is zero) When poll function return and sdcard is mounted, nx-on-wake launches on-wake. Then sdMounted set to 1.

Edit: After the wake up, mount/umount events should be ignored until sdcard unmount event. The original code launches on-wake on any events of mount/umount except sdcard unmount event.

vasile-gh commented 7 years ago

ok. regarding your point 1 (overflow) I was quite aware of this but the target cameras do not have a large mounts file, and I preferred to do a read in one go to gain a few miliseconds :-). But I could accept your code since it does indeed do a cleaner job (at the cost of more complex algo)

Regarding your point 2: I think I understand: you want to be able to do other mounts/umounts: indeed, I did not consider the possibility of others (you :-) )wanting to mount/umount stuff.

Did you test the code? - i.e. compile and install it on your camera?

mewlips commented 7 years ago

Yes. I compiled nx-on-wake.

Before the installing, I cleaned my camera by updating the original firmware. Then, I copied the scripts for enable telnet and nx-on-wake files into the sdcard. After boot into the factory mode, I copied the nx-on-wake files (nx-on-wake, nx-on-wake.service) to root parition and I removed info.tg on sdcard.

Then, I followed below document. https://github.com/ottokiksmaler/nx500_nx1_modding/blob/master/doc/Update_hibernation_image.md My camera made sucessfully new hibernation image, and worked I intend to do.

However, I did not tested the original nx-on-wake installation process. So, more test will be required before the distribution to others.