1
0

diag.sh 7.5 KB

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