{
off_t filesize;
const char *filename;
+ const char *str_data[2] = { NULL, NULL };
+ int scnt;
struct res_pkt resp;
int32_t int_data[2];
off_t trans_unit_size;
int_data[0] = type;
int_data[1] = filesize;
+ if (strlen(filename) <= 32) {
+ /*
+ * THOR protocol only allows file name at most 32 with
+ * [RQT_DL, RQT_DL_FILE_INFO] request in
+ * rqt_pkt.str_data[0].
+ */
+ scnt = 1;
+ str_data[0] = filename;
+ } else {
+ /*
+ * Exceptionally, ARTIK boards require 33 lenght dtb
+ * file name from artik u-boot by misusing wrong lthor
+ * rqt_pkt.str_data usage, so append additional string
+ * to rqt_pkt.str_data[1].
+ */
+ scnt = 2;
+ str_data[0] = filename;
+ str_data[1] = filename + 32;
+ }
+
if (!th)
continue;
ret = t_thor_exec_cmd_full(th, RQT_DL, RQT_DL_FILE_INFO,
int_data, ARRAY_SIZE(int_data),
- (char **)&filename, 1, &resp);
+ (char **)str_data, scnt, &resp);
if (ret < 0)
return ret;
if (sdata) {
for (i = 0; i < scnt; i++)
- strcpy(req.str_data[i],sdata[i]);
+ strncpy(req.str_data[i], sdata[i], 32);
}
ret = t_usb_send(th, (unsigned char *)&req, RQT_PKT_SIZE, DEFAULT_TIMEOUT);