Advertisement
rs232

HW matching script

Feb 29th, 2024 (edited)
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 8.04 KB | None | 0 0
  1. #!/bin/sh
  2. # FreshTomato - HW matching script v0.8
  3. export PATH=/bin:/usr/bin:/sbin:/usr/sbin:/home/root:
  4. . nvram_ops
  5. id=$(NG odmpid)
  6. bid=$(NG board_id)
  7. pid=$(NG product_id)
  8. rev=$(NG boardrev)
  9. typ=$(NG boardtype)
  10. num=$(NG boardnum)
  11. nnum=$(NG 1:boardnum)
  12. fix=$(NG t_fix1)
  13. pa=$(NG PA)
  14. mod=$(NG model)
  15.  
  16. identify_arm() {
  17. if [ "$rev" == "0x1500" ] && [ "$oid" == "RT-AC68U" -o "$id" == "RT-AC68U" -o "$id" == "RT-AC1900P" ]; then res=RT-AC1900P
  18. elif [ "$rev" == "0x1100" -o "$rev" == "0x1103" ] && [ "$mod" == "RT-AC68U" ]; then res=RT-AC68U
  19. elif [ "$rev" == "0x1103" -a "$mod" == "RT-AC68U" ] && [ "$oid" == "RT-N66U_C1" -o "$id" == "RT-N66U_C1" -o "$oid" == "RT-AC1750_B1" -o "$id" == "RT-AC1750_B1" -o "$oid" == "RT-AC66U_B1" -o "$id" == "RT-AC66U_B1" ]; then res=RT-AC66U_B1
  20. elif [ "$rev" == "0x1103" -a "$mod" == "RT-AC68U" ] && [ "$oid" == "RT-AC1900U" -o "$oid" == "RT-AC67U" -o "$id" == "RT-AC1900U" -o "$id" == "RT-AC67U" ]; then res=RT-AC67U
  21. elif [ "$mod" == "RT-AC88U" -o "$pid" == "RT-AC88U" -o "$id" == "RT-AC88U" ]; then res=RT-AC88U
  22. elif [ "$mod" == "RT-AC3100" -o "$pid" == "RT-AC3100" -o "$id" == "RT-AC3100" ]; then res=RT-AC3100
  23. elif [ "$mod" == "RT-AC5300" -o "$pid" == "RT-AC5300" -o "$pid" == "RT-AC5300R" ]; then res=RT-AC5300
  24. elif [ "$rev" == "0x1101" -a "$num" == "32" ]; then res=R8000
  25. elif [ "$rev" == "0x1101" -a "$mod" == "RT-AC3200" ]; then res=RT-AC3200
  26. elif [ "$rev" == "0x1301" -a "$mod" == "R1D" ]; then res=R1D
  27. elif [ "$rev" == "0x1100" -a "$mod" == "RT-N18U" ]; then res=RT-N18U
  28. elif [ "$rev" == "0x1100" -a "$mod" == "RT-AC56U" ]; then res=RT-AC56U
  29. elif [ "$mod" == "DSL-AC68U" ]; then res=DSL-AC68U
  30. elif [ "$rev" == "0x1103" -a "$pa" == "8527" ]; then res=RT-AC68UV3
  31. elif [ "$rev" == "0x1110" -a "$num" == "679" -a "$bid" == "U12H240T99_NETGEAR" ]; then res=AC1450
  32. elif [ "$rev" == "0x1110" -a "$num" == "679" -a "$bid" == "U12H264T00_NETGEAR" ]; then res=R6200v2
  33. elif [ "$rev" == "0x1110" -a "$num" == "679" -a "$bid" == "U12H245T00_NETGEAR" ]; then res=R6250
  34. elif [ "$rev" == "0x1110" -a "$num" == "679" ] && [ "$bid" == "U12H240T00_NETGEAR" -o "$bid" == "U12H240T70_NETGEAR" ]; then res=R6300v2
  35. elif [ "$rev" == "0x1601" -a "$num" == "32" -a "$bid" == "U12H332T00_NETGEAR" ]; then res=R6400
  36. elif [ "$rev" == "0x1601" -a "$num" == "32" ] && [ "$bid" == "U12H332T20_NETGEAR" -o "$bid" == "U12H332T30_NETGEAR" ]; then res=R6400v2
  37. elif [ "$rev" == "0x1301" -a "$num" == "32" -a "$bid" == "U12H270T10_NETGEAR" ]; then res=R6700v1
  38. elif [ "$rev" == "0x1601" -a "$num" == "32" -a "$bid" == "U12H332T77_NETGEAR" ]; then res=R6700v3
  39. elif [ "$rev" == "0x1601" -a "$num" == "32" -a "$bid" == "U12H332T78_NETGEAR" ]; then res=XR300
  40. elif [ "$rev" == "0x1301" -a "$num" == "32" -a "$bid" == "U12H270T11_NETGEAR" ]; then res=R6900
  41. elif [ "$rev" == "0x1301" -a "$num" == "32" -a "$bid" == "U12H270T00_NETGEAR" ]; then res=R7000
  42. elif [ "$rev" == "0x1110" -o "$rev" == "0x1101" ] && [ "$num" == "24" ]; then res=DIR868L
  43. elif [ "$rev" == "0x1101" -a "$num" == "1234" ]; then res=WS880
  44. elif [ "$typ" == "0xE646" ] && [ "$num" == "20140309" -a "$num" == "20130125" ]; then res=EA6350v1
  45. elif [ "$fix" == "EA6350v2" ] && [ "$typ" == "0xE646" -a "$num" == "20150309" ]; then res=EA6350v2
  46. elif [ "$typ" == "0x0646" -a "$num" == "01" ]; then res=EA6400
  47. elif [ "$typ" == "0xF646" -a "$num" == "01" ]; then res=EA6700
  48. elif [ "$typ" == "0xF646" -a "$num" == "00" ]; then res=WZR1750
  49. elif [ "$typ" == "0xD646" -a "$rev" == "0x1100" ]; then res=EA6900
  50. elif [ "$rev" == "0x1100" -a "$nnum" == "AC155g" ]; then res=AC15
  51. elif [ "$rev" == "0x1100" -a "$nnum" == "AC18_5G" ]; then res=AC18
  52. elif [ "$typ" == "0x0646" -a "$rev" == "0x1100" -a "$num" == "AC1200v2" ]; then res=F9K1113v2_20X0
  53. elif [ "$typ" == "0x0646" -a "$rev" == "0x1100" -a "$num" == "02" ]; then res=F9K1113v2
  54. else
  55.  res=ARM-UNKNOWN
  56. fi
  57. echo "$res"
  58. }
  59.  
  60. identify_mips() {
  61. if [ "$typ" == "BCM4704_BCM5325F" -a "$typ" == "0x042f" -a "$num" == "44" -a "$rev" == "0x10" ]; then res="WL-700gE"
  62. elif [ "$typ" == "0x048E" -a "$rev" == "0x10" ]; then res="WRH-54G"
  63. elif [ "$typ" == "0xf52c" -a "$num" == "42" -a "$rev" == "0x1101" ]; then res="E4200"
  64. elif [ "$typ" == "0xa4cf" -a "$num" == "12345" -a "$rev" == "0x1100" ]; then res="F5D8235-4_v3"
  65. elif [ "$typ" == "0xa4cf" -a "$num" == "12345" -a "$rev" == "0x1102" ]; then res="F7D3301/F7D3302/F7D4302_v1"
  66. elif [ "$typ" == "0xa4cf" -a "$num" == "12345" -a "$rev" == "0x1104" ]; then res="F7D4301 v1"
  67. elif [ "$typ" == "bcm94710ap" -a "$num" == "mn700" ]; then res="MN-700"
  68. elif [ "$typ" == "0x048E" -a "$num" == "8" -a "$rev" == "0x11" ]; then res="Ovislink WL1600GL"
  69. elif [ "$typ" == "0x04ec" -a "$num" == "45" -a "$rev" == "0x1402" ]; then res="RT-N10"
  70. elif [ "$typ" == "0x04cd" -a "$num" == "45" -a "$rev" == "0x1201" ]; then res="RT-N12"
  71. elif [ "$typ" == "0x04cf" -a "$num" == "45" -a "$rev" == "0x1218" ]; then res="RT-N16"
  72. elif [ "$typ" == "0x0101" -a "$rev" == "0x10" ]; then res="RT-SE505"
  73. elif [ "$typ" == "bcm94710ap" -a "$num" == "44" ]; then res="TrueMobile 2300"
  74. elif [ "$typ" == "0x0101" -a "$num" == "44" -a "$rev" == "0x10" ]; then res="Viewsonic WR100 + WR850G ? + WX-6615GT"
  75. elif [ "$typ" == "0x0101" -a "$num" == "40" -a "$rev" == "0x10" ]; then res="WBR2-G54"
  76. elif [ "$typ" == "bcm94710ap" -a "$num" == "42" ]; then res="WBR-G54"
  77. elif [ "$typ" == "0x048E" -a "$num" == "0" -a "$rev" == "0x11" ]; then res="WHR-G125"
  78. elif [ "$typ" == "0x467" -a "$num" == "0" -a "$rev" == "0x13" ]; then res="WHR-G54S + WHR-HP-G54S"
  79. elif [ "$typ" == "0x048e" -a "$num" == "45" -a "$rev" == "0x10" ]; then res="WL-330GE"
  80. elif [ "$typ" == "bcm95365r" -a "$num" == "45" -a "$rev" == "0x10" ]; then res="WL-500G Deluxe"
  81. elif [ "$typ" == "0x042f" -a "$num" == "45" -a "$rev" == "0x10" ]; then res="WL-500G Premium"
  82. elif [ "$typ" == "0x48E" -a "$num" == "45" -a "$rev" == "0x10" ]; then res="WL-500G Premium v2"
  83. elif [ "$typ" == "0x0472" -a "$num" == "45" -a "$rev" == "0x23" ]; then res="WL-500G"
  84. elif [ "$typ" == "0x48E" -a "$num" == "45" -a "$rev" == "0x10" ]; then res="WL-520GU"
  85. elif [ "$typ" == "0x0467" -a "$num" == "45" -a "$rev" == "0x10" ]; then res="WL-550gE"
  86. elif [ "$typ" == "0x0101" -a "$num" == "0" -a "$rev" == "0x10" ]; then res="WLA2-G54L"
  87. elif [ "$typ" == "0xe4cd" -a "$num" == "1" -a "$rev" == "0x1700" ]; then res="WNR2000v2"
  88. elif [ "$typ" == "0x04cf" -a "$num" == "3500" ]; then res="WNR3500L"
  89. elif [ "$typ" == "bcm94710dev" -a "$num" == "2" ]; then res="WR850G v1"
  90. elif [ "$typ" == "bcm94710r4" -a "$num" == "100" ]; then res="WR850G v1 + RT390W"
  91. elif [ "$typ" == "0x0101" -a "$num" == "44" -a "$rev" == "0x1700" ]; then res="WR850G v2 (& v3?)" #2 models in one
  92. elif [ "$typ" == "0x0472" -a "$num" == "42" -a "$rev" == "0x11" ]; then res="WRT160Nv1"
  93. elif [ "$typ" == "0x04cd" -a "$num" == "42" -a "$rev" == "0x1700" ]; then res="WRT160Nv3, M10"
  94. elif [ "$typ" == "0x0472" -a "$num" == "42" -a "$rev" == "0x10" ]; then res="WRT300N 1.0 + WZR-G300N"
  95. elif [ "$typ" == "0x04ef" ]; then res="WRT320N/E2000"
  96. elif [ "$typ" == "bcm94710dev" -a "$num" == "42" ]; then res="WRT54G 1.x"
  97. elif [ "$typ" == "0x0101" -a "$num" == "42" -a "$rev" == "0x10" ]; then res="WRT54GS 1.0 + WRT54G 2.0"
  98. elif [ "$typ" == "0x0467" -a "$num" == "42" -a "$rev" == "0x10" ]; then res="WRT54G 4.0 + WRT54GL 1.0, 1.1 + WRT54GS 3.0, 4.0"
  99. elif [ "$typ" == "0x0708" -a "$num" == "42" -a "$rev" == "0x10" ]; then res="WRT54GS 1.1, 2.x + WRT54G 2.2, 3.x"
  100. elif [ "$typ" == "0x04cf" -a "$num" == "42" ]; then res="WRT610Nv2/E3000"
  101. elif [ "$typ" == "0x042f" -a "$num" == "42" -a "$rev" == "0x10" ]; then res="WRTSL54GS + WVR-G54-NF + WZR SERIES + WZR-G108 + WZR-G54 + WZR-HP-G54 + WZR-RS-G54 + WZR-RS-G54HP + WHR2-A54G54 + WHR2-A54-G54 + WHR3-AG54"
  102. elif [ "$typ" == "0x456" -a "$num" == "56" -a "$rev" == "0x10" ]; then res="WTR54GS v1, v2"
  103. elif [ "$typ" == "0x048e" -a "$num" == "1105" -a "$rev" == "0x35" ]; then res="ZTE H618B"
  104. else
  105.  res=MIPS-UNKNOWN
  106. fi
  107. echo "$res";
  108. }
  109.  
  110. identify_arm_ng() {
  111. echo "$res"
  112. }
  113.  
  114. identify_arm_ax() {
  115. echo "$res"
  116. }
  117.  
  118. os=$(NG os_version)
  119. echo $os | grep -qi mips && identify_mips
  120. echo $os | grep -qi arm7 && identify_arm_ng
  121. echo $os | grep -qi arm7 && identify_arm_ax
  122. echo $os | grep -qi arm && identify_arm
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement