NX500 - mod / some scripts

K

Kino Seed

Guest
Some scripts for making life easier (NX500):

Waking-up from hibernation (half-press shutter) and remembering last focus distance:
in test.sh
  1. af_info=($(st cap iq af pos))
  2. st cap iq af mv 10 $(($(head -n 1 /mnt/mmc/hib) - ${af_info[2]} )) 10
Of course to hibernate (and save focus distance first) a quick double-click-ev ( EV_EV.sh ):
  1. af_info=($(st cap iq af pos))
  2. pos_temp=${af_info[2]}
  3. echo $pos_temp > /mnt/mmc/hib
  4. sync
  5. sync
  6. sync
  7. sleep 1
  8. systemctl hybrid-sleep
Focus-Pull (setting a focus distance, and jumping back and forth) using environment variables Ev+HalfPressShutter ( EV_S1.sh )
  1. af_info=($(st cap iq af pos))
  2. pos_temp=${af_info[2]}
  3. tii=($(systemctl show-environment))
  4. for i in "${tii[@]}"; do if [[ $i == "pos="* ]]; then pos_mv=$((${i:4} - $pos_temp)); fi; done
  5. systemctl set-environment pos=$pos_temp
  6. st cap iq af mv 10 $pos_mv 10
  7. exit
Here are packed along with a few extras including the keyscan from Otto K
(included: silent shutter, and removing video-record limit in case you didn't want to bother doing manually)

http://authors-vault.com/NX500-KS-RC1.zip

note: in video-mode, focuss-pull should not be used, and direct hibernation from video should be avoided.

As you see it's just script-kiddie stuff, but for sake of legality - no implied warranty, use it at your own risk. ;)
 
Last edited:
Great work, keep it coming :)
 
Collection of small utilities for bash scripting added to github repo:
  • popup_timeout ["text message"] [timeout_in_seconds] - displays a popup message for a given number of seconds
  • popup_ok [message] [ok label] [cancel label] - displays a OK / Cancel dialog, returns 0 if OK, 255 if Cancel
  • popup_entry [message] [OK label] [cancel label] [sample entry] - displays an entry box with OK/Cancel buttons and prefilled sample text, returns entered text and 0 code for OK or just 255 for cancel.
 
Collection of small utilities for bash scripting added to github repo:.
Nice utilities to help with flexible settings. BTW why your compiled versions MUCH smaller than mine? your like 6kb -mine 500kb :)

yesterday tried to compile keyscan, it compiled but as i said size was much bigger.

PS i compiled in ubuntu.
 
Last edited:
Are you compiling static? That includes all library code in final executable.
 
Ok, this one needs a bit more love.
(not sure how to get it to work from a file.sh)

Press EV+Rec, a global variable gets declared (so we know that we want to keep recording), and a loop starts that simulates "press record", waits for the clip to be recorded for X-amount of seconds (should be less than max rec time), and after that time passes, simulates "press rec" to stop recording, and "press rec" to start a new file and continue recording.
To stop the continuous recording, just press EV+Rec again.

sounds simple, and I got it to work when I paste the code in telnet, but not from the keyscan nor just running sh -v EV_REC.sh

tried to debug, but seems when it's run by sh it throws different errors,
including things like taking "\r" with the value at a new line
and the second calling of "st key", sometimes throws internal errors.

#####EV_REC.sh#######

#Set recording length in seconds / ex. 9 for testing 900 for 15min
recording_length=9

tii=($(systemctl show-environment))
for i in "${tii[@]}"; do if [[ $i == "rec="* ]]; then rec=$((1-${i:4})); fi; done
if [ -z "$rec" ]; then rec=1; fi
systemctl set-environment rec=$rec

until [ $rec -lt 1 ]
do
st key click rec;sleep $recording_length;st key click rec
tii=($(systemctl show-environment))
for i in "${tii[@]}"; do if [[ $i == "rec="* ]]; then rec=${i:4}; fi; done
done

####################


any ideas how to get it to work in a useful way?
 
Last edited:
Ok, this one needs a bit more love.
(not sure how to get it to work from a file.sh)

Press EV+Rec, a global variable gets declared (so we know that we want to keep recording), and a loop starts that simulates "press record", waits for the clip to be recorded for X-amount of seconds (should be less than max rec time), and after that time passes, simulates "press rec" to stop recording, and "press rec" to start a new file and continue recording.
To stop the continuous recording, just press EV+Rec again.

sounds simple, and I got it to work when I paste the code in telnet, but not from the keyscan nor just running sh -v EV_REC.sh

