diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2013-04-28 21:02:22 +0000 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2013-04-28 21:02:22 +0000 |
commit | fb2fbc1e877cd766a8f7f9ae0c08e6f7c841683f (patch) | |
tree | 014ae02d4024d55059bbe9f8c7fbfca78be7fd2f | |
parent | 020ad035ffcd4308647a992e77b128f63056c589 (diff) | |
download | libgphoto2-fb2fbc1e877cd766a8f7f9ae0c08e6f7c841683f.tar.gz |
made SetDeviceProperty work
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@14359 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r-- | camlibs/ptp2/olympus-wrap.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/camlibs/ptp2/olympus-wrap.c b/camlibs/ptp2/olympus-wrap.c index 2f05d16cd..1a001373b 100644 --- a/camlibs/ptp2/olympus-wrap.c +++ b/camlibs/ptp2/olympus-wrap.c @@ -1084,14 +1084,25 @@ encode_command (xmlNodePtr inputnode, PTPContainer *ptp, unsigned char *data, in break; } case 0x1016: { + char buf[20]; + xmlNodePtr pnode; + /* zb <c1016><pD10D><value>000A000D</value></pD10D></c1016> */ /* FIXME: might still be wrong. */ /* We can directly byte encode the data we get from the PTP stack */ + /* ... BUT the byte order is bigendian (printed) vs encoded */ int i; char *x = malloc (len*2+1); - for (i=0;i<len;i++) - sprintf(x+2*i,"%02x",data[i]); - xmlNewChild (cmdnode, NULL, (xmlChar*)"value", (xmlChar*)x); + if (len <= 4) { /* just dump the bytes in big endian byteorder */ + for (i=0;i<len;i++) + sprintf(x+2*i,"%02X",data[len-i-1]); + } else { + for (i=0;i<len;i++) + sprintf(x+2*i,"%02X",data[i]); + } + sprintf(buf,"p%04X", ptp->Param1); + pnode = xmlNewChild (cmdnode, NULL, (xmlChar*)buf, NULL); + xmlNewChild (pnode, NULL, (xmlChar*)"value", (xmlChar*)x); free (x); break; } |