summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2020-12-19 11:04:48 +0100
committerGitHub <noreply@github.com>2020-12-19 11:04:48 +0100
commit93c8c4106fefdd1ed8f9f10f1014f8c445a720dc (patch)
tree7a23640f62c63baf1729c34d311085eaaac05d8b
parentb2e144519353602742585492aff84ea9562ae5a6 (diff)
parentfaaa32999d56fd8253453d7e307cb6932b00145a (diff)
downloadlibmtp-93c8c4106fefdd1ed8f9f10f1014f8c445a720dc.tar.gz
Merge pull request #69 from arturmadrzak/bugfix/single-frame-message
Fix data read for single usb packet
-rw-r--r--src/libopenusb1-glue.c4
-rw-r--r--src/libusb-glue.c4
-rw-r--r--src/libusb1-glue.c4
3 files changed, 12 insertions, 0 deletions
diff --git a/src/libopenusb1-glue.c b/src/libopenusb1-glue.c
index 294c427..8dd9e06 100644
--- a/src/libopenusb1-glue.c
+++ b/src/libopenusb1-glue.c
@@ -1361,6 +1361,10 @@ ptp_usb_getdata(PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler) {
if (putfunc_ret != PTP_RC_OK)
return putfunc_ret;
+ /* Nothing more left to read*/
+ if (rlen == usbdata.length)
+ return PTP_RC_OK;
+
/* stuff data directly to passed data handler */
while (1) {
unsigned long readdata;
diff --git a/src/libusb-glue.c b/src/libusb-glue.c
index 3c1b023..b770163 100644
--- a/src/libusb-glue.c
+++ b/src/libusb-glue.c
@@ -1349,6 +1349,10 @@ ptp_usb_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler)
if (putfunc_ret != PTP_RC_OK)
return putfunc_ret;
+ /* Nothing more left to read*/
+ if (rlen == usbdata.length)
+ return PTP_RC_OK;
+
/* stuff data directly to passed data handler */
while (1) {
unsigned long readdata;
diff --git a/src/libusb1-glue.c b/src/libusb1-glue.c
index ffffa01..0992b2a 100644
--- a/src/libusb1-glue.c
+++ b/src/libusb1-glue.c
@@ -1453,6 +1453,10 @@ ptp_usb_getdata (PTPParams* params, PTPContainer* ptp, PTPDataHandler *handler)
if (putfunc_ret != PTP_RC_OK)
return ptp_read_cancel_func(params, ptp->Transaction_ID);
+ /* Nothing more left to read*/
+ if (rlen == usbdata.length)
+ return PTP_RC_OK;
+
/* stuff data directly to passed data handler */
while (1) {
unsigned long readdata;