pktriggercord icon indicating copy to clipboard operation
pktriggercord copied to clipboard

Support for K-70?

Open jmozmoz opened this issue 7 years ago • 41 comments

I tried to use the command line utility (using Windows) to connect to my K-70:

c:\opt\pktriggercord>pktriggercord-cli.exe --status --debug
Debug messaging is now enabled.
pktriggercord-cli.exe 0.81.00
model (null)
device (null)
Checking drive:  C
Checking drive:  D
Checking drive:  E Checking drive:  F RICOHIMG DSC_K-70
...
camera not found

Is there any change to add support for it? Where to start?

jmozmoz avatar Dec 12 '16 23:12 jmozmoz

K-70 is not yet supported. I've created a test version, please test it and copy the output here.

pktriggercord-0.84.03-win.zip

asalamon74 avatar Dec 13 '16 08:12 asalamon74

Thank you for your very fast response. The GUI version crashed on startup. This is the output from Visual Studio Debugger:

Unhandled exception at 0x76739170 (msvcrt.dll) in pktriggercord.exe: 0xC0000005: Access violation reading location 0x00000000.

If there is a handler for this exception, the program may be safely continued.
----
Exception thrown at 0x76739170 (msvcrt.dll) in pktriggercord.exe: 0xC0000005: Access violation reading location 0x00000000.

If there is a handler for this exception, the program may be safely continued.
----
and so on...

Here is the output of the status from the command line:

c:\opt\pktriggercord-0.84.03>pktriggercord-cli -status --debug
Debug messaging is now enabled.
pktriggercord-cli 0.84.03
model (null)
device (null)
[C]     plsr_init()
driveNum:24
        Checking drive:  C
        Checking drive:  D
        Checking drive:  E
        Checking drive:  F RICOHIMG DSC_K-70
        Found camera RICOHIMG DSC_K-70
before connect
[C]     pslr_connect()
[C]             ipslr_status()
[C]                     command(fd=f0, 0, 1, 0)
[C]                     get_result(0xf0)
[R]                              => [1C 00 00 00]
[C]                     read_result(0xf0, size=28)
[R]                              => [02 00 00 00  00 00 00 00  10 02 00 02  01 00 80 80
                                     00 00 00 00  02 00 00 00  00 00 00 00]
[C]             ipslr_set_mode(0x1)
[C]                     _ipslr_write_args(cmd_2 = 0x0, {0x1})
[C]                     command(fd=f0, 0, 0, 4)
[C]                     get_status(0xf0)
[R]                              => ERROR: 0x01
[C]             ipslr_status()
[C]                     command(fd=f0, 0, 1, 0)
[C]                     get_result(0xf0)
[R]                              => [1C 00 00 00]
[C]                     read_result(0xf0, size=28)
[R]                              => [02 00 00 00  00 00 00 00  10 02 00 01  01 00 80 80
                                     00 00 00 00  00 00 00 00  00 00 00 00]
[C]             ipslr_identify()
[C]                     command(fd=f0, 0, 4, 0)
[C]                     get_result(0xf0)
[R]                              => [08 00 00 00]
[C]                     read_result(0xf0, size=8)
[R]                              => [22 32 01 00  4A 02 00 00]
        id of the camera: 13222
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 0
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  10 02 00 01  01 00 80 80
                                     00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
        init bufmask=0x0
[C]             ipslr_cmd_00_09(0x2)
[C]                     _ipslr_write_args(cmd_2 = 0x0, {0x2})
[C]                     command(fd=f0, 0, 9, 4)
[C]                     get_status(0xf0)
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 0
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  10 02 00 02  01 00 80 80
                                     00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
[C]             ipslr_cmd_10_0a(0x1)
[C]                     _ipslr_write_args(cmd_2 = 0x0, {0x1})
[C]                     command(fd=f0, 10, a, 4)
[C]                     get_status(0xf0)
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 0
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
[C]     pslr_camera_name()
pktriggercord-cli: K-70 Connected...
[C]     pslr_get_status()
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 0
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
[C]     pslr_get_status()
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 0
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
[C]     pslr_get_status()
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 0
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]

