ar71xx.sh 19 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270
  1. #!/bin/sh
  2. #
  3. # Copyright (C) 2009-2011 OpenWrt.org
  4. #
  5. AR71XX_BOARD_NAME=
  6. AR71XX_MODEL=
  7. ar71xx_get_mtd_offset_size_format() {
  8. local mtd="$1"
  9. local offset="$2"
  10. local size="$3"
  11. local format="$4"
  12. local dev
  13. dev=$(find_mtd_part $mtd)
  14. [ -z "$dev" ] && return
  15. dd if=$dev bs=1 skip=$offset count=$size 2>/dev/null | hexdump -v -e "1/1 \"$format\""
  16. }
  17. ar71xx_get_mtd_part_magic() {
  18. local mtd="$1"
  19. ar71xx_get_mtd_offset_size_format "$mtd" 0 4 %02x
  20. }
  21. wndr3700_board_detect() {
  22. local machine="$1"
  23. local magic
  24. local name
  25. name="wndr3700"
  26. magic="$(ar71xx_get_mtd_part_magic firmware)"
  27. case $magic in
  28. "33373030")
  29. machine="NETGEAR WNDR3700"
  30. ;;
  31. "33373031")
  32. model="$(ar71xx_get_mtd_offset_size_format art 41 32 %c)"
  33. # Use awk to remove everything unprintable
  34. model_stripped="$(ar71xx_get_mtd_offset_size_format art 41 32 %c | LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}')"
  35. case $model in
  36. $'\xff'*)
  37. if [ "${model:24:1}" = 'N' ]; then
  38. machine="NETGEAR WNDRMAC"
  39. else
  40. machine="NETGEAR WNDR3700v2"
  41. fi
  42. ;;
  43. '29763654+16+64'*)
  44. machine="NETGEAR ${model_stripped:14}"
  45. ;;
  46. '29763654+16+128'*)
  47. machine="NETGEAR ${model_stripped:15}"
  48. ;;
  49. *)
  50. # Unknown ID
  51. machine="NETGEAR ${model_stripped}"
  52. esac
  53. esac
  54. AR71XX_BOARD_NAME="$name"
  55. AR71XX_MODEL="$machine"
  56. }
  57. ubnt_get_mtd_part_magic() {
  58. ar71xx_get_mtd_offset_size_format EEPROM 4118 2 %02x
  59. }
  60. ubnt_xm_board_detect() {
  61. local model
  62. local magic
  63. magic="$(ubnt_get_mtd_part_magic)"
  64. case ${magic:0:3} in
  65. "e00"|\
  66. "e01"|\
  67. "e80")
  68. model="Ubiquiti NanoStation M"
  69. ;;
  70. "e0a")
  71. model="Ubiquiti NanoStation loco M"
  72. ;;
  73. "e1b"|\
  74. "e1d")
  75. model="Ubiquiti Rocket M"
  76. ;;
  77. "e20"|\
  78. "e2d")
  79. model="Ubiquiti Bullet M"
  80. ;;
  81. "e30")
  82. model="Ubiquiti PicoStation M"
  83. ;;
  84. esac
  85. [ -z "$model" ] || AR71XX_MODEL="${model}${magic:3:1}"
  86. }
  87. cybertan_get_hw_magic() {
  88. local part
  89. part=$(find_mtd_part firmware)
  90. [ -z "$part" ] && return 1
  91. dd bs=8 count=1 skip=0 if=$part 2>/dev/null | hexdump -v -n 8 -e '1/1 "%02x"'
  92. }
  93. dir505_board_detect() {
  94. local dev=$(find_mtd_part 'mac')
  95. [ -z "$dev" ] && return
  96. # The revision is stored at the beginning of the "mac" partition
  97. local rev="$(LC_CTYPE=C awk -v 'FS=[^[:print:]]' '{print $1; exit}' $dev)"
  98. AR71XX_MODEL="D-Link DIR-505 rev. $rev"
  99. }
  100. tplink_get_hwid() {
  101. local part
  102. part=$(find_mtd_part firmware)
  103. [ -z "$part" ] && return 1
  104. dd if=$part bs=4 count=1 skip=16 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
  105. }
  106. tplink_get_mid() {
  107. local part
  108. part=$(find_mtd_part firmware)
  109. [ -z "$part" ] && return 1
  110. dd if=$part bs=4 count=1 skip=17 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"'
  111. }
  112. tplink_board_detect() {
  113. local model="$1"
  114. local hwid
  115. local hwver
  116. hwid=$(tplink_get_hwid)
  117. mid=$(tplink_get_mid)
  118. hwver=${hwid:6:2}
  119. hwver=" v${hwver#0}"
  120. case "$hwid" in
  121. "015000"*)
  122. model="EasyLink EL-M150"
  123. ;;
  124. "015300"*)
  125. model="EasyLink EL-MINI"
  126. ;;
  127. "044401"*)
  128. model="ANTMINER-S1"
  129. ;;
  130. "044403"*)
  131. model="ANTMINER-S3"
  132. ;;
  133. "44440101"*)
  134. model="ANTROUTER-R1"
  135. ;;
  136. "120000"*)
  137. model="MERCURY MAC1200R"
  138. ;;
  139. "007260"*)
  140. model="TellStick ZNet Lite"
  141. ;;
  142. "066601"*)
  143. model="OMYlink OMY-G1"
  144. ;;
  145. "066602"*)
  146. model="OMYlink OMY-X1"
  147. ;;
  148. "3C0001"*)
  149. model="OOLITE"
  150. ;;
  151. "3C0002"*)
  152. model="MINIBOX_V1"
  153. ;;
  154. "070301"*)
  155. model="TP-Link TL-WR703N"
  156. ;;
  157. "071000"*)
  158. model="TP-Link TL-WR710N"
  159. if [ "$hwid" = '07100002' -a "$mid" = '00000002' ]; then
  160. hwver=' v2.1'
  161. fi
  162. ;;
  163. "072001"*)
  164. model="TP-Link TL-WR720N"
  165. ;;
  166. "070100"*)
  167. model="TP-Link TL-WA701N/ND"
  168. ;;
  169. "073000"*)
  170. model="TP-Link TL-WA730RE"
  171. ;;
  172. "074000"*)
  173. model="TP-Link TL-WR740N/ND"
  174. ;;
  175. "074100"*)
  176. model="TP-Link TL-WR741N/ND"
  177. ;;
  178. "074300"*)
  179. model="TP-Link TL-WR743N/ND"
  180. ;;
  181. "075000"*)
  182. model="TP-Link TL-WA750RE"
  183. ;;
  184. "721000"*)
  185. model="TP-Link TL-WA7210N"
  186. ;;
  187. "751000"*)
  188. model="TP-Link TL-WA7510N"
  189. ;;
  190. "080100"*)
  191. model="TP-Link TL-WA801N/ND"
  192. ;;
  193. "080200"*)
  194. model="TP-Link TL-WR802N"
  195. ;;
  196. "083000"*)
  197. model="TP-Link TL-WA830RE"
  198. if [ "$hwver" = ' v10' ]; then
  199. hwver=' v1'
  200. fi
  201. ;;
  202. "084100"*)
  203. model="TP-Link TL-WR841N/ND"
  204. if [ "$hwid" = '08410002' -a "$mid" = '00000002' ]; then
  205. hwver=' v1.5'
  206. fi
  207. ;;
  208. "084200"*)
  209. model="TP-Link TL-WR842N/ND"
  210. ;;
  211. "084300"*)
  212. model="TP-Link TL-WR843N/ND"
  213. ;;
  214. "085000"*)
  215. model="TP-Link TL-WA850RE"
  216. ;;
  217. "086000"*)
  218. model="TP-Link TL-WA860RE"
  219. ;;
  220. "090100"*)
  221. model="TP-Link TL-WA901N/ND"
  222. ;;
  223. "094000"*)
  224. model="TP-Link TL-WR940N"
  225. ;;
  226. "094100"*)
  227. if [ "$hwid" = "09410002" -a "$mid" = "00420001" ]; then
  228. model="Rosewill RNX-N360RT"
  229. hwver=""
  230. else
  231. model="TP-Link TL-WR941N/ND"
  232. fi
  233. ;;
  234. "104100"*)
  235. model="TP-Link TL-WR1041N/ND"
  236. ;;
  237. "104300"*)
  238. model="TP-Link TL-WR1043N/ND"
  239. ;;
  240. "254300"*)
  241. model="TP-Link TL-WR2543N/ND"
  242. ;;
  243. "001001"*)
  244. model="TP-Link TL-MR10U"
  245. ;;
  246. "001101"*)
  247. model="TP-Link TL-MR11U"
  248. ;;
  249. "001201"*)
  250. model="TP-Link TL-MR12U"
  251. ;;
  252. "001301"*)
  253. model="TP-Link TL-MR13U"
  254. ;;
  255. "302000"*)
  256. model="TP-Link TL-MR3020"
  257. ;;
  258. "304000"*)
  259. model="TP-Link TL-MR3040"
  260. ;;
  261. "322000"*)
  262. model="TP-Link TL-MR3220"
  263. ;;
  264. "342000"*)
  265. model="TP-Link TL-MR3420"
  266. ;;
  267. "332000"*)
  268. model="TP-Link TL-WDR3320"
  269. ;;
  270. "350000"*)
  271. model="TP-Link TL-WDR3500"
  272. ;;
  273. "360000"*)
  274. model="TP-Link TL-WDR3600"
  275. ;;
  276. "430000"*)
  277. model="TP-Link TL-WDR4300"
  278. ;;
  279. "430080"*)
  280. iw reg set IL
  281. model="TP-Link TL-WDR4300 (IL)"
  282. ;;
  283. "431000"*)
  284. model="TP-Link TL-WDR4310"
  285. ;;
  286. "49000002")
  287. model="TP-Link TL-WDR4900"
  288. ;;
  289. "65000002")
  290. model="TP-Link TL-WDR6500"
  291. ;;
  292. "453000"*)
  293. model="Mercury MW4530R"
  294. ;;
  295. "934100"*)
  296. model="NC-LINK SMART-300"
  297. ;;
  298. "c50000"*)
  299. model="TP-Link Archer C5"
  300. ;;
  301. "750000"*|\
  302. "c70000"*)
  303. model="TP-Link Archer C7"
  304. ;;
  305. *)
  306. hwver=""
  307. ;;
  308. esac
  309. AR71XX_MODEL="$model$hwver"
  310. }
  311. tplink_pharos_get_model_string() {
  312. local part
  313. part=$(find_mtd_part 'product-info')
  314. [ -z "$part" ] && return 1
  315. # The returned string will end with \r\n, but we don't remove it here
  316. # to simplify matching against it in the sysupgrade image check
  317. dd if=$part bs=1 skip=4360 2>/dev/null | head -n 1
  318. }
  319. tplink_pharos_board_detect() {
  320. local model_string="$(tplink_pharos_get_model_string | tr -d '\r')"
  321. local oIFS="$IFS"; IFS=":"; set -- $model_string; IFS="$oIFS"
  322. local model="${1%%\(*}"
  323. AR71XX_MODEL="TP-Link $model v$2"
  324. }
  325. gl_inet_board_detect() {
  326. local size="$(mtd_get_part_size 'firmware')"
  327. case "$size" in
  328. 8192000)
  329. AR71XX_MODEL='GL-iNet 6408A v1'
  330. ;;
  331. 16580608)
  332. AR71XX_MODEL='GL-iNet 6416A v1'
  333. ;;
  334. esac
  335. }
  336. ar71xx_board_detect() {
  337. local machine
  338. local name
  339. machine=$(awk 'BEGIN{FS="[ \t]+:[ \t]"} /machine/ {print $2}' /proc/cpuinfo)
  340. case "$machine" in
  341. *"Oolite V1.0")
  342. name="oolite"
  343. ;;
  344. *"A40")
  345. name="a40"
  346. ;;
  347. *"A60")
  348. name="a60"
  349. ;;
  350. *"AC1750DB")
  351. name="f9k1115v2"
  352. ;;
  353. *"AirGateway")
  354. name="airgateway"
  355. ;;
  356. *"AirGateway Pro")
  357. name="airgatewaypro"
  358. ;;
  359. *"AirRouter")
  360. name="airrouter"
  361. ;;
  362. *"ALFA Network AP120C")
  363. name="alfa-ap120c"
  364. ;;
  365. *"ALFA Network AP96")
  366. name="alfa-ap96"
  367. ;;
  368. *"ALFA Network N2/N5")
  369. name="alfa-nx"
  370. ;;
  371. *ALL0258N)
  372. name="all0258n"
  373. ;;
  374. *ALL0305)
  375. name="all0305"
  376. ;;
  377. *ALL0315N)
  378. name="all0315n"
  379. ;;
  380. *Antminer-S1)
  381. name="antminer-s1"
  382. ;;
  383. *Antminer-S3)
  384. name="antminer-s3"
  385. ;;
  386. *"Arduino Yun")
  387. name="arduino-yun"
  388. ;;
  389. *"AP121 reference board")
  390. name="ap121"
  391. ;;
  392. *AP121-MINI)
  393. name="ap121-mini"
  394. ;;
  395. *"AP121F")
  396. name="ap121f"
  397. ;;
  398. *"AP132 reference board")
  399. name="ap132"
  400. ;;
  401. *"AP136-010 reference board")
  402. name="ap136-010"
  403. ;;
  404. *"AP136-020 reference board")
  405. name="ap136-020"
  406. ;;
  407. *"AP135-020 reference board")
  408. name="ap135-020"
  409. ;;
  410. *"AP143 reference board")
  411. name="ap143"
  412. ;;
  413. *"AP147-010 reference board")
  414. name="ap147-010"
  415. ;;
  416. *"AP152 reference board")
  417. name="ap152"
  418. ;;
  419. *AP90Q)
  420. name="ap90q"
  421. ;;
  422. *"Archer C5")
  423. name="archer-c5"
  424. ;;
  425. *"Archer C7")
  426. name="archer-c7"
  427. ;;
  428. *"Atheros AP96")
  429. name="ap96"
  430. ;;
  431. *AW-NR580)
  432. name="aw-nr580"
  433. ;;
  434. *BHR-4GRV2)
  435. name="bhr-4grv2"
  436. ;;
  437. *CAP324)
  438. name="cap324"
  439. ;;
  440. *C-55)
  441. name="c-55"
  442. ;;
  443. *C-60)
  444. name="c-60"
  445. ;;
  446. *CAP4200AG)
  447. name="cap4200ag"
  448. ;;
  449. *"CF-E316N v2")
  450. name="cf-e316n-v2"
  451. ;;
  452. *"CF-E320N v2")
  453. name="cf-e320n-v2"
  454. ;;
  455. *"CF-E380AC v1")
  456. name="cf-e380ac-v1"
  457. ;;
  458. *"CF-E380AC v2")
  459. name="cf-e380ac-v2"
  460. ;;
  461. *CF-E520N)
  462. name="cf-e520n"
  463. ;;
  464. *CF-E530N)
  465. name="cf-e530n"
  466. ;;
  467. *"CPE210/220")
  468. name="cpe210"
  469. tplink_pharos_board_detect
  470. ;;
  471. *"CPE510/520")
  472. name="cpe510"
  473. tplink_pharos_board_detect
  474. ;;
  475. *CPE830)
  476. name="cpe830"
  477. ;;
  478. *CPE870)
  479. name="cpe870"
  480. ;;
  481. *WBS210)
  482. name="wbs210"
  483. tplink_pharos_board_detect
  484. ;;
  485. *WBS510)
  486. name="wbs510"
  487. tplink_pharos_board_detect
  488. ;;
  489. *CR3000)
  490. name="cr3000"
  491. ;;
  492. *CR5000)
  493. name="cr5000"
  494. ;;
  495. *"DAP-2695 rev. A1")
  496. name="dap-2695-a1"
  497. ;;
  498. *"DB120 reference board")
  499. name="db120"
  500. ;;
  501. *"DGL-5500 rev. A1")
  502. name="dgl-5500-a1"
  503. ;;
  504. *"DHP-1565 rev. A1")
  505. name="dhp-1565-a1"
  506. ;;
  507. *"DIR-505 rev. A1")
  508. name="dir-505-a1"
  509. dir505_board_detect
  510. ;;
  511. *"DIR-600 rev. A1")
  512. name="dir-600-a1"
  513. ;;
  514. *"DIR-615 rev. E1")
  515. name="dir-615-e1"
  516. ;;
  517. *"DIR-615 rev. E4")
  518. name="dir-615-e4"
  519. ;;
  520. *"DIR-615 rev. I1")
  521. name="dir-615-i1"
  522. ;;
  523. *"DIR-825 rev. B1")
  524. name="dir-825-b1"
  525. ;;
  526. *"DIR-825 rev. C1")
  527. name="dir-825-c1"
  528. ;;
  529. *"DIR-835 rev. A1")
  530. name="dir-835-a1"
  531. ;;
  532. *"DIR-869 rev. A1")
  533. name="dir-869-a1"
  534. ;;
  535. *"dLAN Hotspot")
  536. name="dlan-hotspot"
  537. ;;
  538. *"dLAN pro 500 Wireless+")
  539. name="dlan-pro-500-wp"
  540. ;;
  541. *"dLAN pro 1200+ WiFi ac")
  542. name="dlan-pro-1200-ac"
  543. ;;
  544. *DR344)
  545. name="dr344"
  546. ;;
  547. *DR531)
  548. name="dr531"
  549. ;;
  550. *"Dragino v2")
  551. name="dragino2"
  552. ;;
  553. *"Domino Pi")
  554. name="gl-domino"
  555. ;;
  556. *"DW33D")
  557. name="dw33d"
  558. ;;
  559. *E2100L)
  560. name="e2100l"
  561. ;;
  562. *"EAP120")
  563. name="eap120"
  564. tplink_pharos_board_detect
  565. ;;
  566. *"EAP300 v2")
  567. name="eap300v2"
  568. ;;
  569. *EAP7660D)
  570. name="eap7660d"
  571. ;;
  572. *EL-M150)
  573. name="el-m150"
  574. ;;
  575. *EL-MINI)
  576. name="el-mini"
  577. ;;
  578. *"GL-CONNECT INET v1")
  579. name="gl-inet"
  580. gl_inet_board_detect
  581. ;;
  582. *"GL AR150")
  583. name="gl-ar150"
  584. ;;
  585. *"GL-USB150")
  586. name="gl-usb150"
  587. ;;
  588. *"GL AR300")
  589. name="gl-ar300"
  590. ;;
  591. *"GL-AR300M")
  592. name="gl-ar300m"
  593. ;;
  594. *"GL-MIFI")
  595. name="gl-mifi"
  596. ;;
  597. *"EnGenius EPG5000")
  598. name="epg5000"
  599. ;;
  600. *"EnGenius ESR1750")
  601. name="esr1750"
  602. ;;
  603. *"EnGenius ESR900")
  604. name="esr900"
  605. ;;
  606. *JA76PF)
  607. name="ja76pf"
  608. ;;
  609. *JA76PF2)
  610. name="ja76pf2"
  611. ;;
  612. *"Bullet M")
  613. name="bullet-m"
  614. ubnt_xm_board_detect
  615. ;;
  616. *"Loco M XW")
  617. name="loco-m-xw"
  618. ;;
  619. *"Nanostation M")
  620. name="nanostation-m"
  621. ubnt_xm_board_detect
  622. ;;
  623. *"Nanostation M XW")
  624. name="nanostation-m-xw"
  625. ;;
  626. *JWAP003)
  627. name="jwap003"
  628. ;;
  629. *JWAP230)
  630. name="jwap230"
  631. ;;
  632. *"Hornet-UB")
  633. local size
  634. size=$(awk '/firmware/ { print $2 }' /proc/mtd)
  635. if [ "x$size" = "x00790000" ]; then
  636. name="hornet-ub"
  637. fi
  638. if [ "x$size" = "x00f90000" ]; then
  639. name="hornet-ub-x2"
  640. fi
  641. ;;
  642. *LS-SR71)
  643. name="ls-sr71"
  644. ;;
  645. *"MAC1200R")
  646. name="mc-mac1200r"
  647. ;;
  648. *"MiniBox V1.0")
  649. name="minibox-v1"
  650. ;;
  651. *MR12)
  652. name="mr12"
  653. ;;
  654. *MR16)
  655. name="mr16"
  656. ;;
  657. *MR18)
  658. name="mr18"
  659. ;;
  660. *MR600v2)
  661. name="mr600v2"
  662. ;;
  663. *MR1750)
  664. name="mr1750"
  665. ;;
  666. *MR1750v2)
  667. name="mr1750v2"
  668. ;;
  669. *MR600)
  670. name="mr600"
  671. ;;
  672. *MR900)
  673. name="mr900"
  674. ;;
  675. *MR900v2)
  676. name="mr900v2"
  677. ;;
  678. *"My Net N600")
  679. name="mynet-n600"
  680. ;;
  681. *"My Net N750")
  682. name="mynet-n750"
  683. ;;
  684. *"WD My Net Wi-Fi Range Extender")
  685. name="mynet-rext"
  686. ;;
  687. *MZK-W04NU)
  688. name="mzk-w04nu"
  689. ;;
  690. *MZK-W300NH)
  691. name="mzk-w300nh"
  692. ;;
  693. *"NBG460N/550N/550NH")
  694. name="nbg460n_550n_550nh"
  695. ;;
  696. *"Zyxel NBG6616")
  697. name="nbg6616"
  698. ;;
  699. *"Zyxel NBG6716")
  700. name="nbg6716"
  701. ;;
  702. *OM2P)
  703. name="om2p"
  704. ;;
  705. *OM2Pv2)
  706. name="om2pv2"
  707. ;;
  708. *OM2Pv4)
  709. name="om2pv4"
  710. ;;
  711. *"OM2P HS")
  712. name="om2p-hs"
  713. ;;
  714. *"OM2P HSv2")
  715. name="om2p-hsv2"
  716. ;;
  717. *"OM2P HSv3")
  718. name="om2p-hsv3"
  719. ;;
  720. *"OM2P HSv4")
  721. name="om2p-hsv4"
  722. ;;
  723. *"OM2P LC")
  724. name="om2p-lc"
  725. ;;
  726. *OM5P)
  727. name="om5p"
  728. ;;
  729. *"OM5P AN")
  730. name="om5p-an"
  731. ;;
  732. *"OM5P AC")
  733. name="om5p-ac"
  734. ;;
  735. *"OM5P ACv2")
  736. name="om5p-acv2"
  737. ;;
  738. *"OMY-X1")
  739. name="omy-x1"
  740. ;;
  741. *"OMY-G1")
  742. name="omy-g1"
  743. ;;
  744. *"Onion Omega")
  745. name="onion-omega"
  746. ;;
  747. *PB42)
  748. name="pb42"
  749. ;;
  750. *"PB44 reference board")
  751. name="pb44"
  752. ;;
  753. *"Qihoo 360 C301")
  754. name="qihoo-c301"
  755. ;;
  756. *"RE450")
  757. name="re450"
  758. ;;
  759. *"RouterBOARD 411/A/AH")
  760. name="rb-411"
  761. ;;
  762. *"RouterBOARD 411U")
  763. name="rb-411u"
  764. ;;
  765. *"RouterBOARD 433/AH")
  766. name="rb-433"
  767. ;;
  768. *"RouterBOARD 433UAH")
  769. name="rb-433u"
  770. ;;
  771. *"RouterBOARD 435G")
  772. name="rb-435g"
  773. ;;
  774. *"RouterBOARD 450")
  775. name="rb-450"
  776. ;;
  777. *"RouterBOARD 450G")
  778. name="rb-450g"
  779. ;;
  780. *"RouterBOARD 493/AH")
  781. name="rb-493"
  782. ;;
  783. *"RouterBOARD 493G")
  784. name="rb-493g"
  785. ;;
  786. *"RouterBOARD 750")
  787. name="rb-750"
  788. ;;
  789. *"RouterBOARD 750GL")
  790. name="rb-750gl"
  791. ;;
  792. *"RouterBOARD 751")
  793. name="rb-751"
  794. ;;
  795. *"RouterBOARD 751G")
  796. name="rb-751g"
  797. ;;
  798. *"RouterBOARD 911G-2HPnD")
  799. name="rb-911g-2hpnd"
  800. ;;
  801. *"RouterBOARD 911G-5HPnD")
  802. name="rb-911g-5hpnd"
  803. ;;
  804. *"RouterBOARD 911G-5HPacD")
  805. name="rb-911g-5hpacd"
  806. ;;
  807. *"RouterBOARD 912UAG-2HPnD")
  808. name="rb-912uag-2hpnd"
  809. ;;
  810. *"RouterBOARD 912UAG-5HPnD")
  811. name="rb-912uag-5hpnd"
  812. ;;
  813. *"RouterBOARD 941-2nD")
  814. name="rb-941-2nd"
  815. ;;
  816. *"RouterBOARD 951G-2HnD")
  817. name="rb-951g-2hnd"
  818. ;;
  819. *"RouterBOARD 951Ui-2HnD")
  820. name="rb-951ui-2hnd"
  821. ;;
  822. *"RouterBOARD 2011L")
  823. name="rb-2011l"
  824. ;;
  825. *"RouterBOARD 2011UAS")
  826. name="rb-2011uas"
  827. ;;
  828. *"RouterBOARD 2011UiAS")
  829. name="rb-2011uias"
  830. ;;
  831. *"RouterBOARD 2011UAS-2HnD")
  832. name="rb-2011uas-2hnd"
  833. ;;
  834. *"RouterBOARD 2011UiAS-2HnD")
  835. name="rb-2011uias-2hnd"
  836. ;;
  837. *"RouterBOARD SXT Lite2")
  838. name="rb-sxt2n"
  839. ;;
  840. *"RouterBOARD SXT Lite5")
  841. name="rb-sxt5n"
  842. ;;
  843. *"Rocket M")
  844. name="rocket-m"
  845. ubnt_xm_board_detect
  846. ;;
  847. *"Rocket M TI")
  848. name="rocket-m-ti"
  849. ;;
  850. *"Rocket M XW")
  851. name="rocket-m-xw"
  852. ;;
  853. *RouterStation)
  854. name="routerstation"
  855. ;;
  856. *"RouterStation Pro")
  857. name="routerstation-pro"
  858. ;;
  859. *RW2458N)
  860. name="rw2458n"
  861. ;;
  862. *"SMART-300")
  863. name="smart-300"
  864. ;;
  865. "Smart Electronics Black Swift board"*)
  866. name="bsb"
  867. ;;
  868. *"Telldus TellStick ZNet Lite")
  869. name="tellstick-znet-lite"
  870. ;;
  871. *SOM9331)
  872. name="som9331"
  873. ;;
  874. *SR3200)
  875. name="sr3200"
  876. ;;
  877. *TEW-632BRP)
  878. name="tew-632brp"
  879. ;;
  880. *TEW-673GRU)
  881. name="tew-673gru"
  882. ;;
  883. *TEW-712BR)
  884. name="tew-712br"
  885. ;;
  886. *TEW-732BR)
  887. name="tew-732br"
  888. ;;
  889. *TEW-823DRU)
  890. name="tew-823dru"
  891. ;;
  892. *"TL-WR1041N v2")
  893. name="tl-wr1041n-v2"
  894. ;;
  895. *TL-WR1043ND)
  896. name="tl-wr1043nd"
  897. ;;
  898. *"TL-WR1043ND v2")
  899. name="tl-wr1043nd-v2"
  900. ;;
  901. *"TL-WR1043ND v4")
  902. name="tl-wr1043nd-v4"
  903. ;;
  904. *TL-WR2543N*)
  905. name="tl-wr2543n"
  906. ;;
  907. *"DIR-615 rev. C1")
  908. name="dir-615-c1"
  909. ;;
  910. *TL-MR3020)
  911. name="tl-mr3020"
  912. ;;
  913. *TL-MR3040)
  914. name="tl-mr3040"
  915. ;;
  916. *"TL-MR3040 v2")
  917. name="tl-mr3040-v2"
  918. ;;
  919. *TL-MR3220)
  920. name="tl-mr3220"
  921. ;;
  922. *"TL-MR3220 v2")
  923. name="tl-mr3220-v2"
  924. ;;
  925. *TL-MR3420)
  926. name="tl-mr3420"
  927. ;;
  928. *"TL-MR3420 v2")
  929. name="tl-mr3420-v2"
  930. ;;
  931. *"TL-WA701ND v2")
  932. name="tl-wa701nd-v2"
  933. ;;
  934. *"TL-WA7210N v2")
  935. name="tl-wa7210n-v2"
  936. ;;
  937. *TL-WA750RE)
  938. name="tl-wa750re"
  939. ;;
  940. *"TL-WA7510N v1")
  941. name="tl-wa7510n"
  942. ;;
  943. *TL-WA850RE)
  944. name="tl-wa850re"
  945. ;;
  946. *TL-WA860RE)
  947. name="tl-wa860re"
  948. ;;
  949. *"TL-WA830RE v2")
  950. name="tl-wa830re-v2"
  951. ;;
  952. *"TL-WA801ND v2")
  953. name="tl-wa801nd-v2"
  954. ;;
  955. *"TL-WA801ND v3")
  956. name="tl-wa801nd-v3"
  957. ;;
  958. *"TL-WR802N v1")
  959. name="tl-wr802n-v1"
  960. ;;
  961. *TL-WA901ND)
  962. name="tl-wa901nd"
  963. ;;
  964. *"TL-WA901ND v2")
  965. name="tl-wa901nd-v2"
  966. ;;
  967. *"TL-WA901ND v3")
  968. name="tl-wa901nd-v3"
  969. ;;
  970. *"TL-WA901ND v4")
  971. name="tl-wa901nd-v4"
  972. ;;
  973. *"TL-WDR3320 v2")
  974. name="tl-wdr3320-v2"
  975. ;;
  976. *"TL-WDR3500")
  977. name="tl-wdr3500"
  978. ;;
  979. *"TL-WDR3600/4300/4310")
  980. name="tl-wdr4300"
  981. ;;
  982. *"TL-WDR4900 v2")
  983. name="tl-wdr4900-v2"
  984. ;;
  985. *"TL-WDR6500 v2")
  986. name="tl-wdr6500-v2"
  987. ;;
  988. *TL-WPA8630)
  989. name="tl-wpa8630"
  990. ;;
  991. *TL-WR741ND)
  992. name="tl-wr741nd"
  993. ;;
  994. *"TL-WR741ND v4")
  995. name="tl-wr741nd-v4"
  996. ;;
  997. *"TL-WR841N v1")
  998. name="tl-wr841n-v1"
  999. ;;
  1000. *"TL-WR841N/ND v7")
  1001. name="tl-wr841n-v7"
  1002. ;;
  1003. *"TL-WR841N/ND v8")
  1004. name="tl-wr841n-v8"
  1005. ;;
  1006. *"TL-WR841N/ND v9")
  1007. name="tl-wr841n-v9"
  1008. ;;
  1009. *"TL-WR841N/ND v11")
  1010. name="tl-wr841n-v11"
  1011. ;;
  1012. *"TL-WR842N/ND v2")
  1013. name="tl-wr842n-v2"
  1014. ;;
  1015. *"TL-WR842N/ND v3")
  1016. name="tl-wr842n-v3"
  1017. ;;
  1018. *TL-WR941ND)
  1019. name="tl-wr941nd"
  1020. ;;
  1021. *"TL-WR941N/ND v5")
  1022. name="tl-wr941nd-v5"
  1023. ;;
  1024. *"TL-WR941N/ND v6")
  1025. name="tl-wr941nd-v6"
  1026. ;;
  1027. *"TL-WR940N v4")
  1028. name="tl-wr940n-v4"
  1029. ;;
  1030. *"TL-WR703N v1")
  1031. name="tl-wr703n"
  1032. ;;
  1033. *"TL-WR710N v1")
  1034. name="tl-wr710n"
  1035. ;;
  1036. *"TL-WR720N"*)
  1037. name="tl-wr720n-v3"
  1038. ;;
  1039. *"TL-WR810N")
  1040. name="tl-wr810n"
  1041. ;;
  1042. *"TL-MR10U")
  1043. name="tl-mr10u"
  1044. ;;
  1045. *"TL-MR11U")
  1046. name="tl-mr11u"
  1047. ;;
  1048. *"TL-MR12U")
  1049. name="tl-mr12u"
  1050. ;;
  1051. *"TL-MR13U v1")
  1052. name="tl-mr13u"
  1053. ;;
  1054. *"TPE-R1100 Think Penguin Mini Router")
  1055. name="tpe-r1100"
  1056. ;;
  1057. *"Tube2H")
  1058. name="tube2h"
  1059. ;;
  1060. *UniFi)
  1061. name="unifi"
  1062. ;;
  1063. *"UniFi-AC-LITE")
  1064. name="unifiac-lite"
  1065. ;;
  1066. *"UniFi-AC-PRO")
  1067. name="unifiac-pro"
  1068. ;;
  1069. *"UniFi AP Pro")
  1070. name="uap-pro"
  1071. ;;
  1072. "WeIO"*)
  1073. name="weio"
  1074. ;;
  1075. *WHR-G301N)
  1076. name="whr-g301n"
  1077. ;;
  1078. *WHR-HP-GN)
  1079. name="whr-hp-gn"
  1080. ;;
  1081. *WLAE-AG300N)
  1082. name="wlae-ag300n"
  1083. ;;
  1084. *"UniFiAP Outdoor")
  1085. name="unifi-outdoor"
  1086. ;;
  1087. *"UniFiAP Outdoor+")
  1088. name="unifi-outdoor-plus"
  1089. ;;
  1090. *WP543)
  1091. name="wp543"
  1092. ;;
  1093. *WPE72)
  1094. name="wpe72"
  1095. ;;
  1096. *WPJ342)
  1097. name="wpj342"
  1098. ;;
  1099. *WPJ344)
  1100. name="wpj344"
  1101. ;;
  1102. *WPJ531)
  1103. name="wpj531"
  1104. ;;
  1105. *WPJ558)
  1106. name="wpj558"
  1107. ;;
  1108. *WNDAP360)
  1109. name="wndap360"
  1110. ;;
  1111. *"WNDR3700/WNDR3800/WNDRMAC")
  1112. wndr3700_board_detect "$machine"
  1113. ;;
  1114. *"R6100")
  1115. name="r6100"
  1116. ;;
  1117. *"WNDR3700v4")
  1118. name="wndr3700v4"
  1119. ;;
  1120. *"WNDR4300")
  1121. name="wndr4300"
  1122. ;;
  1123. *"WNR2000 V4")
  1124. name="wnr2000-v4"
  1125. ;;
  1126. *"WNR2000 V3")
  1127. name="wnr2000-v3"
  1128. ;;
  1129. *WNR2000)
  1130. name="wnr2000"
  1131. ;;
  1132. *WNR2200)
  1133. name="wnr2200"
  1134. ;;
  1135. *"WNR612 V2")
  1136. name="wnr612-v2"
  1137. ;;
  1138. *"WNR1000 V2")
  1139. name="wnr1000-v2"
  1140. ;;
  1141. *WPN824N)
  1142. name="wpn824n"
  1143. ;;
  1144. *WRT160NL)
  1145. name="wrt160nl"
  1146. ;;
  1147. *WRT400N)
  1148. name="wrt400n"
  1149. ;;
  1150. *"WRTnode2Q board")
  1151. name="wrtnode2q"
  1152. ;;
  1153. *"WZR-450HP2")
  1154. name="wzr-450hp2"
  1155. ;;
  1156. *"WZR-HP-AG300H/WZR-600DHP")
  1157. name="wzr-hp-ag300h"
  1158. ;;
  1159. *WZR-HP-G300NH)
  1160. name="wzr-hp-g300nh"
  1161. ;;
  1162. *WZR-HP-G450H)
  1163. name="wzr-hp-g450h"
  1164. ;;
  1165. *WZR-HP-G300NH2)
  1166. name="wzr-hp-g300nh2"
  1167. ;;
  1168. *WHR-HP-G300N)
  1169. name="whr-hp-g300n"
  1170. ;;
  1171. *XD3200)
  1172. name="xd3200"
  1173. ;;
  1174. *Z1)
  1175. name="z1"
  1176. ;;
  1177. *ZBT-WE1526)
  1178. name="zbt-we1526"
  1179. ;;
  1180. *ZCN-1523H-2)
  1181. name="zcn-1523h-2"
  1182. ;;
  1183. *ZCN-1523H-5)
  1184. name="zcn-1523h-5"
  1185. ;;
  1186. *EmbWir-Dorin)
  1187. name="ew-dorin"
  1188. ;;
  1189. *EmbWir-Dorin-Router)
  1190. name="ew-dorin-router"
  1191. ;;
  1192. "8devices Carambola2"*)
  1193. name="carambola2"
  1194. ;;
  1195. *"Sitecom WLR-8100")
  1196. name="wlr8100"
  1197. ;;
  1198. *"BHU BXU2000n-2 rev. A1")
  1199. name="bxu2000n-2-a1"
  1200. ;;
  1201. *"HiWiFi HC6361")
  1202. name="hiwifi-hc6361"
  1203. ;;
  1204. esac
  1205. [ -z "$AR71XX_MODEL" ] && [ "${machine:0:8}" = 'TP-LINK ' ] && \
  1206. tplink_board_detect "$machine"
  1207. [ -z "$name" ] && name="unknown"
  1208. [ -z "$AR71XX_BOARD_NAME" ] && AR71XX_BOARD_NAME="$name"
  1209. [ -z "$AR71XX_MODEL" ] && AR71XX_MODEL="$machine"
  1210. [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
  1211. echo "$AR71XX_BOARD_NAME" > /tmp/sysinfo/board_name
  1212. echo "$AR71XX_MODEL" > /tmp/sysinfo/model
  1213. }
  1214. ar71xx_board_name() {
  1215. local name
  1216. [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
  1217. [ -z "$name" ] && name="unknown"
  1218. echo "$name"
  1219. }