Add AG241 code pattern (fixes #1089)
authormatteo <matteo@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 11 Mar 2008 00:45:22 +0000 (00:45 +0000)
committermatteo <matteo@3c298f89-4303-0410-b956-a3cf2f4a3e73>
Tue, 11 Mar 2008 00:45:22 +0000 (00:45 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10584 3c298f89-4303-0410-b956-a3cf2f4a3e73

target/linux/ar7/image/Makefile
tools/firmware-utils/src/addpattern.c

index 8952b09..d34547b 100644 (file)
@@ -78,6 +78,8 @@ define Image/Build
        $(call Image/Build/CyberTAN,$(1),WA21,WA21,$(1))
        $(call Image/Build/CyberTAN,$(1),WA22,WA22,$(1))
        $(call Image/Build/CyberTAN,$(1),WAG2,WAG2,$(1))
        $(call Image/Build/CyberTAN,$(1),WA21,WA21,$(1))
        $(call Image/Build/CyberTAN,$(1),WA22,WA22,$(1))
        $(call Image/Build/CyberTAN,$(1),WAG2,WAG2,$(1))
+       $(call Image/Build/CyberTAN,$(1),AG241v2,AG3A -b -r 2.0,$(1))
+       $(call Image/Build/CyberTAN,$(1),AG241v1,AG3A -b,$(1))
        $(call Image/Build/CyberTAN,$(1),WA31,WA31 -b,$(1))
        $(call Image/Build/CyberTAN,$(1),WA32,WA32 -b,$(1))
        $(call Image/Build/CyberTAN,$(1),WA7A,WA7A -b,$(1))
        $(call Image/Build/CyberTAN,$(1),WA31,WA31 -b,$(1))
        $(call Image/Build/CyberTAN,$(1),WA32,WA32 -b,$(1))
        $(call Image/Build/CyberTAN,$(1),WA7A,WA7A -b,$(1))
index 5f49b92..6f2a036 100644 (file)
  *     and adds the new hardware "flags" for the v2.2/v1.1 units
 */
 
  *     and adds the new hardware "flags" for the v2.2/v1.1 units
 */
 
+/* January 1, 2007
+ *
+ * Modified by juan.i.gonzalez at subdown dot net
+ * Support added for the AG241v2  and similar
+ *
+ * Extensions:
+ *  -r #.# adds revision hardware flags. AG241v2 and similar.
+ *
+ * AG241V2 firmware sets the hw_ver to 0x44.
+ *
+ * Example: -r 2.0
+ *
+ * Convert 2.0 to 20 to be an integer, and add 0x30 to skip special ASCII
+ * #define HW_Version ((HW_REV * 10) + 0x30)  -> from cyutils.h
+*/
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -77,7 +93,7 @@ void usage(void) __attribute__ (( __noreturn__ ));
 
 void usage(void)
 {
 
 void usage(void)
 {
-       fprintf(stderr, "Usage: addpattern [-i trxfile] [-o binfile] [-p pattern] [-g] [-b] [-v v#.#.#] [-{0|1|2|4}]\n");
+       fprintf(stderr, "Usage: addpattern [-i trxfile] [-o binfile] [-p pattern] [-g] [-b] [-v v#.#.#] [-r #.#] [-{0|1|2|4}] -h\n");
        exit(EXIT_FAILURE);
 }
 
        exit(EXIT_FAILURE);
 }
 
@@ -105,7 +121,7 @@ int main(int argc, char **argv)
        hdr = (struct code_header *) buf;
        memset(hdr, 0, sizeof(struct code_header));
 
        hdr = (struct code_header *) buf;
        memset(hdr, 0, sizeof(struct code_header));
 
-       while ((c = getopt(argc, argv, "i:o:p:gbv:0124")) != -1) {
+       while ((c = getopt(argc, argv, "i:o:p:gbv:0124hr:")) != -1) {
                switch (c) {
                        case 'i':
                                ifn = optarg;
                switch (c) {
                        case 'i':
                                ifn = optarg;
@@ -142,13 +158,17 @@ int main(int argc, char **argv)
                                hdr->hw_ver = 0;
                                hdr->flags[0] = 0x1f;
                                break;
                                hdr->hw_ver = 0;
                                hdr->flags[0] = 0x1f;
                                break;
+                        case 'r':
+                                hdr->hw_ver = (char)(atof(optarg)*10)+0x30;
+                                break;
 
 
+                        case 'h':
                        default:
                                usage();
                }
        }
 
                        default:
                                usage();
                }
        }
 
-       if (optind != argc) {
+       if (optind != argc || optind == 1) {
                fprintf(stderr, "illegal arg \"%s\"\n", argv[optind]);
                usage();
        }
                fprintf(stderr, "illegal arg \"%s\"\n", argv[optind]);
                usage();
        }
This page took 0.023869 seconds and 4 git commands to generate.