diag.sh 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. #!/bin/sh
  2. # Copyright (C) 2009-2013 OpenWrt.org
  3. . /lib/functions.sh
  4. . /lib/functions/leds.sh
  5. get_status_led() {
  6. local board=$(board_name)
  7. case $board in
  8. a40)
  9. status_led="a40:green:status"
  10. ;;
  11. a60)
  12. status_led="a60:green:status"
  13. ;;
  14. alfa-nx)
  15. status_led="alfa:green:led_8"
  16. ;;
  17. all0305)
  18. status_led="eap7660d:green:ds4"
  19. ;;
  20. antminer-s1|\
  21. antminer-s3|\
  22. antminer-r1|\
  23. e1700ac-v2|\
  24. e558-v2|\
  25. e600gac-v2|\
  26. e750a-v4|\
  27. e750g-v8|\
  28. eap120|\
  29. minibox-v1|\
  30. minibox-v3.2|\
  31. packet-squirrel|\
  32. som9331|\
  33. sr3200|\
  34. tl-wr802n-v2|\
  35. xd3200)
  36. status_led="$board:green:system"
  37. ;;
  38. ap121f)
  39. status_led="$board:green:vpn"
  40. ;;
  41. ap132|\
  42. ap531b0|\
  43. cpe505n|\
  44. db120|\
  45. dr342|\
  46. dr344|\
  47. rut900|\
  48. tew-632brp|\
  49. tl-wr942n-v1|\
  50. wpj344|\
  51. zbt-we1526)
  52. status_led="$board:green:status"
  53. ;;
  54. ap136-010|\
  55. ap136-020)
  56. status_led="ap136:green:status"
  57. ;;
  58. ap147-010)
  59. status_led="ap147:green:status"
  60. ;;
  61. ap135-020)
  62. status_led="ap135:green:status"
  63. ;;
  64. archer-c25-v1|\
  65. archer-c58-v1|\
  66. archer-c59-v1|\
  67. archer-c59-v2|\
  68. archer-c60-v1|\
  69. archer-c60-v2|\
  70. archer-c7-v4|\
  71. archer-c7-v5|\
  72. fritz300e|\
  73. fritz4020|\
  74. fritz450e|\
  75. gl-usb150|\
  76. mr12|\
  77. mr16|\
  78. nbg6616|\
  79. sc1750|\
  80. sc450|\
  81. tl-wpa8630|\
  82. tl-wr902ac-v1)
  83. status_led="$board:green:power"
  84. ;;
  85. tl-mr10u|\
  86. tl-mr12u|\
  87. tl-mr13u|\
  88. tl-wdr4300|\
  89. tl-wdr4900-v2|\
  90. tl-wr703n|\
  91. tl-wr710n|\
  92. tl-wr720n-v3|\
  93. tl-wr802n-v1|\
  94. tl-wr810n|\
  95. tl-wr810n-v2|\
  96. tl-wr940n-v4|\
  97. tl-wr941nd-v6)
  98. status_led="tp-link:blue:system"
  99. ;;
  100. ap90q|\
  101. cpe830|\
  102. cpe870|\
  103. gl-ar300m|\
  104. gl-inet|\
  105. gl-mifi)
  106. status_led="$board:green:lan"
  107. ;;
  108. ap91-5g|\
  109. n5q)
  110. status_led="$board:green:signal4"
  111. ;;
  112. ap96)
  113. status_led="$board:green:led2"
  114. ;;
  115. aw-nr580)
  116. status_led="$board:green:ready"
  117. ;;
  118. bhr-4grv2|\
  119. wzr-hp-ag300h|\
  120. wzr-hp-g300nh2)
  121. status_led="buffalo:red:diag"
  122. ;;
  123. bsb)
  124. status_led="$board:red:sys"
  125. ;;
  126. bullet-m|\
  127. bullet-m-xw|\
  128. loco-m-xw|\
  129. nano-m|\
  130. nanostation-m|\
  131. nanostation-m-xw|\
  132. rocket-m|\
  133. rocket-m-xw)
  134. status_led="ubnt:green:link4"
  135. ;;
  136. bxu2000n-2-a1)
  137. status_led="bhu:green:status"
  138. ;;
  139. cap324)
  140. status_led="pcs:green:power"
  141. ;;
  142. c-55|\
  143. c-60)
  144. status_led="$board:green:pwr"
  145. ;;
  146. cap4200ag)
  147. status_led="senao:green:pwr"
  148. ;;
  149. cf-e316n-v2|\
  150. cf-e520n|\
  151. cf-e530n)
  152. status_led="$board:blue:wan"
  153. ;;
  154. cf-e320n-v2)
  155. status_led="$board:blue:wlan"
  156. ;;
  157. cf-e375ac|\
  158. cf-e380ac-v1|\
  159. cf-e380ac-v2|\
  160. cf-e385ac)
  161. status_led="$board:blue:wlan2g"
  162. ;;
  163. cpe510)
  164. status_led="tp-link:green:link4"
  165. ;;
  166. cr3000|\
  167. cr5000)
  168. status_led="pcs:amber:power"
  169. ;;
  170. dap-1330-a1|\
  171. dgl-5500-a1|\
  172. dhp-1565-a1|\
  173. dir-505-a1|\
  174. dir-600-a1|\
  175. dir-615-e1|\
  176. dir-615-i1|\
  177. dir-615-e4)
  178. status_led="d-link:green:power"
  179. ;;
  180. dir-615-c1)
  181. status_led="d-link:green:status"
  182. ;;
  183. dir-825-b1)
  184. status_led="d-link:orange:power"
  185. ;;
  186. dir-825-c1|\
  187. dir-835-a1)
  188. status_led="d-link:amber:power"
  189. ;;
  190. dir-869-a1)
  191. status_led="d-link:white:status"
  192. ;;
  193. dlan-hotspot)
  194. status_led="devolo:green:wifi"
  195. ;;
  196. dlan-pro-500-wp)
  197. status_led="devolo:green:wlan-2g"
  198. ;;
  199. dlan-pro-1200-ac)
  200. status_led="devolo:status:wlan"
  201. ;;
  202. dr531)
  203. status_led="$board:green:sig4"
  204. ;;
  205. dragino2|\
  206. oolite-v1)
  207. status_led="$board:red:system"
  208. ;;
  209. dw33d|\
  210. r36a)
  211. status_led="$board:blue:status"
  212. ;;
  213. e600g-v2|\
  214. oolite-v5.2-dev|\
  215. ts-d084|\
  216. wifi-pineapple-nano)
  217. status_led="$board:blue:system"
  218. ;;
  219. eap300v2)
  220. status_led="engenius:blue:power"
  221. ;;
  222. ens202ext|\
  223. esr900)
  224. status_led="engenius:amber:power"
  225. ;;
  226. eap7660d)
  227. status_led="$board:green:ds4"
  228. ;;
  229. el-m150|\
  230. el-mini)
  231. status_led="easylink:green:system"
  232. ;;
  233. ew-balin)
  234. status_led="balin:green:status"
  235. ;;
  236. ew-dorin|\
  237. ew-dorin-router)
  238. status_led="dorin:green:status"
  239. ;;
  240. f9k1115v2)
  241. status_led="belkin:blue:status"
  242. ;;
  243. epg5000|\
  244. esr1750)
  245. status_led="$board:amber:power"
  246. ;;
  247. gl-ar750|\
  248. hiveap-121|\
  249. nbg6716|\
  250. wam250)
  251. status_led="$board:white:power"
  252. ;;
  253. hiwifi-hc6361)
  254. status_led="hiwifi:blue:system"
  255. ;;
  256. hornet-ub|\
  257. hornet-ub-x2)
  258. status_led="alfa:blue:wps"
  259. ;;
  260. ja76pf|\
  261. ja76pf2)
  262. status_led="jjplus:green:led1"
  263. ;;
  264. jwap230)
  265. status_led="$board:green:led1"
  266. ;;
  267. koala)
  268. status_led="$board:blue:sys"
  269. ;;
  270. lan-turtle)
  271. status_led="$board:orange:system"
  272. ;;
  273. lbe-m5)
  274. status_led="ubnt:green:sys"
  275. ;;
  276. ls-sr71)
  277. status_led="ubnt:green:d22"
  278. ;;
  279. mc-mac1200r)
  280. status_led="mercury:green:system"
  281. ;;
  282. mr18|\
  283. z1)
  284. status_led="$board:green:tricolor0"
  285. ;;
  286. mr600)
  287. status_led="$board:orange:power"
  288. ;;
  289. mr600v2)
  290. status_led="mr600:blue:power"
  291. ;;
  292. mr1750|\
  293. mr1750v2)
  294. status_led="mr1750:blue:power"
  295. ;;
  296. mr900|\
  297. mr900v2)
  298. status_led="mr900:blue:power"
  299. ;;
  300. mynet-n600|\
  301. mynet-n750|\
  302. mynet-rext)
  303. status_led="wd:blue:power"
  304. ;;
  305. mzk-w04nu|\
  306. mzk-w300nh)
  307. status_led="planex:green:status"
  308. ;;
  309. nbg460n_550n_550nh)
  310. status_led="nbg460n:green:power"
  311. ;;
  312. om2p|\
  313. om2p-hs|\
  314. om2p-hsv2|\
  315. om2p-hsv3|\
  316. om2p-hsv4|\
  317. om2p-lc|\
  318. om2pv2|\
  319. om2pv4)
  320. status_led="om2p:blue:power"
  321. ;;
  322. om5p|\
  323. om5p-an)
  324. status_led="om5p:blue:power"
  325. ;;
  326. om5p-ac|\
  327. om5p-acv2)
  328. status_led="om5pac:blue:power"
  329. ;;
  330. omy-g1)
  331. status_led="omy:green:wlan"
  332. ;;
  333. omy-x1)
  334. status_led="omy:green:power"
  335. ;;
  336. onion-omega)
  337. status_led="onion:amber:system"
  338. ;;
  339. pb44)
  340. status_led="$board:amber:jump1"
  341. ;;
  342. r602n)
  343. status_led="$board:green:wan"
  344. ;;
  345. rb-2011il|\
  346. rb-2011ils|\
  347. rb-2011l|\
  348. rb-2011uas|\
  349. rb-2011uas-2hnd)
  350. status_led="rb:green:usr"
  351. ;;
  352. rb-411|\
  353. rb-411u|\
  354. rb-433|\
  355. rb-433u|\
  356. rb-450|\
  357. rb-450g|\
  358. rb-493)
  359. status_led="rb4xx:yellow:user"
  360. ;;
  361. rb-750)
  362. status_led="rb750:green:act"
  363. ;;
  364. rb-750-r2|\
  365. rb-750p-pbr2|\
  366. rb-750up-r2|\
  367. rb-911-2hn|\
  368. rb-911-5hn|\
  369. rb-911g-2hpnd|\
  370. rb-911g-5hpacd|\
  371. rb-911g-5hpnd|\
  372. rb-931-2nd|\
  373. rb-941-2nd|\
  374. rb-951ui-2nd|\
  375. rb-952ui-5ac2nd|\
  376. rb-962uigs-5hact2hnt|\
  377. rb-lhg-5nd|\
  378. rb-map-2nd|\
  379. rb-mapl-2nd|\
  380. rb-sxt-2nd-r3|\
  381. rb-wap-2nd|\
  382. rb-wapr-2nd)
  383. status_led="rb:green:user"
  384. ;;
  385. rb-951ui-2hnd)
  386. status_led="rb:green:act"
  387. ;;
  388. rb-912uag-2hpnd|\
  389. rb-912uag-5hpnd|\
  390. rb-sxt2n|\
  391. rb-sxt5n|\
  392. rb-wapg-5hact2hnd)
  393. status_led="rb:green:power"
  394. ;;
  395. re355|\
  396. re450|\
  397. sc300m)
  398. status_led="$board:blue:power"
  399. ;;
  400. rocket-m-ti)
  401. status_led="ubnt:green:link6"
  402. ;;
  403. routerstation|\
  404. routerstation-pro)
  405. status_led="ubnt:green:rf"
  406. ;;
  407. rw2458n)
  408. status_led="$board:green:d3"
  409. ;;
  410. smart-300)
  411. status_led="nc-link:green:system"
  412. ;;
  413. qihoo-c301)
  414. status_led="qihoo:green:status"
  415. ;;
  416. t830)
  417. status_led="$board:green:usb"
  418. ;;
  419. tellstick-znet-lite)
  420. status_led="tellstick:white:system"
  421. ;;
  422. tew-673gru)
  423. status_led="trendnet:blue:wps"
  424. ;;
  425. tew-712br|\
  426. tew-732br|\
  427. tew-823dru)
  428. status_led="trendnet:green:power"
  429. ;;
  430. tl-mr3020|\
  431. tl-wr2543n)
  432. status_led="tp-link:green:wps"
  433. ;;
  434. tl-wa750re)
  435. status_led="tp-link:orange:re"
  436. ;;
  437. tl-wa850re|\
  438. tl-wa850re-v2)
  439. status_led="tp-link:blue:re"
  440. ;;
  441. tl-wa855re-v1|\
  442. tl-wa860re)
  443. status_led="tp-link:green:power"
  444. ;;
  445. tl-mr6400)
  446. status_led="tp-link:white:power"
  447. ;;
  448. archer-c5|\
  449. archer-c7|\
  450. tl-mr3220|\
  451. tl-mr3220-v2|\
  452. tl-mr3420|\
  453. tl-mr3420-v2|\
  454. tl-wa701nd-v2|\
  455. tl-wa801nd-v2|\
  456. tl-wa801nd-v3|\
  457. tl-wa830re-v2|\
  458. tl-wa901nd|\
  459. tl-wa901nd-v2|\
  460. tl-wa901nd-v3|\
  461. tl-wa901nd-v4|\
  462. tl-wa901nd-v5|\
  463. tl-wdr3320-v2|\
  464. tl-wdr3500|\
  465. tl-wr1041n-v2|\
  466. tl-wr1043n-v5|\
  467. tl-wr1043nd|\
  468. tl-wr1043nd-v2|\
  469. tl-wr1043nd-v4|\
  470. tl-wr740n-v6|\
  471. tl-wr741nd|\
  472. tl-wr741nd-v4|\
  473. tl-wr840n-v2|\
  474. tl-wr840n-v3|\
  475. tl-wr841n-v1|\
  476. tl-wr841n-v7|\
  477. tl-wr841n-v8|\
  478. tl-wr841n-v11|\
  479. tl-wr842n-v2|\
  480. tl-wr842n-v3|\
  481. tl-wr941nd|\
  482. tl-wr941nd-v5)
  483. status_led="tp-link:green:system"
  484. ;;
  485. tl-wr841n-v9)
  486. status_led="tp-link:green:qss"
  487. ;;
  488. tl-wr940n-v6)
  489. status_led="tp-link:orange:diag"
  490. ;;
  491. tl-wdr6500-v2)
  492. status_led="tp-link:white:system"
  493. ;;
  494. tube2h)
  495. status_led="alfa:green:signal4"
  496. ;;
  497. unifi)
  498. status_led="ubnt:green:dome"
  499. ;;
  500. uap-pro|\
  501. unifiac-lite|\
  502. unifiac-pro)
  503. status_led="ubnt:white:dome"
  504. ;;
  505. unifi-outdoor-plus)
  506. status_led="ubnt:white:front"
  507. ;;
  508. airgateway|\
  509. airgatewaypro)
  510. status_led="ubnt:white:status"
  511. ;;
  512. wi2a-ac200i)
  513. status_led="nokia:green:ctrl"
  514. ;;
  515. whr-g301n|\
  516. whr-hp-g300n|\
  517. whr-hp-gn|\
  518. wzr-hp-g300nh)
  519. status_led="buffalo:green:router"
  520. ;;
  521. wlae-ag300n)
  522. status_led="buffalo:green:status"
  523. ;;
  524. r6100|\
  525. wndap360|\
  526. wndr3700|\
  527. wndr3700v4|\
  528. wndr4300|\
  529. wnr2000|\
  530. wnr2000-v3|\
  531. wnr2200|\
  532. wnr612-v2|\
  533. wnr1000-v2|\
  534. wpn824n)
  535. status_led="netgear:green:power"
  536. ;;
  537. wp543)
  538. status_led="$board:green:diag"
  539. ;;
  540. wpj342|\
  541. wpj531|\
  542. wpj558)
  543. status_led="$board:green:sig3"
  544. ;;
  545. wpj563)
  546. status_led="$board:green:sig1"
  547. ;;
  548. wrt160nl|\
  549. wrt400n)
  550. status_led="$board:blue:wps"
  551. ;;
  552. zcn-1523h-2|\
  553. zcn-1523h-5)
  554. status_led="zcn-1523h:amber:init"
  555. ;;
  556. wlr8100)
  557. status_led="sitecom:amber:status"
  558. ;;
  559. esac
  560. }
  561. set_state() {
  562. get_status_led
  563. case "$1" in
  564. preinit)
  565. status_led_blink_preinit
  566. ;;
  567. failsafe)
  568. status_led_blink_failsafe
  569. ;;
  570. preinit_regular)
  571. status_led_blink_preinit_regular
  572. ;;
  573. done)
  574. status_led_on
  575. case $(board_name) in
  576. gl-ar300m|\
  577. gl-ar750)
  578. fw_printenv lc >/dev/null 2>&1 && fw_setenv "bootcount" 0
  579. ;;
  580. qihoo-c301)
  581. local n=$(fw_printenv activeregion | cut -d = -f 2)
  582. fw_setenv "image${n}trynum" 0
  583. ;;
  584. wi2a-ac200i)
  585. fw_setenv PKRstCnt 0
  586. ;;
  587. esac
  588. ;;
  589. esac
  590. }