tried to debug, but seems when it's run by sh it throws different errors,
including things like taking "\r" with the value at a new line
and the second calling of "st key", sometimes throws internal errors.

#####EV_REC.sh#######

#Set recording length in seconds / ex. 9 for testing 900 for 15min
recording_length=9

tii=($(systemctl show-environment))
for i in "${tii[@]}"; do if [[ $i == "rec="* ]]; then rec=$((1-${i:4})); fi; done
if [ -z "$rec" ]; then rec=1; fi
systemctl set-environment rec=$rec

until [ $rec -lt 1 ]
do
st key click rec;sleep $recording_length;st key click rec
tii=($(systemctl show-environment))
for i in "${tii[@]}"; do if [[ $i == "rec="* ]]; then rec=${i:4}; fi; done
done

####################


any ideas how to get it to work in a useful way?
actually it was some windows "coding" that messed up the script, my bad.
so it's OK, and works great (from telnet), but as soon as you try with keyscan, loads extremely slow (5-6sec), and barely works after that =/
 
If you ever wanted a quick switch between for example FHD/25p/PAL and UHD/30p/NTSC, this should help.

It requires popup_timeout (curtesy of Otto k) to be present in your /sdcard/script directory (so you can get some feedback on what it's doing). Download it here: popup_timeout

There are 2 different profiles, that you can load with EV_UP and EV_DOWN.
With EV_LEFT and EV_RIGHT you can save any two profiles.
So just set up your profile as you want it, press EV_LEFT, and it will be saved. Whenever you want to load it press EV_UP.

#EV_UP.sh
[ -f /mnt/mmc/presets/preset0_up ] && $( prefman load_file 0 /mnt/mmc/presets/preset0_up;prefman save 0; sync;sync;sync;/mnt/mmc/scripts/popup_timeout "PROFILE EV_UP LOADED" 2;reboot ) || /mnt/mmc/scripts/popup_timeout "Preset Missing" 3

#EV_DOWN.sh
[ -f /mnt/mmc/presets/preset0_down ] && $( prefman load_file 0 /mnt/mmc/presets/preset0_down;prefman save 0; sync;sync;sync;/mnt/mmc/scripts/popup_timeout "PROFILE EV_DOWN LOADED" 2;reboot ) || /mnt/mmc/scripts/popup_timeout "Preset Missing" 3

#EV_LEFT.sh
[ -d "/mnt/mmc/presets" ] || mkdir /mnt/mmc/presets
prefman save_file 0 /mnt/mmc/presets/preset0_up
sync
sync
sync
/mnt/mmc/scripts/popup_timeout "PROFILE EV_UP SAVED" 2
exit

#EV_RIGHT.sh
[ -d "/mnt/mmc/presets" ] || mkdir /mnt/mmc/presets
prefman save_file 0 /mnt/mmc/presets/preset0_down
sync
sync
sync
/mnt/mmc/scripts/popup_timeout "PROFILE EV_DOWN SAVED" 2
exit

Please note the EV_UP.sh and EV_DOWN.sh are one line!

The code backs up (and restores) a lot more than a few of the video-profile settings.
It will backup and restore most of your camera settings.

The profile presets are stores in /sdcard/presets/ and can be copied and worked with as with any other file (so you can have any number of profile files, and load only those two that you need for the day).

--
 
Last edited:
Thank you very much, Kino Seed!

:)
 
I may be stating the obvious, but in any case, to get the most out of the DR set they GAMMA to V, and make sure you won't lose any tonal resolution (so keep 0 - 255).

#GAMMA_CONTROL_STANDARD (0x760000),
#GAMMA_CONTROL_GAMMA_V (0x760001),
#GAMMA_CONTROL_GAMMA_D (0x760002)
st cap capdtm setusr MOVIE_GAMMA_CONTROL 0x760001 &

#MOVIE_LUMINANCE_LEVEL_0_255 (0x770000),
#MOVIE_LUMINANCE_LEVEL_16_235 (0x770001),
#MOVIE_LUMINANCE_LEVEL_16_255 (0x770002),
st cap capdtm setusr MOVIE_LUMINANCE_LEVEL 0x770000 &

"MOVIE_MASTER_BLACK_LEVEL" apparently can be set to any positive value (70 is accepted too), but on NX500 shows no change, if you want, give it a try on NX1:
st cap capdtm setvar MOVIE_MASTER_BLACK_LEVEL 25 4
 
Last edited:
Here's a way to change the bitrate with poker.
(should be much faster)

Otto K's creation "poker" can be downloaded here:
https://github.com/ottokiksmaler/nx500_nx1_modding/blob/master/poker

