dsl_control 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/bin/sh /etc/rc.common
  2. # Copyright (C) 2012 OpenWrt.org
  3. START=49
  4. EXTRA_COMMANDS="status lucistat"
  5. EXTRA_HELP=" status Get DSL status information
  6. lucistat Get status information if lua friendly format"
  7. SERVICE_DAEMONIZE=1
  8. SERVICE_WRITE_PID=1
  9. [ -f /lib/functions/lantiq_dsl.sh ] && . /lib/functions/lantiq_dsl.sh
  10. annex_b=10_00_10_00_00_04_00_00
  11. annex_bdmt=10_00_00_00_00_00_00_00
  12. annex_b2=00_00_10_00_00_00_00_00
  13. annex_b2p=00_00_00_00_00_04_00_00
  14. annex_a=05_01_04_00_4C_01_04_00
  15. annex_at1=01_00_00_00_00_00_00_00
  16. annex_alite=00_01_00_00_00_00_00_00
  17. annex_admt=04_00_00_00_00_00_00_00
  18. annex_a2=00_00_04_00_00_00_00_00
  19. annex_a2p=00_00_00_00_00_01_00_00
  20. annex_l=00_00_00_00_0C_00_00_00
  21. annex_m=00_00_00_00_40_00_04_00
  22. annex_m2=00_00_00_00_40_00_00_00
  23. annex_m2p=00_00_00_00_00_00_04_00
  24. annex_j=10_00_10_40_00_04_01_00
  25. start() {
  26. local annex
  27. local firmware
  28. local xtu
  29. config_load network
  30. config_get annex dsl annex
  31. config_get firmware dsl firmware
  32. eval "xtu=\"\${annex_$annex}\""
  33. [ -z "${firmware}" ] &&
  34. firmware=/lib/firmware/adsl.bin
  35. [ -f "${firmware}" ] || {
  36. echo failed to find $firmware
  37. return 1
  38. }
  39. esi $(printf '%012X' $((1+0x$(tr -d : </sys/class/net/eth0/address))))
  40. service_start /sbin/dsl_cpe_control -i${xtu} \
  41. -n /sbin/dsl_notify.sh \
  42. -f ${firmware}
  43. }
  44. stop() {
  45. DSL_NOTIFICATION_TYPE="DSL_INTERFACE_STATUS" \
  46. DSL_INTERFACE_STATUS="DOWN" \
  47. /sbin/dsl_notify.sh
  48. service_stop /sbin/dsl_cpe_control
  49. }