chdkptp - alternative ptp client - page 107 - General Discussion and Assistance - CHDK Forum

chdkptp - alternative ptp client

  • 1106 Replies
  • 517578 Views
*

Offline reyalp

  • ******
  • 14082
Re: chdkptp - alternative ptp client
« Reply #1060 on: 30 / June / 2020, 13:27:02 »
Advertisements
The last few days I've been playing with Ubuntu 20.04 under VM and chdkptp works pretty well, both versions, CLI and GUI.
In the latest distribution libreadline.so.6 has been upgraded to libreadline.so.8, this solves the problem:
Code: [Select]
cd / lib / x86_64-linux-gnu /
sudo ln -s libreadline.so.8.0 libreadline.so.6
sudo ln -s libhistory.so.8.0 libhistory.so.6
I have no clue about working on Linux, the last time I worked on a Unix / Linux system was in the early 90s, maybe there is a better solution but I only remembered this. :D
Thanks for the report.

Which chdkptp build is this? The 921 snapshot is supposed have readline and the related libraries statically linked to avoid this.

Using symlinks like this isn't recommended since the ABIs are actually different, but I suspect it would work for chdkptp in this case.

Quote
The next step is compiling under Linux. :P
It should be relatively easy these days
download and configure external libraries with
misc/setup-ext-libs.bash
then make to build. editing config.mk shouldn't be required any more (if you are building in an existing source tree, it would be good to remove any old config.mk and start fresh).
Don't forget what the H stands for.

*

Offline blackhole

  • *****
  • 940
  • A590IS 101b
    • Planetary astrophotography
Re: chdkptp - alternative ptp client
« Reply #1061 on: 30 / June / 2020, 13:43:51 »
Which chdkptp build is this? The 921 snapshot is supposed have readline and the related libraries statically linked to avoid this.

Using symlinks like this isn't recommended since the ABIs are actually different, but I suspect it would work for chdkptp in this case.
Older r795,I didn't choose the latest one, I was just interested in whether it works under VM. This way I struggled a bit and learned something new.
Quote
It should be relatively easy these days
download and configure external libraries with
misc/setup-ext-libs.bash
then make to build. editing config.mk shouldn't be required any more (if you are building in an existing source tree, it would be good to remove any old config.mk and start fresh).
Thanks for the advice!


*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: chdkptp - alternative ptp client
« Reply #1062 on: 01 / October / 2020, 00:54:32 »
For review - quick & dirty patch to make chdkptp work with Lua 5.3.