I used vasile's bitrate mod, as a basis on this one.
(keep in mind the NX500-pro, bitrates are different than the others, otherwise is straight forward)

(assuming you downloaded "poker" and have put it in /sdcard/scripts/ )

#######################
###### DO NOT TOUCH ######
###### bitrate modified ######
######################
bitrate_35=(40f6c063 c0f21623)
bitrate_40=(45f6023 c0f26223)
bitrate_45=(4af24053 c0f2ae23)
bitrate_50=(4ff2803 c0f2fa23)
bitrate_55=(43f6c033 c0f24733)
bitrate_60=(48f2073 c0f29333)
bitrate_65=(4df24023 c0f2df33)
bitrate_70=(41f68053 c0f22c43)
bitrate_75=(46f6c03 c0f27843)
bitrate_80=(4bf2043 c0f2c443)
bitrate_85=(4ff64073 c0f21053)
bitrate_90=(44f68023 c0f25d53)
bitrate_95=(49f2c053 c0f2a953)
bitrate_100=(4ef2013 c0f2f553)
bitrate_110=(47f28073 c0f28e63)
bitrate_120=(40f6063 c0f22773)
bitrate_130=(4af28043 c0f2bf73)
bitrate_140=(43f6033 c0f6583)
bitrate_150=(4df28013 c0f6f03)
bitrate_160=(46f603 c0f68913)
bitrate_170=(4ff68063 c0f62123)
bitrate_180=(49f2053 c0f6ba23)
bitrate_190=(42f68033 c0f65333)
bitrate_200=(4cf2023 c0f6eb33)
bitrate_210=(45f6803 c0f68443)
bitrate_220=(4ef6073 c0f61c53)
bitrate_230=(48f28053 c0f6b553)
bitrate_240=(41f6043 c0f64e63)
bitrate_250=(4bf28023 c0f6e663)
bitrate_260=(44f6013 c0f67f73)
bitrate_270=(4df68073 c1f2173)
bitrate_280=(47f2063 c1f2b03)
bitrate_290=(40f68043 c1f24913)
bitrate_300=(4af2033 c1f2e113)
bitrate_310=(43f68013 c1f27a23)
bitrate_320=(4df203 c1f21233)
#############################
############ DO NOT TOUCH ######
############ bitrate NX500 PRO ####
############################
bitrate_nx500pro_35=(40f6c060 c0f21620)
bitrate_nx500pro_40=(45f6020 c0f26220)
bitrate_nx500pro_45=(4af24050 c0f2ae20)
bitrate_nx500pro_50=(4ff2800 c0f2fa20)
bitrate_nx500pro_55=(43f6c030 c0f24730)
bitrate_nx500pro_60=(48f2070 c0f29330)
bitrate_nx500pro_65=(4df24020 c0f2df30)
bitrate_nx500pro_70=(41f68050 c0f22c40)
bitrate_nx500pro_75=(46f6c00 c0f27840)
bitrate_nx500pro_80=(4bf2040 c0f2c440)
bitrate_nx500pro_85=(4ff64070 c0f21050)
bitrate_nx500pro_90=(44f68020 c0f25d50)
bitrate_nx500pro_95=(49f2c050 c0f2a950)
bitrate_nx500pro_100=(4ef2010 c0f2f550)
bitrate_nx500pro_110=(47f28070 c0f28e60)
bitrate_nx500pro_120=(40f6060 c0f22770)
bitrate_nx500pro_130=(4af28040 c0f2bf70)
bitrate_nx500pro_140=(43f6030 c0f6580)
bitrate_nx500pro_150=(4df28010 c0f6f00)
bitrate_nx500pro_160=(46f600 c0f68910)
bitrate_nx500pro_170=(4ff68060 c0f62120)
bitrate_nx500pro_180=(49f2050 c0f6ba20)
bitrate_nx500pro_190=(42f68030 c0f65330)
bitrate_nx500pro_200=(4cf2020 c0f6eb30)
bitrate_nx500pro_210=(45f6800 c0f68440)
bitrate_nx500pro_220=(4ef6070 c0f61c50)
bitrate_nx500pro_230=(48f28050 c0f6b550)
bitrate_nx500pro_240=(41f6040 c0f64e60)
bitrate_nx500pro_250=(4bf28020 c0f6e660)
bitrate_nx500pro_260=(44f6010 c0f67f70)
bitrate_nx500pro_270=(4df68070 c1f2170)
bitrate_nx500pro_280=(47f2060 c1f2b00)
bitrate_nx500pro_290=(40f68040 c1f24910)
bitrate_nx500pro_300=(4af2030 c1f2e110)
bitrate_nx500pro_310=(43f68010 c1f27a20)
bitrate_nx500pro_320=(4df200 c1f21230)
#################################
############ DO NOT TOUCH ##########
############ bitrate offset definitions #####
################################
nx1_pro1=(0xb40d19d8 0xb40d19dc)
nx1_pro2=(0xb40d1a20 0xb40d1a24)
nx1_hq1=(0xb40d1832 0xb40d183a)
nx1_hq2=(0xb40d192e 0xb40d1936)
nx1_hq3=(0xb40d1a30 0xb40d1a38)
#
nx500_pro1=(0xb4046a04 0xb4046a08)
nx500_pro2=(0xb40469fa 0xb40469fe)
nx500_pro3=(0xb4046a64 0xb4046a68)
nx500_hq1=(0xb4046962 0xb404696a)
nx500_hq2=(0xb40468f0 0xb40468f8)
nx500_hq3=(0xb4046a50 0xb4046a58)
nx500_hq4=(0xb4046920 0xb4046928)

