diff options
Diffstat (limited to 'drivers/usb/gadget/function/f_mtp.c')
| -rw-r--r-- | drivers/usb/gadget/function/f_mtp.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/usb/gadget/function/f_mtp.c b/drivers/usb/gadget/function/f_mtp.c index 6ee21d039415..999433ae2d72 100644 --- a/drivers/usb/gadget/function/f_mtp.c +++ b/drivers/usb/gadget/function/f_mtp.c @@ -47,6 +47,7 @@ #define MTP_BULK_BUFFER_SIZE 16384 #define INTR_BUFFER_SIZE 28 #define MAX_INST_NAME_LEN 40 +#define MTP_MAX_FILE_SIZE 0xFFFFFFFFL /* String IDs */ #define INTERFACE_STRING_INDEX 0 @@ -868,14 +869,11 @@ static void send_file_work(struct work_struct *data) /* prepend MTP data header */ header = (struct mtp_data_header *)req->buf; /* - * Set length as 0xffffffff, if it is greater than - * 0xffffffff. Otherwise host will throw error, if file - * size greater than 0xffffffff being transferred. - */ - if (count > 0xffffffffLL) - header->length = 0xffffffff; - else - header->length = __cpu_to_le32(count); + * set file size with header according to + * MTP Specification v1.0 + */ + header->length = (count > MTP_MAX_FILE_SIZE) ? + MTP_MAX_FILE_SIZE : __cpu_to_le32(count); header->type = __cpu_to_le16(2); /* data packet */ header->command = __cpu_to_le16(dev->xfer_command); header->transaction_id = |
