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 1 Meizu DFU tool for Linux 3 2 4 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 5 6 6 Notes: 7 7 1. SST39VF800.dfu is taken from the official dfu tool provided by Meizu. 8 8 2. updateNAND_BE_070831.dfu is taken from the unofficial dfu tool for M6 SL. 9 9 3. To compile, just run `make'. 10 -
+59 -45
utils/meizu_dfu/meizu_dfu.c
··· 43 43 44 44 void usage() 45 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"); 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 49 exit(1); 50 50 } 51 51 ··· 328 328 memcpy(attr1.suf_sig, "RON", 3); 329 329 attr1.suf_len = 0x10; 330 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; 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; 340 343 341 - init_img(&img1, file1, &attr1); 342 - init_img(&img2, file2, &attr2); 344 + init_img(&img2, file2, &attr2); 345 + } 343 346 344 347 device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M3_M6); 345 348 // usb_mimic_windows(); ··· 347 350 get_cpu(device); 348 351 send_file(device, &img1); 349 352 350 - printf("Wait a sec (literally)..."); 351 - sleep(1); 352 - printf(" OK\n"); 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 + } 353 363 354 - clear_status(device); 355 - get_cpu(device); 356 - send_file(device, &img2); 357 - dfu_detach(device); 358 364 usb_dev_close(device); 359 365 } 360 366 ··· 374 380 memcpy(attr1.suf_sig, "UFD", 3); 375 381 attr1.suf_len = 0x10; 376 382 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; 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; 386 395 387 - init_img(&img1, file1, &attr1); 388 - init_img(&img2, file2, &attr2); 396 + init_img(&img2, file2, &attr2); 397 + } 389 398 390 399 device = usb_dev_open(USB_VID_SAMSUNG, USB_PID_M6SL); 391 400 get_cpu(device); 392 401 get_cpu(device); 393 402 send_file(device, &img1); 394 403 395 - printf("Wait a sec (literally)..."); 396 - sleep(1); 397 - printf(" OK\n"); 398 - usb_dev_close(device); 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 + } 399 416 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 417 usb_dev_close(device); 406 418 } 407 419 408 420 409 421 int main(int argc, char **argv) 410 422 { 411 - if (argc != 4) 423 + if (argc < 3 || argc > 4) 412 424 usage(); 413 425 414 426 setvbuf(stdout, NULL, _IONBF, 0); 427 + 428 + char *second_file = (argc == 4) ? argv[3] : NULL; 415 429 416 430 if (!strcmp(argv[1], "m3")) 417 - dfu_m3_m6(argv[2], argv[3]); 431 + dfu_m3_m6(argv[2], second_file); 418 432 else if (!strcmp(argv[1], "m6")) 419 - dfu_m3_m6(argv[2], argv[3]); 433 + dfu_m3_m6(argv[2], second_file); 420 434 else if (!strcmp(argv[1], "m6sl")) 421 - dfu_m6sl(argv[2], argv[3]); 435 + dfu_m6sl(argv[2], second_file); 422 436 else 423 437 usage(); 424 438