current iso                     : 0
current shutter speed           : 0/0
camera max shutter speed        : 0/0
current aperture                : unknown
lens max aperture               : unknown
lens min aperture               : unknown
set shutter speed               : 0/0
set aperture                    : unknown
fixed iso                       : 0
auto iso                        : 0-0
jpeg quality                    : 0
jpeg resolution                 : 24M
jpeg image tone                 : Natural
jpeg saturation                 : 0
jpeg contrast                   : 0
jpeg sharpness                  : 0
jpeg hue                        : 0
zoom                            : unknown mm
focus                           : 0
color space                     : sRGB
image format                    : JPEG
raw format                      : PEF
light meter flags               : 0
ec                              : unknown
custom ev steps                 : 1/2
custom sensitivity steps        : 0
exposure mode                   : 0 (NONE)
user mode flag                  : 0
ae metering mode                : Multi
af mode                         : MF
af point select                 : Auto-5
selected af point               : 0
focused af point                : 0
drive mode                      : Single
auto bracket mode               : off
auto bracket picture count      : 0
auto bracket ev                 : unknown
shake reduction                 : off
white balance mode              : Auto
white balance adjust            : M7B7
flash mode                      : Manual
flash exposure compensation     : 0.00
manual mode ev                  : 0.00
lens                            : M-42 or No Lens
battery                         : 0.00V 0.00V 0.00V 0.00V

I was also able to get a picture in manual and "green" mode:

c:\opt\pktriggercord-0.84.03>pktriggercord-cli --file_format=JPEG -o test.jpg -i 100  -t 2 -m M -a 4.5
c:\opt\pktriggercord-0.84.03>pktriggercord-cli --file_format=JPEG -o test1.jpg -m GREEN

So actually, everything I need is there :smile: :clap: :+1: (ok, it would be nice to have all this status infos, but as everything is in the exif data of the picture, it is not so important)

jmozmoz avatar Dec 13 '16 23:12 jmozmoz

Looks promising. I attach a new version which tries to parse the status info. Please try the following command:

pktriggercord-cli.exe --status_hex --debug

It might also fix the GUI. I'm not sure. You can also add --debug for the GUI.

pktriggercord-0.84.03-win.zip

asalamon74 avatar Dec 14 '16 07:12 asalamon74

c:\opt\pktriggercord-0.84.03>pktriggercord-cli.exe --status_hex --debug
Debug messaging is now enabled.
pktriggercord-cli.exe 0.84.03
model (null)
device (null)
[C]     plsr_init()
driveNum:24
        Checking drive:  C
        Checking drive:  D
        Checking drive:  E
        Checking drive:  F RICOHIMG DSC_K-70
        Found camera RICOHIMG DSC_K-70
before connect
[C]     pslr_connect()
[C]             ipslr_status()
[C]                     command(fd=f0, 0, 1, 0)
[C]                     get_result(0xf0)
[R]                              => [1C 00 00 00]
[C]                     read_result(0xf0, size=28)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00]
[C]             ipslr_set_mode(0x1)
[C]                     _ipslr_write_args(cmd_2 = 0x0, {0x1})
[C]                     command(fd=f0, 0, 0, 4)
[C]                     get_status(0xf0)
[R]                              => ERROR: 0x01
[C]             ipslr_status()
[C]                     command(fd=f0, 0, 1, 0)
[C]                     get_result(0xf0)
[R]                              => [1C 00 00 00]
[C]                     read_result(0xf0, size=28)
[R]                              => [02 00 00 00  00 00 00 00  10 02 00 01  01 00 80 80
                                     00 00 00 00  00 00 00 00  00 00 00 00]
[C]             ipslr_identify()
[C]                     command(fd=f0, 0, 4, 0)
[C]                     get_result(0xf0)
[R]                              => [08 00 00 00]
[C]                     read_result(0xf0, size=8)
[R]                              => [22 32 01 00  4A 02 00 00]
        id of the camera: 13222
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 456
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  10 02 00 01  01 00 80 80
                                     00 00 00 00  00 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
