diag.sh 7.6 KB

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