]> git.sur5r.net Git - u-boot/commitdiff
gadget: f_thor: update to support more than 4GB file as thor 5.0
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Thu, 10 May 2018 01:52:15 +0000 (10:52 +0900)
committerMarek Vasut <marex@denx.de>
Fri, 18 May 2018 11:17:30 +0000 (13:17 +0200)
During file download, it only uses 32bit variable for file size and
it limits maximum file size less than 4GB. Update to support more
than 4GB file with using two 32bit variables for file size as thor
protocol 5.0.

Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/usb/gadget/f_thor.c
drivers/usb/gadget/f_thor.h

index 6d38cb6d498c55e84272d2a6af2e880aa03ed1bd..c8eda058329cec84e4f3cafc040f70de9f1d09b1 100644 (file)
@@ -262,8 +262,10 @@ static long long int process_rqt_download(const struct rqt_box *rqt)
 
        switch (rqt->rqt_data) {
        case RQT_DL_INIT:
-               thor_file_size = rqt->int_data[0];
-               debug("INIT: total %d bytes\n", rqt->int_data[0]);
+               thor_file_size = (unsigned long long int)rqt->int_data[0] +
+                                (((unsigned long long int)rqt->int_data[1])
+                                 << 32);
+               debug("INIT: total %llu bytes\n", thor_file_size);
                break;
        case RQT_DL_FILE_INFO:
                file_type = rqt->int_data[0];
@@ -274,7 +276,9 @@ static long long int process_rqt_download(const struct rqt_box *rqt)
                        break;
                }
 
-               thor_file_size = rqt->int_data[1];
+               thor_file_size = (unsigned long long int)rqt->int_data[1] +
+                                (((unsigned long long int)rqt->int_data[2])
+                                 << 32);
                memcpy(f_name, rqt->str_data[0], F_NAME_BUF_SIZE);
                f_name[F_NAME_BUF_SIZE] = '\0';
 
index 47abc8aebd582c4369ba5f52d1ecfc55faee8750..8ba3fa21b73316edb5e5491d6d87fcdae06ba215 100644 (file)
@@ -34,7 +34,7 @@ struct usb_cdc_attribute_vendor_descriptor {
        __u8 DAUValue;
 } __packed;
 
-#define VER_PROTOCOL_MAJOR     4
+#define VER_PROTOCOL_MAJOR     5
 #define VER_PROTOCOL_MINOR     0
 
 enum rqt {