0x0000 | 02 00 00 00 00 00 00 00  10 02 00 01 01 00 80 80
0x0010 | 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0020 | 00 00 00 00 00 00 00 00  05 00 00 00 00 00 00 00
0x0030 | 00 01 00 00 02 00 00 00  01 00 00 00 2d 00 00 00
0x0040 | 0a 00 00 00 00 00 00 00  0a 00 00 00 00 00 00 00
0x0050 | 03 00 00 00 0a 00 00 00  00 00 00 00 00 00 00 00
0x0060 | 00 00 00 00 0c 00 00 00  64 00 00 00 64 00 00 00
0x0070 | 80 0c 00 00 00 00 00 00  07 00 00 00 07 00 00 00
0x0080 | 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0090 | 00 00 00 00 04 00 00 00  05 00 00 00 05 00 00 00
0x00a0 | 00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00
0x00b0 | 00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00
0x00c0 | 03 00 00 00 06 00 00 00  00 40 00 00 00 00 00 00
0x00d0 | 00 00 00 00 05 00 00 00  00 00 00 00 03 00 00 00
0x00e0 | 00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00
0x00f0 | 01 00 00 00 01 00 00 00  00 00 00 00 88 13 00 00
0x0100 | 04 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0110 | 02 00 00 00 01 00 00 00  2d 00 00 00 0a 00 00 00
0x0120 | 00 00 00 00 0a 00 00 00  00 00 00 00 0a 00 00 00
0x0130 | 01 00 00 00 70 17 00 00  64 00 00 00 00 00 00 00
0x0140 | 00 00 00 00 03 00 00 00  32 00 00 00 0a 00 00 00
0x0150 | 40 01 00 00 0a 00 00 00  00 00 00 00 00 00 00 00
0x0160 | 00 00 00 00 0a 00 00 00  00 00 00 00 00 00 00 00
0x0170 | 50 02 00 00 21 03 00 00  f9 02 00 00 00 00 00 00
0x0180 | 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0190 | 00 00 00 00 84 00 00 00  00 00 00 00 00 00 00 00
0x01a0 | fc 00 00 00 ac 0d 00 00  64 00 00 00 14 00 00 00
0x01b0 | d8 ff ff ff 00 00 00 00  02 00 00 00 0f 00 00 00
0x01c0 | 3f 00 00 00 00 00 00 00
        init bufmask=0x0
[C]             ipslr_cmd_00_09(0x2)
[C]                     _ipslr_write_args(cmd_2 = 0x0, {0x2})
[C]                     command(fd=f0, 0, 9, 4)
[C]                     get_status(0xf0)
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[R]                              => ERROR: 0x01
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 456
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
                buf[008] last 10h  16 new 00h   0
                buf[00B] last 01h   1 new 02h   2
                buf[014] last 00h   0 new 03h   3
                buf[064] last 0Ch  12 new 00h   0
---------------------------
[C]             ipslr_cmd_10_0a(0x1)
[C]                     _ipslr_write_args(cmd_2 = 0x0, {0x1})
[C]                     command(fd=f0, 10, a, 4)
[C]                     get_status(0xf0)
[R]                              => ERROR: 0x01
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 456
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
[C]     pslr_camera_name()
pktriggercord-cli.exe: K-70 Connected...
[C]     pslr_get_status()
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 456
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
[C]     pslr_get_status()
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 456
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
[C]     pslr_get_status()
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 456
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
[C]     pslr_get_status_buffer()
[C]             ipslr_status_full()
[C]                     command(fd=f0, 0, 8, 0)
[C]                     get_result(0xf0)
[R]                              => [C8 01 00 00]
        read 456 bytes
        expected_bufsize: 456
[C]                     read_result(0xf0, size=456)
[R]                              => [02 00 00 00  00 00 00 00  00 02 00 02  01 00 80 80
                                     00 00 00 00  03 00 00 00  00 00 00 00  00 00 00 00 ... (424 bytes more)]