#########################

#example setting NX500 HQ1 to 65Mbps

/mnt/mmc/scripts/poker $(pgrep di-camera-app) ${nx500_hq1[0]}:${bitrate_65[0]} ${nx500_hq1[1]}:${bitrate_65[1]}

#

#

#example setting NX500 PRO1 to 120Mbps

/mnt/mmc/scripts/poker $(pgrep di-camera-app) ${nx500_pro1[0]}:${bitrate_nx500pro_120[0]} ${nx500_pro1[1]}:${bitrate_nx500pro_120[1]}
 
Last edited:
Use: sh /sdcard/scripts/pokemon <setting> <bitrate>
example: sh /sdcard/scripts/pokemon hq1 70

Autodetect NX1/NX500, change bitrates on the fly.
2.5K ready (needs to be patched separately)

Requires "poker" created by Otto, and offset tables are based on vasile's work.
For support of vasile's work., you can donate through paypal to [email protected]

pokemon:
#!/bin/bash
########################################################################
############ DO NOT TOUCH ##############################################
############ bitrate modified ##########################################
########################################################################
bitrate_35=(40f6c063 c0f21623)
bitrate_40=(45f6023 c0f26223)
bitrate_45=(4af24053 c0f2ae23)
bitrate_50=(4ff2803 c0f2fa23)
bitrate_55=(43f6c033 c0f24733)
bitrate_60=(48f2073 c0f29333)
bitrate_65=(4df24023 c0f2df33)
bitrate_70=(41f68053 c0f22c43)
bitrate_75=(46f6c03 c0f27843)
bitrate_80=(4bf2043 c0f2c443)
bitrate_85=(4ff64073 c0f21053)
bitrate_90=(44f68023 c0f25d53)
bitrate_95=(49f2c053 c0f2a953)
bitrate_100=(4ef2013 c0f2f553)
bitrate_110=(47f28073 c0f28e63)
bitrate_120=(40f6063 c0f22773)
bitrate_130=(4af28043 c0f2bf73)
bitrate_140=(43f6033 c0f6583)
bitrate_150=(4df28013 c0f6f03)
bitrate_160=(46f603 c0f68913)
bitrate_170=(4ff68063 c0f62123)
bitrate_180=(49f2053 c0f6ba23)
bitrate_190=(42f68033 c0f65333)
bitrate_200=(4cf2023 c0f6eb33)
bitrate_210=(45f6803 c0f68443)
bitrate_220=(4ef6073 c0f61c53)
bitrate_230=(48f28053 c0f6b553)
bitrate_240=(41f6043 c0f64e63)
bitrate_250=(4bf28023 c0f6e663)
bitrate_260=(44f6013 c0f67f73)
bitrate_270=(4df68073 c1f2173)
bitrate_280=(47f2063 c1f2b03)
bitrate_290=(40f68043 c1f24913)
bitrate_300=(4af2033 c1f2e113)
bitrate_310=(43f68013 c1f27a23)
bitrate_320=(4df203 c1f21233)
########################################################################
############ DO NOT TOUCH ##############################################
############ bitrate NX500 PRO #########################################
########################################################################
bitrate_nx500pro_35=(40f6c060 c0f21620)
bitrate_nx500pro_40=(45f6020 c0f26220)
bitrate_nx500pro_45=(4af24050 c0f2ae20)
bitrate_nx500pro_50=(4ff2800 c0f2fa20)
bitrate_nx500pro_55=(43f6c030 c0f24730)
bitrate_nx500pro_60=(48f2070 c0f29330)
bitrate_nx500pro_65=(4df24020 c0f2df30)
bitrate_nx500pro_70=(41f68050 c0f22c40)
bitrate_nx500pro_75=(46f6c00 c0f27840)
bitrate_nx500pro_80=(4bf2040 c0f2c440)
bitrate_nx500pro_85=(4ff64070 c0f21050)
bitrate_nx500pro_90=(44f68020 c0f25d50)
bitrate_nx500pro_95=(49f2c050 c0f2a950)
bitrate_nx500pro_100=(4ef2010 c0f2f550)
bitrate_nx500pro_110=(47f28070 c0f28e60)
bitrate_nx500pro_120=(40f6060 c0f22770)
bitrate_nx500pro_130=(4af28040 c0f2bf70)
bitrate_nx500pro_140=(43f6030 c0f6580)
bitrate_nx500pro_150=(4df28010 c0f6f00)
bitrate_nx500pro_160=(46f600 c0f68910)
bitrate_nx500pro_170=(4ff68060 c0f62120)
bitrate_nx500pro_180=(49f2050 c0f6ba20)
bitrate_nx500pro_190=(42f68030 c0f65330)
bitrate_nx500pro_200=(4cf2020 c0f6eb30)
bitrate_nx500pro_210=(45f6800 c0f68440)
bitrate_nx500pro_220=(4ef6070 c0f61c50)
bitrate_nx500pro_230=(48f28050 c0f6b550)
bitrate_nx500pro_240=(41f6040 c0f64e60)
bitrate_nx500pro_250=(4bf28020 c0f6e660)
bitrate_nx500pro_260=(44f6010 c0f67f70)
bitrate_nx500pro_270=(4df68070 c1f2170)
bitrate_nx500pro_280=(47f2060 c1f2b00)
bitrate_nx500pro_290=(40f68040 c1f24910)
bitrate_nx500pro_300=(4af2030 c1f2e110)
bitrate_nx500pro_310=(43f68010 c1f27a20)
bitrate_nx500pro_320=(4df200 c1f21230)
########################################################################
############ DO NOT TOUCH ##############################################
############ bitrate offset definitions ################################
############ see scripts/nx-bitrate-map.png to find out more ###########
########################################################################
nx1_pro1=(0xb40d19d8 0xb40d19dc)
nx1_pro2=(0xb40d1a20 0xb40d1a24)
nx1_hq1=(0xb40d1832 0xb40d183a)
nx1_hq2=(0xb40d192e 0xb40d1936)
nx1_hq3=(0xb40d1a30 0xb40d1a38)
#
nx500_pro1=(0xb4046a04 0xb4046a08)
nx500_pro2=(0xb40469fa 0xb40469fe)
nx500_pro3=(0xb4046a64 0xb4046a68)
nx500_hq1=(0xb4046962 0xb404696a)
nx500_hq2=(0xb40468f0 0xb40468f8)
nx500_hq3=(0xb4046a50 0xb4046a58)
nx500_hq4=(0xb4046920 0xb4046928)
nx500_hq5=(0xb4046998 0xb40469aa)
nx500_hq6=(0xb40469a0 0xb40469b2)

