diag.sh 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491
  1. #!/bin/sh
  2. # Copyright (C) 2009-2013 OpenWrt.org
  3. . /lib/functions/leds.sh
  4. . /lib/ar71xx.sh
  5. get_status_led() {
  6. local board=$(ar71xx_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. minibox-v1|\
  24. som9331|\
  25. sr3200|\
  26. xd3200)
  27. status_led="$board:green:system"
  28. ;;
  29. ap121f)
  30. status_led="$board:green:vpn"
  31. ;;
  32. ap132|\
  33. db120|\
  34. dr344|\
  35. tew-632brp|\
  36. wpj344|\
  37. zbt-we1526)
  38. status_led="$board:green:status"
  39. ;;
  40. ap136-010|\
  41. ap136-020)
  42. status_led="ap136:green:status"
  43. ;;
  44. ap147-010)
  45. status_led="ap147:green:status"
  46. ;;
  47. ap135-020)
  48. status_led="ap135:green:status"
  49. ;;
  50. mr12|\
  51. mr16|\
  52. nbg6616|\
  53. tl-wpa8630)
  54. status_led="$board:green:power"
  55. ;;
  56. ap90q|\
  57. cpe830|\
  58. cpe870|\
  59. gl-inet)
  60. status_led="$board:green:lan"
  61. ;;
  62. ap96)
  63. status_led="$board:green:led2"
  64. ;;
  65. aw-nr580)
  66. status_led="$board:green:ready"
  67. ;;
  68. bhr-4grv2|\
  69. wzr-hp-ag300h|\
  70. wzr-hp-g300nh2)
  71. status_led="buffalo:red:diag"
  72. ;;
  73. bsb)
  74. status_led="$board:red:sys"
  75. ;;
  76. bullet-m|\
  77. rocket-m|\
  78. rocket-m-xw|\
  79. nano-m|\
  80. nanostation-m|\
  81. nanostation-m-xw|\
  82. loco-m-xw)
  83. status_led="ubnt:green:link4"
  84. ;;
  85. rocket-m-ti)
  86. status_led="ubnt:green:link6"
  87. ;;
  88. bxu2000n-2-a1)
  89. status_led="bhu:green:status"
  90. ;;
  91. cap324)
  92. status_led="pcs:green:power"
  93. ;;
  94. c-55|\
  95. c-60)
  96. status_led="$board:green:pwr"
  97. ;;
  98. cap4200ag)
  99. status_led="senao:green:pwr"
  100. ;;
  101. cf-e316n-v2|\
  102. cf-e520n|\
  103. cf-e530n)
  104. status_led="$board:blue:wan"
  105. ;;
  106. cf-e320n-v2)
  107. status_led="$board:blue:wlan"
  108. ;;
  109. cf-e380ac-v1|\
  110. cf-e380ac-v2)
  111. status_led="$board:blue:wlan2g"
  112. ;;
  113. cpe510)
  114. status_led="tp-link:green:link4"
  115. ;;
  116. cr3000)
  117. status_led="pcs:amber:power"
  118. ;;
  119. cr5000)
  120. status_led="pcs:amber:power"
  121. ;;
  122. dgl-5500-a1|\
  123. dhp-1565-a1|\
  124. dir-505-a1|\
  125. dir-600-a1|\
  126. dir-615-e1|\
  127. dir-615-i1|\
  128. dir-615-e4)
  129. status_led="d-link:green:power"
  130. ;;
  131. dir-615-c1)
  132. status_led="d-link:green:status"
  133. ;;
  134. dir-825-b1)
  135. status_led="d-link:orange:power"
  136. ;;
  137. dir-825-c1|\
  138. dir-835-a1)
  139. status_led="d-link:amber:power"
  140. ;;
  141. dir-869-a1)
  142. status_led="d-link:white:status"
  143. ;;
  144. dlan-hotspot)
  145. status_led="devolo:green:wifi"
  146. ;;
  147. dlan-pro-500-wp)
  148. status_led="devolo:green:wlan-2g"
  149. ;;
  150. dlan-pro-1200-ac)
  151. status_led="devolo:status:wlan"
  152. ;;
  153. dr531)
  154. status_led="$board:green:sig4"
  155. ;;
  156. dragino2|\
  157. oolite)
  158. status_led="$board:red:system"
  159. ;;
  160. dw33d)
  161. status_led="$board:blue:status"
  162. ;;
  163. eap120)
  164. status_led="$(ar71xx_board_name):green:system"
  165. ;;
  166. eap300v2)
  167. status_led="engenius:blue:power"
  168. ;;
  169. eap7660d)
  170. status_led="$board:green:ds4"
  171. ;;
  172. el-mini|\
  173. el-m150)
  174. status_led="easylink:green:system"
  175. ;;
  176. ew-dorin|\
  177. ew-dorin-router)
  178. status_led="dorin:green:status"
  179. ;;
  180. f9k1115v2)
  181. status_led="belkin:blue:status"
  182. ;;
  183. epg5000|\
  184. esr1750)
  185. status_led="$board:amber:power"
  186. ;;
  187. esr900)
  188. status_led="engenius:amber:power"
  189. ;;
  190. hiwifi-hc6361)
  191. status_led="hiwifi:blue:system"
  192. ;;
  193. hornet-ub|\
  194. hornet-ub-x2)
  195. status_led="alfa:blue:wps"
  196. ;;
  197. ja76pf|\
  198. ja76pf2)
  199. status_led="jjplus:green:led1"
  200. ;;
  201. jwap230)
  202. status_led="$board:green:led1"
  203. ;;
  204. ls-sr71)
  205. status_led="ubnt:green:d22"
  206. ;;
  207. mc-mac1200r)
  208. status_led="mercury:green:system"
  209. ;;
  210. mr18|\
  211. z1)
  212. status_led="$board:green:tricolor0"
  213. ;;
  214. mr600)
  215. status_led="$board:orange:power"
  216. ;;
  217. mr600v2)
  218. status_led="mr600:blue:power"
  219. ;;
  220. mr1750|\
  221. mr1750v2)
  222. status_led="mr1750:blue:power"
  223. ;;
  224. mr900|\
  225. mr900v2)
  226. status_led="mr900:blue:power"
  227. ;;
  228. mynet-n600|\
  229. mynet-n750)
  230. status_led="wd:blue:power"
  231. ;;
  232. mynet-rext)
  233. status_led="wd:blue:power"
  234. ;;
  235. mzk-w04nu|\
  236. mzk-w300nh)
  237. status_led="planex:green:status"
  238. ;;
  239. nbg460n_550n_550nh)
  240. status_led="nbg460n:green:power"
  241. ;;
  242. nbg6716)
  243. status_led="$board:white:power"
  244. ;;
  245. om2p|\
  246. om2pv2|\
  247. om2pv4|\
  248. om2p-hs|\
  249. om2p-hsv2|\
  250. om2p-hsv3|\
  251. om2p-hsv4|\
  252. om2p-lc)
  253. status_led="om2p:blue:power"
  254. ;;
  255. om5p|\
  256. om5p-an)
  257. status_led="om5p:blue:power"
  258. ;;
  259. om5p-ac|\
  260. om5p-acv2)
  261. status_led="om5pac:blue:power"
  262. ;;
  263. omy-g1)
  264. status_led="omy:green:wlan"
  265. ;;
  266. omy-x1)
  267. status_led="omy:green:power"
  268. ;;
  269. onion-omega)
  270. status_led="onion:amber:system"
  271. ;;
  272. pb44)
  273. status_led="$board:amber:jump1"
  274. ;;
  275. rb-2011l|\
  276. rb-2011uas|\
  277. rb-2011uas-2hnd)
  278. status_led="rb:green:usr"
  279. ;;
  280. rb-411|\
  281. rb-411u|\
  282. rb-433|\
  283. rb-433u|\
  284. rb-450|\
  285. rb-450g|\
  286. rb-493)
  287. status_led="rb4xx:yellow:user"
  288. ;;
  289. rb-750)
  290. status_led="rb750:green:act"
  291. ;;
  292. rb-911g-2hpnd|\
  293. rb-911g-5hpacd|\
  294. rb-911g-5hpnd|\
  295. rb-912uag-2hpnd|\
  296. rb-912uag-5hpnd)
  297. status_led="rb:green:user"
  298. ;;
  299. rb-951ui-2hnd | rb-941-2nd)
  300. status_led="rb:green:act"
  301. ;;
  302. rb-sxt2n|\
  303. rb-sxt5n)
  304. status_led="rb:green:power"
  305. ;;
  306. re450)
  307. status_led="$board:blue:power"
  308. ;;
  309. routerstation|\
  310. routerstation-pro)
  311. status_led="ubnt:green:rf"
  312. ;;
  313. rw2458n)
  314. status_led="$board:green:d3"
  315. ;;
  316. smart-300)
  317. status_led="nc-link:green:system"
  318. ;;
  319. qihoo-c301)
  320. status_led="qihoo:green:status"
  321. ;;
  322. tellstick-znet-lite)
  323. status_led="tellstick:white:system"
  324. ;;
  325. tew-673gru)
  326. status_led="trendnet:blue:wps"
  327. ;;
  328. tew-712br|\
  329. tew-732br|\
  330. tew-823dru)
  331. status_led="trendnet:green:power"
  332. ;;
  333. tl-mr3020)
  334. status_led="tp-link:green:wps"
  335. ;;
  336. tl-wa750re)
  337. status_led="tp-link:orange:re"
  338. ;;
  339. tl-wa850re)
  340. status_led="tp-link:blue:re"
  341. ;;
  342. tl-wa860re)
  343. status_led="tp-link:green:power"
  344. ;;
  345. tl-mr3220|\
  346. tl-mr3220-v2|\
  347. tl-mr3420|\
  348. tl-mr3420-v2|\
  349. tl-wa701nd-v2|\
  350. tl-wa801nd-v2|\
  351. tl-wa901nd|\
  352. tl-wa901nd-v2|\
  353. tl-wa901nd-v3|\
  354. tl-wa901nd-v4|\
  355. tl-wdr3320-v2|\
  356. tl-wdr3500|\
  357. tl-wr1041n-v2|\
  358. tl-wr1043nd|\
  359. tl-wr1043nd-v2|\
  360. tl-wr1043nd-v4|\
  361. tl-wr741nd|\
  362. tl-wr741nd-v4|\
  363. tl-wa801nd-v3|\
  364. tl-wr841n-v1|\
  365. tl-wr841n-v7|\
  366. tl-wr841n-v8|\
  367. tl-wr841n-v11|\
  368. tl-wa830re-v2|\
  369. tl-wr842n-v2|\
  370. tl-wr842n-v3|\
  371. tl-wr941nd|\
  372. tl-wr941nd-v5)
  373. status_led="tp-link:green:system"
  374. ;;
  375. archer-c5|\
  376. archer-c7|\
  377. tl-wdr4900-v2|\
  378. tl-mr10u|\
  379. tl-mr12u|\
  380. tl-mr13u|\
  381. tl-wdr4300|\
  382. tl-wr703n|\
  383. tl-wr710n|\
  384. tl-wr720n-v3|\
  385. tl-wr802n-v1|\
  386. tl-wr810n|\
  387. tl-wr940n-v4|\
  388. tl-wr941nd-v6)
  389. status_led="tp-link:blue:system"
  390. ;;
  391. tl-wr841n-v9)
  392. status_led="tp-link:green:qss"
  393. ;;
  394. tl-wr2543n)
  395. status_led="tp-link:green:wps"
  396. ;;
  397. tl-wdr6500-v2)
  398. status_led="tp-link:white:system"
  399. ;;
  400. tube2h)
  401. status_led="alfa:green:signal4"
  402. ;;
  403. unifi)
  404. status_led="ubnt:green:dome"
  405. ;;
  406. uap-pro|\
  407. unifiac-lite|\
  408. unifiac-pro)
  409. status_led="ubnt:white:dome"
  410. ;;
  411. unifi-outdoor-plus)
  412. status_led="ubnt:white:front"
  413. ;;
  414. airgateway|\
  415. airgatewaypro)
  416. status_led="ubnt:white:status"
  417. ;;
  418. whr-g301n|\
  419. whr-hp-g300n|\
  420. whr-hp-gn|\
  421. wzr-hp-g300nh)
  422. status_led="buffalo:green:router"
  423. ;;
  424. wlae-ag300n)
  425. status_led="buffalo:green:status"
  426. ;;
  427. r6100|\
  428. wndap360|\
  429. wndr3700|\
  430. wndr3700v4|\
  431. wndr4300|\
  432. wnr2000|\
  433. wnr2000-v3|\
  434. wnr2200|\
  435. wnr612-v2|\
  436. wnr1000-v2|\
  437. wpn824n)
  438. status_led="netgear:green:power"
  439. ;;
  440. wp543)
  441. status_led="$board:green:diag"
  442. ;;
  443. wpj342|\
  444. wpj531|\
  445. wpj558)
  446. status_led="$board:green:sig3"
  447. ;;
  448. wrt400n|\
  449. wrt160nl)
  450. status_led="$board:blue:wps"
  451. ;;
  452. zcn-1523h-2|\
  453. zcn-1523h-5)
  454. status_led="zcn-1523h:amber:init"
  455. ;;
  456. wlr8100)
  457. status_led="sitecom:amber:status"
  458. ;;
  459. esac
  460. }
  461. set_state() {
  462. get_status_led
  463. case "$1" in
  464. preinit)
  465. status_led_blink_preinit
  466. ;;
  467. failsafe)
  468. status_led_blink_failsafe
  469. ;;
  470. preinit_regular)
  471. status_led_blink_preinit_regular
  472. ;;
  473. done)
  474. status_led_on
  475. case $(ar71xx_board_name) in
  476. gl-ar300m)
  477. fw_printenv lc >/dev/null 2>&1 && fw_setenv "bootcount" 0
  478. ;;
  479. qihoo-c301)
  480. local n=$(fw_printenv activeregion | cut -d = -f 2)
  481. fw_setenv "image${n}trynum" 0
  482. ;;
  483. esac
  484. ;;
  485. esac
  486. }