0x0000 | 02 00 00 00 00 00 00 00  00 02 00 02 01 00 80 80
0x0010 | 00 00 00 00 03 00 00 00  00 00 00 00 00 00 00 00
0x0020 | 00 00 00 00 00 00 00 00  05 00 00 00 00 00 00 00
0x0030 | 00 01 00 00 02 00 00 00  01 00 00 00 2d 00 00 00
0x0040 | 0a 00 00 00 00 00 00 00  0a 00 00 00 00 00 00 00
0x0050 | 03 00 00 00 0a 00 00 00  00 00 00 00 00 00 00 00
0x0060 | 00 00 00 00 00 00 00 00  64 00 00 00 64 00 00 00
0x0070 | 80 0c 00 00 00 00 00 00  07 00 00 00 07 00 00 00
0x0080 | 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0090 | 00 00 00 00 04 00 00 00  05 00 00 00 05 00 00 00
0x00a0 | 00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00
0x00b0 | 00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00
0x00c0 | 03 00 00 00 06 00 00 00  00 40 00 00 00 00 00 00
0x00d0 | 00 00 00 00 05 00 00 00  00 00 00 00 03 00 00 00
0x00e0 | 00 00 00 00 01 00 00 00  00 00 00 00 00 00 00 00
0x00f0 | 01 00 00 00 01 00 00 00  00 00 00 00 88 13 00 00
0x0100 | 04 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0110 | 02 00 00 00 01 00 00 00  2d 00 00 00 0a 00 00 00
0x0120 | 00 00 00 00 0a 00 00 00  00 00 00 00 0a 00 00 00
0x0130 | 01 00 00 00 70 17 00 00  64 00 00 00 00 00 00 00
0x0140 | 00 00 00 00 03 00 00 00  32 00 00 00 0a 00 00 00
0x0150 | 40 01 00 00 0a 00 00 00  00 00 00 00 00 00 00 00
0x0160 | 00 00 00 00 0a 00 00 00  00 00 00 00 00 00 00 00
0x0170 | 50 02 00 00 21 03 00 00  f9 02 00 00 00 00 00 00
0x0180 | 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00
0x0190 | 00 00 00 00 84 00 00 00  00 00 00 00 00 00 00 00
0x01a0 | fc 00 00 00 ac 0d 00 00  64 00 00 00 14 00 00 00
0x01b0 | d8 ff ff ff 00 00 00 00  02 00 00 00 0f 00 00 00
0x01c0 | 3f 00 00 00 00 00 00 00

current iso                     : 100
current shutter speed           : 2/1
camera max shutter speed        : 1/6000
current aperture                : 4.5
lens max aperture               : 32.0
lens min aperture               : 5.0
set shutter speed               : 2/1
set aperture                    : 4.5
fixed iso                       : 100
auto iso                        : 100-3200
jpeg quality                    : 3
jpeg resolution                 : 24M
jpeg image tone                 : Natural
jpeg saturation                 : 4
jpeg contrast                   : 5
jpeg sharpness                  : 5
jpeg hue                        : 4
zoom                            : 35.00 mm
focus                           : 0
color space                     : sRGB
image format                    : JPEG
raw format                      : PEF
light meter flags               : 0
ec                              : 0.00
custom ev steps                 : 1/3
custom sensitivity steps        : 0
exposure mode                   : 0 (NONE)
user mode flag                  : 0
ae metering mode                : Multi
af mode                         : AF.A
af point select                 : SelfTimer-12
selected af point               : 16384
focused af point                : 0
drive mode                      : Single
auto bracket mode               : off
auto bracket picture count      : 0
auto bracket ev                 : 0.30
shake reduction                 : off
white balance mode              : Auto
white balance adjust            : 0
flash mode                      : Auto
flash exposure compensation     : 0.00
manual mode ev                  : 0.00
lens                            : smc PENTAX-DA 18-55mm F3.5-5.6 AL
battery                         : 5.92V 8.01V 0.00V 0.00V

The GUI does not crash (immediately) anymore. If I press "Green Button" is hangs. I can access status, focus and take picture. But it looks like pictures are not saved. At least I cannot find them.