if [ $(/bin/grep ^NX500$ /etc/version.info) = "NX500" -a $(/bin/grep ^1.11$ /etc/version.info) = "1.11" ]; then
if [ $1 = "pro1" -o $1 = "pro2" -o $1 = "pro3" ]; then
br0=bitrate_nx500pro_$2[0]; br1=bitrate_nx500pro_$2[1]
else
br0=bitrate_$2[0]; br1=bitrate_$2[1]
fi
off0=nx500_$1[0]; off1=nx500_$1[1]
if [[ ${!off0}>"" && ${!off1}>"" && ${!br0}>"" && ${!br1}>"" ]]; then
/mnt/mmc/scripts/poker $(pgrep di-camera-app) ${!off0}:${!br0} ${!off1}:${!br1}
fi
elif [$(/bin/grep ^NX1$ /etc/version.info) = "NX1" -a $(/bin/grep ^1.40$ /etc/version.info) = "1.40"]; then
br0=bitrate_$2[0]; br1=bitrate_$2[1]
off0=nx1_$1[0]; off0=nx1_$1[1]
if [[ ${!off0}>"" && ${!off1}>"" && ${!br0}>"" && ${!br1}>"" ]]; then
/mnt/mmc/scripts/poker $(pgrep di-camera-app) ${!off0}:${!br0} ${!off1}:${!br1}
fi
fi
 
Last edited:

Keyboard shortcuts

Back
Top