Advertisement
ryzhov_al

[asuswrt] PHY5 is not working after hard reset on RT-N66U

May 4th, 2014
472
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 4.68 KB | None | 0 0
  1. --- asuswrt/release/src/router/rc/sysdeps/init-broadcom.c       2013-08-01 04:56:42.000000000 +0400
  2. +++ asuswrt-merlin/release/src/router/rc/sysdeps/init-broadcom.c        2014-05-01 22:38:17.639101537 +0400
  3. ...
  4. @@ -521,6 +1100,107 @@
  5.                         nvram_set(t->name, t->value);
  6.         }
  7.  }
  8. +#endif
  9. +
  10. +static void
  11. +reset_mssid_hwaddr(int unit)
  12. +{
  13. +       char word[256], *next;
  14. +       char macaddr_str[18], macbuf[13];
  15. +       char *macaddr_strp;
  16. +       unsigned char mac_binary[6];
  17. +       unsigned long long macvalue;
  18. +       unsigned char *macp;
  19. +       int model = get_model();
  20. +       int unit_total = 0, idx, subunit;
  21. +       int max_mssid = num_of_mssid_support(unit);
  22. +       char tmp[100], prefix[]="wlXXXXXXX_";
  23. +
  24. +       foreach(word, nvram_safe_get("wl_ifnames"), next)
  25. +               unit_total++;
  26. +
  27. +       if (unit > (unit_total - 1))
  28. +               return;
  29. +
  30. +       for (idx = 0; idx < unit_total ; idx++) {
  31. +               memset(mac_binary, 0x0, 6);
  32. +               memset(macbuf, 0x0, 13);
  33. +
  34. +               switch(model) {
  35. +                       case MODEL_RTN53:
  36. +                       case MODEL_RTN16:
  37. +                       case MODEL_RTN15U:
  38. +                       case MODEL_RTN12:
  39. +                       case MODEL_RTN12B1:
  40. +                       case MODEL_RTN12C1:
  41. +                       case MODEL_RTN12D1:
  42. +                       case MODEL_RTN12VP:
  43. +                       case MODEL_RTN12HP:
  44. +                       case MODEL_RTN12HP_B1:
  45. +                       case MODEL_APN12HP:
  46. +                       case MODEL_RTN14UHP:
  47. +                       case MODEL_RTN10U:
  48. +                       case MODEL_RTN10P:
  49. +                       case MODEL_RTN10D1:
  50. +                       case MODEL_RTN10PV2:
  51. +                       case MODEL_RTAC53U:
  52. +                               if (unit == 0)  /* 2.4G */
  53. +                                       snprintf(macaddr_str, sizeof(macaddr_str), "sb/1/macaddr");
  54. +                               else            /* 5G */
  55. +                                       snprintf(macaddr_str, sizeof(macaddr_str), "0:macaddr");
  56. +                               break;
  57. +                       case MODEL_RTN66U:
  58. +                       case MODEL_RTAC66U:
  59. +                               snprintf(macaddr_str, sizeof(macaddr_str), "pci/%d/1/macaddr", unit + 1);
  60. +                               break;
  61. +                       case MODEL_RTN18U:
  62. +                       case MODEL_RTAC68U:
  63. +                       case MODEL_RTAC87U:
  64. +                       case MODEL_RTAC56S:
  65. +                       case MODEL_RTAC56U:
  66. +                               snprintf(macaddr_str, sizeof(macaddr_str), "%d:macaddr", unit);
  67. +                               break;
  68. +                       default:
  69. +#ifdef RTCONFIG_BCMARM
  70. +                               snprintf(macaddr_str, sizeof(macaddr_str), "%d:macaddr", unit);
  71. +#else
  72. +                               snprintf(macaddr_str, sizeof(macaddr_str), "pci/%d/1/macaddr", unit + 1);
  73. +#endif
  74. +                               break;
  75. +               }
  76. +
  77. +               macaddr_strp = nvram_get(macaddr_str);
  78. +               if (macaddr_strp)
  79. +               {
  80. +                       if (!mssid_mac_validate(macaddr_strp))
  81. +                               return;
  82. +
  83. +                       if (idx != unit)
  84. +                               continue;
  85. +
  86. +                       ether_atoe(macaddr_strp, mac_binary);
  87. +                       sprintf(macbuf, "%02X%02X%02X%02X%02X%02X",
  88. +                                       mac_binary[0],
  89. +                                       mac_binary[1],
  90. +                                       mac_binary[2],
  91. +                                       mac_binary[3],
  92. +                                       mac_binary[4],
  93. +                                       mac_binary[5]);
  94. +                       macvalue = strtoll(macbuf, (char **) NULL, 16);
  95. +
  96. +                       /* including primary ssid */
  97. +                       for (subunit = 1; subunit < max_mssid + 1 ; subunit++)
  98. +                       {
  99. +                               macvalue++;
  100. +                               macp = (unsigned char*) &macvalue;
  101. +                               memset(macaddr_str, 0, sizeof(macaddr_str));
  102. +                               sprintf(macaddr_str, "%02X:%02X:%02X:%02X:%02X:%02X", *(macp+5), *(macp+4), *(macp+3), *(macp+2), *(macp+1), *(macp+0));
  103. +                               snprintf(prefix, sizeof(prefix), "wl%d.%d_", unit, subunit);
  104. +                               nvram_set(strcat_r(prefix, "hwaddr", tmp), macaddr_str);
  105. +                       }
  106. +               } else return;
  107. +       }
  108. +}
  109.  
  110.  void init_wl(void)
  111.  {
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement