A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

meizu_dfu: supports a single argument to run some code from RAM

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26708 a1c6a512-1295-4272-9138-f99709370657

+60 -47
+1 -2
utils/meizu_dfu/README
··· 1 - 2 Meizu DFU tool for Linux 3 4 This tool can restore the firmware on M3, M6 SP, M6 TP and M6 SL. 5 6 Notes: 7 1. SST39VF800.dfu is taken from the official dfu tool provided by Meizu. 8 2. updateNAND_BE_070831.dfu is taken from the unofficial dfu tool for M6 SL. 9 3. To compile, just run `make'. 10 -
··· 1 Meizu DFU tool for Linux 2 3 This tool can restore the firmware on M3, M6 SP, M6 TP and M6 SL. 4 + It can also run a single provided file from RAM. 5 6 Notes: 7 1. SST39VF800.dfu is taken from the official dfu tool provided by Meizu. 8 2. updateNAND_BE_070831.dfu is taken from the unofficial dfu tool for M6 SL. 9 3. To compile, just run `make'.
+59 -45
utils/meizu_dfu/meizu_dfu.c
··· 43 44 void usage() 45 { 46 - fprintf(stderr, "usage: meizu_dfu m3 <SST39VF800.dfu> <M3.EBN>\n"); 47 - fprintf(stderr, " meizu_dfu m6 <SST39VF800.dfu> <M6.EBN>\n"); 48 - fprintf(stderr, " meizu_dfu m6sl <updateNAND_BE_070831.dfu> <M6SL.EBN>\n"); 49 exit(1); 50 } 51 ··· 328 memcpy(attr1.suf_sig, "RON", 3); 329 attr1.suf_len = 0x10; 330 331 - attr2.delay = 1000; 332 - attr2.pre_off = 0x20; 333 - attr2.pre_sig = 0x44465543; 334 - attr2.suf_dev = 0x0100; 335 - attr2.suf_prod = 0x0140; 336 - attr2.suf_ven = 0x0419; 337 - attr2.suf_dfu = 0x0100; 338 - memcpy(attr2.suf_sig, "UFD", 3); 339 - attr2.suf_len = 0x10; 340 341 - init_img(&img1, file1, &attr1); 342 - init_img(&img2, file2, &attr2); 343 344 device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M3_M6); 345 // usb_mimic_windows(); ··· 347 get_cpu(device); 348 send_file(device, &img1); 349 350 - printf("Wait a sec (literally)..."); 351 - sleep(1); 352 - printf(" OK\n"); 353 354 - clear_status(device); 355 - get_cpu(device); 356 - send_file(device, &img2); 357 - dfu_detach(device); 358 usb_dev_close(device); 359 } 360 ··· 374 memcpy(attr1.suf_sig, "UFD", 3); 375 attr1.suf_len = 0x10; 376 377 - attr2.delay = 1000; 378 - attr2.pre_off = 0x20; 379 - attr2.pre_sig = 0x44465543; 380 - attr2.suf_dev = 0x0100; 381 - attr2.suf_prod = 0x0140; 382 - attr2.suf_ven = 0x0419; 383 - attr2.suf_dfu = 0x0100; 384 - memcpy(attr2.suf_sig, "UFD", 3); 385 - attr2.suf_len = 0x10; 386 387 - init_img(&img1, file1, &attr1); 388 - init_img(&img2, file2, &attr2); 389 390 device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M6SL); 391 get_cpu(device); 392 get_cpu(device); 393 send_file(device, &img1); 394 395 - printf("Wait a sec (literally)..."); 396 - sleep(1); 397 - printf(" OK\n"); 398 - usb_dev_close(device); 399 400 - device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M6SL); 401 - get_cpu(device); 402 - get_cpu(device); 403 - send_file(device, &img2); 404 - dfu_detach(device); 405 usb_dev_close(device); 406 } 407 408 409 int main(int argc, char **argv) 410 { 411 - if (argc != 4) 412 usage(); 413 414 setvbuf(stdout, NULL, _IONBF, 0); 415 416 if (!strcmp(argv[1], "m3")) 417 - dfu_m3_m6(argv[2], argv[3]); 418 else if (!strcmp(argv[1], "m6")) 419 - dfu_m3_m6(argv[2], argv[3]); 420 else if (!strcmp(argv[1], "m6sl")) 421 - dfu_m6sl(argv[2], argv[3]); 422 else 423 usage(); 424
··· 43 44 void usage() 45 { 46 + fprintf(stderr, "usage: meizu_dfu m3 [SST39VF800.dfu] <M3.EBN>\n"); 47 + fprintf(stderr, " meizu_dfu m6 [SST39VF800.dfu] <M6.EBN>\n"); 48 + fprintf(stderr, " meizu_dfu m6sl [updateNAND_BE_070831.dfu] <M6SL.EBN>\n"); 49 exit(1); 50 } 51 ··· 328 memcpy(attr1.suf_sig, "RON", 3); 329 attr1.suf_len = 0x10; 330 331 + init_img(&img1, file1, &attr1); 332 + 333 + if (file2) { 334 + attr2.delay = 1000; 335 + attr2.pre_off = 0x20; 336 + attr2.pre_sig = 0x44465543; 337 + attr2.suf_dev = 0x0100; 338 + attr2.suf_prod = 0x0140; 339 + attr2.suf_ven = 0x0419; 340 + attr2.suf_dfu = 0x0100; 341 + memcpy(attr2.suf_sig, "UFD", 3); 342 + attr2.suf_len = 0x10; 343 344 + init_img(&img2, file2, &attr2); 345 + } 346 347 device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M3_M6); 348 // usb_mimic_windows(); ··· 350 get_cpu(device); 351 send_file(device, &img1); 352 353 + if (file2) { 354 + printf("Wait a sec (literally)..."); 355 + sleep(1); 356 + printf(" OK\n"); 357 + 358 + clear_status(device); 359 + get_cpu(device); 360 + send_file(device, &img2); 361 + dfu_detach(device); 362 + } 363 364 usb_dev_close(device); 365 } 366 ··· 380 memcpy(attr1.suf_sig, "UFD", 3); 381 attr1.suf_len = 0x10; 382 383 + init_img(&img1, file1, &attr1); 384 + 385 + if (file2) { 386 + attr2.delay = 1000; 387 + attr2.pre_off = 0x20; 388 + attr2.pre_sig = 0x44465543; 389 + attr2.suf_dev = 0x0100; 390 + attr2.suf_prod = 0x0140; 391 + attr2.suf_ven = 0x0419; 392 + attr2.suf_dfu = 0x0100; 393 + memcpy(attr2.suf_sig, "UFD", 3); 394 + attr2.suf_len = 0x10; 395 396 + init_img(&img2, file2, &attr2); 397 + } 398 399 device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M6SL); 400 get_cpu(device); 401 get_cpu(device); 402 send_file(device, &img1); 403 404 + if (file2) { 405 + printf("Wait a sec (literally)..."); 406 + sleep(1); 407 + printf(" OK\n"); 408 + usb_dev_close(device); 409 + 410 + device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M6SL); 411 + get_cpu(device); 412 + get_cpu(device); 413 + send_file(device, &img2); 414 + dfu_detach(device); 415 + } 416 417 usb_dev_close(device); 418 } 419 420 421 int main(int argc, char **argv) 422 { 423 + if (argc < 3 || argc > 4) 424 usage(); 425 426 setvbuf(stdout, NULL, _IONBF, 0); 427 + 428 + char *second_file = (argc == 4) ? argv[3] : NULL; 429 430 if (!strcmp(argv[1], "m3")) 431 + dfu_m3_m6(argv[2], second_file); 432 else if (!strcmp(argv[1], "m6")) 433 + dfu_m3_m6(argv[2], second_file); 434 else if (!strcmp(argv[1], "m6sl")) 435 + dfu_m6sl(argv[2], second_file); 436 else 437 usage(); 438