jmozmoz avatar Dec 14 '16 20:12 jmozmoz

Most of the fields look good. "af point select" is invalid, I'll fix it, because it may cause problems. Battery fields also look strange but those fields are not too important.

Green button: It is best to test the command line version first. Try to take a picture with and without --green option.

GUI save: The GUI does not save the image if you take a picture (it saves only in the camera buffer). You can save it using the save as button. Or alternatively you can turn on auto save and add specify the prefix of the filename.

asalamon74 avatar Dec 15 '16 10:12 asalamon74

The second version you send me seems to include some regression: With the first version I could take pictures and transfer them to the computer. With the second version, the (command line) program hangs and only a picture file with size 0 is created. I have attached two log files, _v1 was created using the first version you linked in your comment on 2016-12-13, _v2 used the second version of 2016-12-14.

manual_mod_v1.txt

manual_mod_v2.txt

jmozmoz avatar Dec 20 '16 20:12 jmozmoz

So I traced down my problem (without really knowing what I am doing): The check at https://github.com/asalamon74/pktriggercord/blob/0c3d8e20a70ee645b6e2744d3afd568674050bfc/pslr.c#L909 for bufmask results in a return from the function. The likely reason is, that the bufmask value is read from the wrong address within the status buffer (set at https://github.com/asalamon74/pktriggercord/blob/9e0be49212738029a9212da043e98354c0a3b430/pslr_model.c#L607).

If I understand the code correctly, the status buffer should contain a 1 at the correct address. By setting the bufmask address to 0x0C, it seems to work (because the value at that address is equal to 1). Is this just a coincidence? Actually, what is the meaning of the buffer mask?

jmozmoz avatar Dec 23 '16 01:12 jmozmoz

There is a buffer in the camera for the images. It can store several images but no more than 16. bufmask is a 16-bit word. Each bit shows if the camera buffer is occupied/empty at that index.

Invalid bufmask reading may cause the strange regression. My first version ignored the bufmask , the second tried to read it.

Test it using bracketing. If you take 3 images using bracketing the camera stores the 3 images in the camera buffer and the program only downloads (and deletes) the images at the end. If it works than your patch is great. Send me a pull request after that. (If you don't want to do that just copy the info here, and I'll patch it).

asalamon74 avatar Dec 23 '16 07:12 asalamon74

Ok, what if found out is: There seems to be only one buffer in the camera. If I select bracketing and take 3 or 5 pictures, I am able to store the last picture as raw file (if I selected JPEG as standard format). The other 2 (or 4) pictures seem not available.

I tried different setups and downloaded the hex-status, and nearly all the time the buffer address 0x0c contains 0x01. Only in one case, there was 0 stored. Unfortunately, I was not able to reproduce this.

Is there a known way to clear this internal buffer?

It looks like, if I remove the SD card, this buffer address contains zero, after turning on the camera. If I take one picture, it is back to 1. But this also does not work all the time.

So what to do? My suggestion would be to use 0x0c as address for the buffer.

jmozmoz avatar Dec 23 '16 15:12 jmozmoz

Limiting the camera buffer size to 1 is a very strange change. Quite a few functions of the program will work even in this case, but a few advanced things (like bracketing...) will not work.

It also assumes that 0x0c is 0 at the beginning, 1 after taking an image and 0 after deleting the buffer. If 0x0c is always 1 it will not work.

Camera buffers can be deleted by the pslr_delete_buffer function.

asalamon74 avatar Dec 26 '16 16:12 asalamon74

@jmozmoz I attach a new test version which uses your patch. Someone tested the Linux/K-70 and the program deleted the SD-card. This is very strange because the program is not able to save images to the sd-card. Make a backup before testing the K-70 support.

pktriggercord-0.84.03-win.zip

asalamon74 avatar Dec 27 '16 06:12 asalamon74

