summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/examples.h20
-rw-r--r--doc/mainpage.h20
-rwxr-xr-xexamples/evolution-sync.sh17
-rw-r--r--src/libopenusb1-glue.c10
-rw-r--r--src/libusb-glue.c10
-rw-r--r--src/libusb1-glue.c10
-rw-r--r--src/music-players.h3
-rw-r--r--src/ptp-pack.c4
8 files changed, 87 insertions, 7 deletions
diff --git a/doc/examples.h b/doc/examples.h
index 3e88ca4..d6dbbcd 100644
--- a/doc/examples.h
+++ b/doc/examples.h
@@ -1,3 +1,23 @@
+/**
+ *
+ * Copyright (C) 2006 Linus Walleij <triad@df.lth.se>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
/*
* List examples here...
*/
diff --git a/doc/mainpage.h b/doc/mainpage.h
index 19ef339..5e83263 100644
--- a/doc/mainpage.h
+++ b/doc/mainpage.h
@@ -1,4 +1,24 @@
/**
+ *
+ * Copyright (C) 2006 Linus Walleij <triad@df.lth.se>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/**
* \mainpage The official libmtp documentation
*
* \section Introduction
diff --git a/examples/evolution-sync.sh b/examples/evolution-sync.sh
index 53ca0b9..0c54a32 100755
--- a/examples/evolution-sync.sh
+++ b/examples/evolution-sync.sh
@@ -1,4 +1,21 @@
#!/bin/bash
+#
+# Copyright (C) 2006 Linus Walleij <triad@df.lth.se>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the
+# Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
# Example evolution synchronization script by Nicolas Tetreault,
# modified by Linus Walleij.
diff --git a/src/libopenusb1-glue.c b/src/libopenusb1-glue.c
index 8dd9e06..c93750d 100644
--- a/src/libopenusb1-glue.c
+++ b/src/libopenusb1-glue.c
@@ -1179,7 +1179,10 @@ ptp_usb_sendreq(PTPParams* params, PTPContainer* req, int dataphase) {
usbreq.payload.params.param5 = htod32(req->Param5);
/* send it to responder */
towrite = PTP_USB_BULK_REQ_LEN - (sizeof (uint32_t)*(5 - req->Nparam));
- ptp_init_send_memory_handler(&memhandler, (unsigned char*) &usbreq, towrite);
+ ret = ptp_init_send_memory_handler(&memhandler, (unsigned char*) &usbreq, towrite);
+ if (ret != PTP_RC_OK) {
+ return ret;
+ }
ret = ptp_write_func(
towrite,
&memhandler,
@@ -1244,7 +1247,10 @@ ptp_usb_senddata(PTPParams* params, PTPContainer* ptp,
return PTP_RC_GeneralError;
}
}
- ptp_init_send_memory_handler(&memhandler, (unsigned char *) &usbdata, wlen);
+ ret = ptp_init_send_memory_handler(&memhandler, (unsigned char *) &usbdata, wlen);
+ if (ret != PTP_RC_OK) {
+ return ret;
+ }
/* send first part of data */
ret = ptp_write_func(wlen, &memhandler, params->data, &written);
ptp_exit_send_memory_handler(&memhandler);
diff --git a/src/libusb-glue.c b/src/libusb-glue.c
index b770163..1ed57c6 100644
--- a/src/libusb-glue.c
+++ b/src/libusb-glue.c
@@ -1171,7 +1171,10 @@ ptp_usb_sendreq (PTPParams* params, PTPContainer* req, int dataphase)
usbreq.payload.params.param5=htod32(req->Param5);
/* send it to responder */
towrite = PTP_USB_BULK_REQ_LEN-(sizeof(uint32_t)*(5-req->Nparam));
- ptp_init_send_memory_handler (&memhandler, (unsigned char*)&usbreq, towrite);
+ ret = ptp_init_send_memory_handler (&memhandler, (unsigned char*)&usbreq, towrite);
+ if (ret != PTP_RC_OK) {
+ return ret;
+ }
ret=ptp_write_func(
towrite,
&memhandler,
@@ -1234,7 +1237,10 @@ ptp_usb_senddata (PTPParams* params, PTPContainer* ptp,
if (gotlen != datawlen)
return PTP_RC_GeneralError;
}
- ptp_init_send_memory_handler (&memhandler, (unsigned char *)&usbdata, wlen);
+ ret = ptp_init_send_memory_handler (&memhandler, (unsigned char *)&usbdata, wlen);
+ if (ret != PTP_RC_OK) {
+ return ret;
+ }
/* send first part of data */
ret = ptp_write_func(wlen, &memhandler, params->data, &written);
ptp_exit_send_memory_handler (&memhandler);
diff --git a/src/libusb1-glue.c b/src/libusb1-glue.c
index a624159..1323545 100644
--- a/src/libusb1-glue.c
+++ b/src/libusb1-glue.c
@@ -1278,7 +1278,10 @@ ptp_usb_sendreq (PTPParams* params, PTPContainer* req, int dataphase)
usbreq.payload.params.param5=htod32(req->Param5);
/* send it to responder */
towrite = PTP_USB_BULK_REQ_LEN-(sizeof(uint32_t)*(5-req->Nparam));
- ptp_init_send_memory_handler (&memhandler, (unsigned char*)&usbreq, towrite);
+ ret = ptp_init_send_memory_handler (&memhandler, (unsigned char*)&usbreq, towrite);
+ if (ret != PTP_RC_OK) {
+ return ret;
+ }
ret=ptp_write_func(
towrite,
&memhandler,
@@ -1341,7 +1344,10 @@ ptp_usb_senddata (PTPParams* params, PTPContainer* ptp,
if (gotlen != datawlen)
return PTP_RC_GeneralError;
}
- ptp_init_send_memory_handler (&memhandler, (unsigned char *)&usbdata, wlen);
+ ret = ptp_init_send_memory_handler (&memhandler, (unsigned char *)&usbdata, wlen);
+ if (ret != PTP_RC_OK) {
+ return ret;
+ }
/* send first part of data */
ret = ptp_write_func(wlen, &memhandler, params->data, &written);
ptp_exit_send_memory_handler (&memhandler);
diff --git a/src/music-players.h b/src/music-players.h
index 7d04954..6312e60 100644
--- a/src/music-players.h
+++ b/src/music-players.h
@@ -4278,5 +4278,8 @@
/* https://github.com/libmtp/libmtp/issues/122 */
{ "FLIR", 0x09cb, "C5", 0x100b, DEVICE_FLAGS_ANDROID_BUGS },
+ /* https://github.com/libmtp/libmtp/issues/135 */
+ { "Honor", 0x339b, "Any-NX1", 0x107d, DEVICE_FLAGS_ANDROID_BUGS },
+
/* qemu 3.0.0 hw/usb/dev-mtp.c */
{ "QEMU", 0x46f4, "Virtual MTP", 0x0004, DEVICE_FLAG_NONE }
diff --git a/src/ptp-pack.c b/src/ptp-pack.c
index 0616996..381326f 100644
--- a/src/ptp-pack.c
+++ b/src/ptp-pack.c
@@ -229,7 +229,9 @@ ptp_pack_string(PTPParams *params, char *string, unsigned char* data, uint16_t o
#endif
{
unsigned int i;
-
+ if (convlen > PTP_MAXSTRLEN) {
+ convlen = PTP_MAXSTRLEN;
+ }
for (i=0;i<convlen;i++) {
ucs2str[i] = string[i];
}