Hi Ole Kristian,

On Tue, 2022-06-07 at 08:56 +0200, Ole Kristian Lona wrote:
> Hello, Sander!
> 
> I haven't had time to check the rest of the stuff I was working on for Deco 
> M4R v3 and M5, but
> when I see this patch, and think of the work we did in the last round, I 
> can't help thinking maybe
> we should clean up some more around this:
> 
> @@ -3407,6 +3448,7 @@ static void build_image(const char *output,
>             strcasecmp(info->id, "ARCHER-C60-V3") == 0 ||
>             strcasecmp(info->id, "ARCHER-C6U-V1") == 0 ||
>             strcasecmp(info->id, "ARCHER-C6-V3") == 0 ||
> +           strcasecmp(info->id, "MR70X") == 0 ||
>             strcasecmp(info->id, "TLWR1043NV5") == 0) {
>                 const uint8_t extra_para[2] = {0x01, 0x00};
>                 parts[5] = make_extra_para(info, extra_para,
> --
> 
> We could add an extra device parameter "needs_extra_para" set to 1 or 0, and 
> check on that instead
> of the device ID in this routine, so that all changes for new devices can be 
> done in only the
> device specific section. 

You are right, this is an eye sore.

Maybe the easiest way would be a new device_info field (untested):

#define EXTRA_PARA_SIZE         2
struct extra_para_info {
        uint8_t len;
        uint8_t data[EXTRA_PARA_SIZE];
};

#define EXTRA_PARA_NONE         {.len = 0}
#define EXTRA_PARA_DATA(bytes)  {.len = EXTRA_PARA_SIZE, .data = (bytes)}

Usage when set:

        .extra_para = EXTRA_PARA_DATA({0x01, 0x00});

When not defined, len will default to 0, disabling the extra_para partition.

make_extra_para() should be modified to check extra_para_info::len, but could 
then be called
unconditionally.


Feel free to write and submit a patch, you may be waiting for some time 
otherwise.

Best,
Sander

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to