diag.sh 6.5 KB

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