I saw a somewhat similar problem: At some point, the SD cards seems to be empty (if accessed from within the camera). But if I put it into a computer, the images were still there. I put it back into the camera and again, it looked empty. I turned the camera off and on several times, but it seemed not to help. Finally, I removed the SD card (I think, the camera) was turned off at that moment, and put it back into the camera while the camera was turned on. Then suddenly, the pictures were again accessible from the camera.

So, did the user tried to read the SD card from a computer (directly putting it into a card reader and not via the USB-cable from within the camera)?

jmozmoz avatar Dec 27 '16 23:12 jmozmoz

But I will further investigate the buffer issue...

jmozmoz avatar Dec 27 '16 23:12 jmozmoz

@jmozmoz I've asked the user about it. Waiting for the answer.

I've added --dangerous switch to the program (commited to github). Both the commandline and GUI version. Without this the program will refuse to connect to K-70. pktriggercord-0.84.03-win.zip

asalamon74 avatar Dec 29 '16 09:12 asalamon74

I added a python wrapper to the internal functions of pktriggercord to make it easier to experiment: 18000b340cff663a48b47fd2df237edf6447149d and the corresponding branch. At the moment I just added a small test script, which prints the name of the camera and then exists.

What I have found out about the SD card "erasing": As long as the camera is connected to pktriggercord, it will show an empty SD card in the display (which turns on during this time). This even happens, if you use the command line tool pktriggercord-cli and it stops after detecting, that the camera is a K-70. The display shows that 9999 pictures can be stored on the camera.

Normally, after closing the connection correctly and then disconnect the camera from the computer, the SD card is handled correctly and the pictures can be accessed by the camera.

So what might have caused the problem of the user user and what I have observed was some error of the program (or a break by the user with CTRL+C) which left the camera in an invalid state, because the connection was not closed correctly.

Now that I have the Python wrapper, I will proceed with experiments about the internal buffer.

P.S. I use Python 3.4 (but it looks like it is also working with Python 2.7)

jmozmoz avatar Dec 31 '16 00:12 jmozmoz

Ok, here is what I found: There is an address in the buffer (0xe8) which changes during taking bracketing shots: Before taking pictures, it contains 1, also after the first shot, after the second, it's 2.

If the number of bracketing pictures set in the camera is 3, then after the third shot, it contains 0. Correspondingly, if the number of bracketing pictures is set to 5 in the camera, this counter(?) starts with 1 at the beginning (before the first shot), after the first shot it is still 1, then 2, ..., after the fifth shot, it contains 0.

So this looks like a counter. There are no other changes in the status buffer (ok, sometimes battery values).

I tested this, by adding the following code to pktriggercord-cli after the call to pslr_shutter(camhandle);

		if (1) {
			int bufsize = pslr_get_model_buffer_size( camhandle );
			uint8_t status_buffer[MAX_STATUS_BUF_SIZE];
			pslr_get_status_buffer(camhandle, status_buffer);
			hexdump( status_buffer, bufsize > 0 ? bufsize : MAX_STATUS_BUF_SIZE);
			fflush(stdout);
		}

I also tried to call pslr_get_status(camhandle, &status);. This results in (re)setting the above mentioned counter to 1.

Does this counter also exist for other cameras?

I tried to force to read out the buffers by removing the check for the bufmask. However, this resulted in a crash of the camera software. The only way to get it to work again was remove the battery.

jmozmoz avatar Dec 31 '16 14:12 jmozmoz

One additional question: At the moment, the code contains mixed spaces and tabs. Are there any coding style rules, e.g. only spaces (8 characters indention) or only tabs?

jmozmoz avatar Dec 31 '16 14:12 jmozmoz

@jmozmoz I'll check that counter (using my K-x).

Coding style rules: I prefer spaces (4 character indentations). I should convert all the remaining tabs one day...

asalamon74 avatar Dec 31 '16 17:12 asalamon74

@jmozmoz I've tested bracketing with my K-x, and I've found a similar field. The address of the byte is 0xe7 (so 0xe4 for 32-bit big-endian). It is 0 at the beginning. After the first shot it's 1, after the second it's 2. After the third (=last) it's 0 again. I cannot test the 5-picture mode because my camera does not support it. So it's similar but not exactly the same.

