diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2017-05-02 08:14:58 +0200 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2017-05-02 08:14:58 +0200 |
commit | ea5018ec785780a43dd13cb92880112d3e583bda (patch) | |
tree | 041a3a64491a3f3f1d18ffaf7b9a0868822c2935 /camlibs/pentax | |
parent | 6716da110e73dc70e9db565af6fea74d7a3ce107 (diff) | |
download | libgphoto2-ea5018ec785780a43dd13cb92880112d3e583bda.tar.gz |
merge from current pktriggercord git
Diffstat (limited to 'camlibs/pentax')
-rw-r--r-- | camlibs/pentax/pslr.c | 23 | ||||
-rw-r--r-- | camlibs/pentax/pslr.h | 1 |
2 files changed, 23 insertions, 1 deletions
diff --git a/camlibs/pentax/pslr.c b/camlibs/pentax/pslr.c index 8e768bd60..e40f0e017 100644 --- a/camlibs/pentax/pslr.c +++ b/camlibs/pentax/pslr.c @@ -192,7 +192,7 @@ typedef enum { int pslr_get_buffer_status(pslr_handle_t *h, uint32_t *x, uint32_t *y) { ipslr_handle_t *p = (ipslr_handle_t *) h; DPRINT("[C]\t\tipslr_get_buffer_status()\n"); - uint8_t buf[800]; + uint8_t buf[8]; int n; CHECK(command(p->fd, 0x02, 0x00, 0)); @@ -206,6 +206,14 @@ int pslr_get_buffer_status(pslr_handle_t *h, uint32_t *x, uint32_t *y) { for (i=0; i<n; ++i) { DPRINT("[C]\t\tbuf[%d]=%02x\n",i,buf[i]); } + get_uint32_func get_uint32_func_ptr; + if (p->model->is_little_endian) { + get_uint32_func_ptr = get_uint32_le; + } else { + get_uint32_func_ptr = get_uint32_be; + } + *x = (*get_uint32_func_ptr)(buf); + *y = (*get_uint32_func_ptr)(buf+4); return PSLR_OK; } @@ -1019,6 +1027,19 @@ uint32_t pslr_buffer_read(pslr_handle_t h, uint8_t *buf, uint32_t size) { return blksz; } +uint32_t pslr_fullmemory_read(pslr_handle_t h, uint8_t *buf, uint32_t offset, uint32_t size) { + ipslr_handle_t *p = (ipslr_handle_t *) h; + int ret; + + DPRINT("[C]\tpslr_fullmemory_read(%d)\n", size); + + ret = ipslr_download(p, offset, size, buf); + if (ret != PSLR_OK) { + return 0; + } + return size; +} + uint32_t pslr_buffer_get_size(pslr_handle_t h) { ipslr_handle_t *p = (ipslr_handle_t *) h; int i; diff --git a/camlibs/pentax/pslr.h b/camlibs/pentax/pslr.h index 829b7c91c..7a601f359 100644 --- a/camlibs/pentax/pslr.h +++ b/camlibs/pentax/pslr.h @@ -199,6 +199,7 @@ int pslr_bulb(pslr_handle_t h, bool on ); int pslr_buffer_open(pslr_handle_t h, int bufno, pslr_buffer_type type, int resolution); uint32_t pslr_buffer_read(pslr_handle_t h, uint8_t *buf, uint32_t size); +uint32_t pslr_fullmemory_read(pslr_handle_t h, uint8_t *buf, uint32_t offset, uint32_t size); void pslr_buffer_close(pslr_handle_t h); uint32_t pslr_buffer_get_size(pslr_handle_t h); |