Hi, this patch adds setting the nokia's root device.
Regards Robert
Nur in 0xFFFF-0.1/src: 0xFFFF. Nur in 0xFFFF-0.1/src: dump.o. Nur in 0xFFFF-0.1/src: fiasco.o. Nur in 0xFFFF-0.1/src: flash.o. Nur in 0xFFFF-0.1/src: fpid.o. Nur in 0xFFFF-0.1/src: hash.o. Nur in 0xFFFF-0.1/src: hexdump.o. diff -ru 0xFFFF-0.1-orig/src/main.c 0xFFFF-0.1/src/main.c --- 0xFFFF-0.1-orig/src/main.c 2007-03-31 04:56:01.000000000 +0200 +++ 0xFFFF-0.1/src/main.c 2007-04-20 17:54:24.000000000 +0200 @@ -33,6 +33,7 @@ char *reverseto = NULL; int rdflags = -1; int usb_mode = -1; +int root_device = -1; int verbose = 0; int identify = 0; int reboot = 0; @@ -157,6 +158,7 @@ printf(" -I [piece] identify a firmware piece\n"); printf(" -l list supported usb device ids\n"); printf(" -d [vid:pid] injects a usb device into the supported list\n"); + printf(" -D [0|1|2] sets the root device to flash (0), mmc (1) or usb (2)\n"); printf(" -R reboot the omap board\n"); printf(" -v be verbose and noisy\n"); printf(" -V show 0xFFFF version information\n"); @@ -199,7 +201,7 @@ struct usb_device_descriptor udd; int c; - while((c = getopt(argc, argv, "p:vVhRu:ib:U:r:e:ld:I:")) != -1) { + while((c = getopt(argc, argv, "p:vVhRu:ib:U:r:e:ld:I:D:")) != -1) { switch(c) { case 'd': sscanf(optarg, "%04hx:%04hx", @@ -207,6 +209,9 @@ &supported_devices[SUPPORTED_DEVICES-2].product_id); supported_devices[SUPPORTED_DEVICES-2].name = strdup("user"); break; + case 'D': + root_device = atoi(optarg); + break; case 'e': reverseto = optarg; break; @@ -262,10 +267,12 @@ && (rdflags == -1) && (info == 0) && (reboot == 0) - && (usb_mode == -1)) + && (usb_mode == -1) + && (root_device == -1)) { - printf("Usage: 0xFFFF [-hvVRi] [-e path] [-U 0|1] [-p [piece%]file [-p ...]]\n"); + printf("Usage: 0xFFFF [-hvVRi] [-e path] [-U 0|1] [-p [piece%%]file [-p ...]]\n"); printf(" [-b boot-args] [-I piece [-I ...]] [-u fiasco-image]\n"); + printf(" [-D 0|1|2]\n"); return 1; } @@ -330,6 +337,9 @@ } } + if (root_device != -1) + set_root_device(root_device); + if (usb_mode!=-1) set_usb_host_mode(usb_mode); diff -ru 0xFFFF-0.1-orig/src/main.h 0xFFFF-0.1/src/main.h --- 0xFFFF-0.1-orig/src/main.h 2007-03-30 00:43:43.000000000 +0200 +++ 0xFFFF-0.1/src/main.h 2007-04-20 17:39:14.000000000 +0200 @@ -21,7 +21,10 @@ int set_usb_host_mode(unsigned short mode); int query_hw_revision(); int query_rdmode_device(); + int query_root_device(); +int set_root_device(unsigned short); + int query_nolo_version(); int add_piece(char *piece); Nur in 0xFFFF-0.1/src: main.o. Nur in 0xFFFF-0.1/src: pieces.o. diff -ru 0xFFFF-0.1-orig/src/query.c 0xFFFF-0.1/src/query.c --- 0xFFFF-0.1-orig/src/query.c 2007-03-31 04:54:26.000000000 +0200 +++ 0xFFFF-0.1/src/query.c 2007-04-20 17:59:32.000000000 +0200 @@ -28,7 +28,7 @@ int get_status() { int ret = 0; - if (usb_control_msg(dev, 192, 1, 0, 0, (char *)&ret, 4, 2000) == -1) { + if (usb_control_msg(dev, CMD_QUERY, 1, 0, 0, (char *)&ret, 4, 2000) == -1) { fprintf(stderr, "Cannot get device status.\n"); exit(1); } @@ -157,7 +157,7 @@ { unsigned char opcode; - if (usb_control_msg(dev, 192, 17, 0, 1, (char *)&opcode, 1, 2000) < 0) { + if (usb_control_msg(dev, CMD_QUERY, 17, 0, 1, (char *)&opcode, 1, 2000) < 0) { fprintf(stderr, "Cannot query root device\n"); return -1; } @@ -171,12 +171,35 @@ return 0; } +/** + * request type: CMD_WRITE + * request : 16 + * value : 0|1|2 (=> flash|mmc|usb) + * index : 1 + */ +int set_root_device(unsigned short root_device) +{ + if (root_device>2) { + printf("Invalid root device specified '%d'.\n", root_device); + return -1; + } + + if (usb_control_msg(dev, CMD_WRITE, 16, root_device, 1, 0, 0, 2000) == -1) { + fprintf(stderr, "Cannot set root device\n"); + return -1; + } + + printf("Root device set to: %s\n", root_devices[root_device]); + + return 0; +} + int query_nolo_version() { unsigned int version; // ensure uint is at least 32 bits - //if (usb_control_msg(dev, 192, 3, 0, 1, (char *)&version, 4 , 2000) < 0) { - if (usb_control_msg(dev, 192, 3, 0, 0, (char *)&version, 4 , 2000) < 0) { + //if (usb_control_msg(dev, CMD_QUERY, 3, 0, 1, (char *)&version, 4 , 2000) < 0) { + if (usb_control_msg(dev, CMD_QUERY, 3, 0, 0, (char *)&version, 4 , 2000) < 0) { fprintf(stderr, "Cannot query nolo version. Old bootloader version?\n"); exit(1); } Nur in 0xFFFF-0.1/src: query.o. Nur in 0xFFFF-0.1/src: utils.o.
signature.asc
Description: OpenPGP digital signature
_______________________________________________ 0xffff mailing list 0xffff@lists.nopcode.org https://lists.nopcode.org/mailman/listinfo/0xffff