asalamon74 avatar Jan 04 '17 11:01 asalamon74

@jmozmoz I've added a new status field auto_bracket_picture_counter to the program.

asalamon74 avatar Jan 05 '17 06:01 asalamon74

@jmozmoz I've created a new Makefile target (astyle) to format the source code (using astyle) and reformatted the code. So far I mostly modified only whitespaces (like replacing tabs using spaces) later I'll also clean up braces and other parts of the code. Maybe I'll also check the style in travis.

asalamon74 avatar Feb 15 '17 17:02 asalamon74

@jmozmoz Does you bufmask change work correctly? Can you save images?

asalamon74 avatar Feb 24 '17 13:02 asalamon74

@asalamon74 Unfortunately I still did not find the correct address for the bufmask. I can download one picture, or several pictures, but not with bracketing turned on. I have attached a log for the following command:

./pktriggercord-cli -o test0001 -F 3 --file_format=dng -q 4 -t 1/100 -i 100 -m M --dangerous -w --debug >log 2>&1

In the camera bracketing is set to 5 frames from -0.6 to +0.6 EV with step size 0.3 EV. The first frame is downloaded but then the command stalls.

pktriggercord.txt

(so exactly the same command as above is working if bracketing is turned off in the camera).

pktriggercord_without_bracketing.txt

jmozmoz avatar Feb 28 '17 00:02 jmozmoz

I think I tried everything, but I was never able to download more than one picture in bracketing mode. So I guess the handling of buffers changed.

I can take 3 or 5 shots on the camera quite fast before the picture are written to the SD card, so they are somewhere buffered. I also tried to ignore the bufmask before selecting/downloading the pictures but this also does not help.

So I would suggest to say the K70 is supported only in limited fashion without bracketing or continuous shooting.

jmozmoz avatar Mar 01 '17 21:03 jmozmoz

I've started testing the empty SD card (Card is not formatted error message) problem (I have a new K-70 camera):

  • I had no problems using a 32GB FAT32 card. Problems started when I switched to a 64GB exFAT card.

  • When I put the card into my computer it shows that the dirty bit is set. Mounting the card in my computer and correctly unmount it solves the problem, I can put it back into my camera and it works fine again.

  • Even if I don't use pktriggercord but connect the camera and the computer using a USB cable and turn off the camera without correctly unmounting it will give me the exact same error message.

asalamon74 avatar Mar 25 '17 06:03 asalamon74

A small update on the bracketing problem:

If someone wants to take bracketing shots (e.g. 3 pictures) using older Pentax cameras, one has to press the shutter button multiple times. pktriggercord-cli was designed to support this mode.

Newer Pentax cameras has a so called 'one push bracketing mode' when one has to press a single button and the camera takes all the pictures at once.

I've found a way to read this field for K-70, so now pktriggercord-cli knows when to send multiple and when to send single buttonpress commands.

Unfortunately I can still only access the first buffer image, so it's not a big help.

asalamon74 avatar Jun 10 '17 09:06 asalamon74

I've found a solution for the bulb problem, I'm able to take bulb pictures using K-70. Hopefully the solution will work for the other cameras as well, but it needs camera-specific data. The bulb_modern branch contains the solution. I'll merge it into master when I eliminate the hardwired K-70 code.

asalamon74 avatar Jun 17 '17 07:06 asalamon74

I have removed the --dangerous hack, it is no longer needed if you want to connect to K-70. If you don't turn off the camera without proper unmount it will work correctly. Even if the camera shows that the card is empty, connecting to the PC, correctly unmounting fixes the problem.

asalamon74 avatar Jun 24 '17 07:06 asalamon74

I've merged bulb_modern branch into master

asalamon74 avatar Jun 25 '17 09:06 asalamon74

Just following up on this (very exciting to discover this project), with the K-70 what is currently not supported? By the way, I noticed there is no mention of the K-70 in the documentation, would support a pull request but not sure what the status of it actually is.

legel avatar Jan 16 '18 22:01 legel