Changes:
- copy code for luaL_register and luaL_optint from Lua 5.2 to luautil.h & luautil.c
- add fixes for deprecated loadstring, unpack and table.maxn functions in main.lua
- change %d format strings to %.0f (Lua 5.3 won't convert float to int unless the float is an exact integer value)


All tests in 'test.lua' and 'camtests.lua' pass on MacOS Catalina and Debian (LMDE 2).
IUP/CD GUI appears to work correctly (Debian).


Notes:
- table.maxn patch uses #t for table length, not sure if this is ok as the two are not identical
- there may still be other '%d' format strings that need changing.


Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline reyalp

  • ******
  • 14082
Re: chdkptp - alternative ptp client
« Reply #1063 on: 01 / October / 2020, 17:01:45 »
For review - quick & dirty patch to make chdkptp work with Lua 5.3.
Thanks, much appreciated.

Out of curiosity, did you run into something that requires to you use 5.3? The current recommended process using misc/setup-ext-libs.bash should be completely self contained without dependency on system installed Lua.

Supporting 5.3 and dropping 5.1 support have been on my TODO list forever, so it's not wasted effort in any case.
Don't forget what the H stands for.


*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: chdkptp - alternative ptp client
« Reply #1064 on: 03 / October / 2020, 12:35:54 »
 :-[  if (os.stat(LOG_NAME)) then
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
File:52: attempt to call a nil value (field 'stat')
All lifetime is a loan from eternity.

*

Offline reyalp

  • ******
  • 14082
Re: chdkptp - alternative ptp client
« Reply #1065 on: 03 / October / 2020, 12:54:35 »
:-[  if (os.stat(LOG_NAME)) then
Lua 5.3.4  Copyright (C) 1994-2017 Lua.org, PUC-Rio
File:52: attempt to call a nil value (field 'stat')
os.stat is a CHDK addition to camera side Lua (which is still version 5.1). If you want equivalent operations in chdkptp PC side Lua, you would use lfs.attributes
Don't forget what the H stands for.

*

Offline Caefix

  • *****
  • 945
  • Sorry, busy deleting test shots...
Re: chdkptp - alternative ptp client
« Reply #1066 on: 03 / October / 2020, 14:34:46 »
 :) Maybe You want to test Emulator with Keywords updated until set_clock here:
All lifetime is a loan from eternity.

*

Offline reyalp

  • ******
  • 14082
Re: chdkptp - alternative ptp client
« Reply #1067 on: 03 / October / 2020, 21:39:15 »
Notes:
- table.maxn patch uses #t for table length, not sure if this is ok as the two are not identical
I had to jog my memory a bit for this one, but it's not. From the 5.1 manual (maxn was already deprecated in 5.2)
Quote
Returns the largest positive numerical index of the given table, or zero if the table has no positive numerical indices. (To do its job this function does a linear traversal of the whole table.)

This allows holes, which ends up being important for cases like camera side code doing
Code: [Select]
return 1, nil, 2
and the PC side code putting return values the values into an array (see con_methods:exec toward the end)

I should add something to camtests for this.

There are also some other cases that rely on this behavior.

Anyway, this can be fixed with a trivial, inefficient Lua implementation of maxn.
Don't forget what the H stands for.


*

Offline philmoz

  • *****
  • 3450
    • Photos
Re: chdkptp - alternative ptp client
« Reply #1068 on: 03 / October / 2020, 22:41:57 »
Notes:
- table.maxn patch uses #t for table length, not sure if this is ok as the two are not identical
I had to jog my memory a bit for this one, but it's not. From the 5.1 manual (maxn was already deprecated in 5.2)
Anyway, this can be fixed with a trivial, inefficient Lua implementation of maxn.

Thanks for that. To avoid any conversion issue I copied the C code for maxn from 5.2 and added it to the 'sys' table on startup.

Updated patch also fixes lsignal.c (luaL_register), %d format strings in gui_live_stats.lua and a copy/paste typo in gui_user.lua.

Phil.
CHDK ports:
  sx30is (1.00c, 1.00h, 1.00l, 1.00n & 1.00p)
  g12 (1.00c, 1.00e, 1.00f & 1.00g)
  sx130is (1.01d & 1.01f)
  ixus310hs (1.00a & 1.01a)
  sx40hs (1.00d, 1.00g & 1.00i)
  g1x (1.00e, 1.00f & 1.00g)
  g5x (1.00c, 1.01a, 1.01b)
  g7x2 (1.01a, 1.01b, 1.10b)

*

Offline reyalp

  • ******
  • 14082
Re: chdkptp - alternative ptp client
« Reply #1069 on: 05 / October / 2020, 02:24:27 »
Wow, nice work. I'll have to think about what the way forward is, it would be nice not to maintain two parallel versions of the GUI.

I just checked in the 5.3 support stuff, along with support in makefile and setup scripts, in r948

Everything defaults to Lua 5.2. To use Lua 5.3
misc/setup-ext-libs.bash -lua-ver=53
add USE_LUA_VER=53 to config.mk
misc/bin-snapshot.bash -libs=linux-lua53
(Windows doesn't require -libs since it's all static)

I think there are still some corner cases involving integer format strings, but I don't expect the changes to cause any problems in 5.2.
Don't forget what the H stands for.

 

Related Topics