diff --git a/peripheral_manager/src/configs/DG301R0 b/peripheral_manager/src/configs/DG301R0 deleted file mode 100644 index bc419cb79..000000000 --- a/peripheral_manager/src/configs/DG301R0 +++ /dev/null @@ -1,307 +0,0 @@ - -config board 'board' - option hardware 'DG301' - option hasAdsl '1' - option hasVdsl '1' - option hasVoice '1' - option hasDect '1' - option VoicePorts '2' - option VoiceLeds '1' - option hasWifi '1' - option ethernetPorts '5' - option ethernetPortNames 'LAN1 LAN2 LAN3 LAN4 WAN' - option ethernetPortOrder 'eth4 eth3 eth1 eth2 eth0' - option ethernetLanPorts 'eth1 eth2 eth3 eth4' - option ethernetWanPort 'eth0' - option adslWanPort 'atm0' - option vdslWanPort 'ptm0' - option wpsButtonGpio '22' - option fxsRelayGpio '8' - option hasBrcmAvs '0' - -config wifi-chip '435f' - option bands 'b' - -config wifi-chip '43a0' - option bands 'a' - option is_ac '1' - -config wifi-chip '43a2' - option bands 'a' - option is_ac '1' - -config wifi-chip '43bc' - option bands 'a' - option is_ac '1' - option radarthrs '0x6aa 0x30 0x6a8 0x30 0x69c 0x30 0x6aa 0x30 0x6aa 0x30 0x6a2 0x30' - -############################################################################### -# -# Button config, start -# - -############### gpio buttons, driver config -config gpio_button gpio_buttons - list buttons gpio_reset - list buttons gpio_dect - list buttons gpio_wps - list buttons gpio_info - list buttons gpio_eco - -config gpio_button gpio_reset - option addr 32 - option active low - -config gpio_button gpio_dect - option addr 20 - option active low - -config gpio_button gpio_wps - option addr 22 - option active low - -config gpio_button gpio_info - option addr 37 - option active low - -config gpio_button gpio_eco - option addr 36 - option active low - -############### function buttons used on board. -config button_map button_map - list buttonnames RESET - list buttonnames DECT - list buttonnames WPS - list buttonnames INFO - list buttonnames ECO - option minpress 100 - -############### mapping function button to driver button -config button_map RESET - list button gpio_reset - option minpress 5000 - option hotplug resetbutton - -config button_map DECT - list button gpio_dect - option hotplug dectbutton - -config button_map WPS - list button gpio_wps - option hotplug wpsbutton - -config button_map INFO - list button gpio_info - option hotplug infobutton - -config button_map ECO - list button gpio_eco - option hotplug ecobutton - -# -# Button config , end -# -############################################################################### - -############################################################################### -# -# Led config, start -# - -############### gpio led, driver config -config gpio_led gpio_leds - list leds Ethernet_green - list leds Wireless_green - list leds Voice_green - list leds Broadband_green - list leds Status_blue - list leds Status_green - list leds Status_red - list leds Internet_green - list leds Internet_red - list leds DECT_red - list leds DECT_green - list leds TV_green - list leds WPS_green - list leds WPS_red - list leds WAN_yellow - -config gpio_led Ethernet_green - option addr 0 - option active hi - option mode csr - -config gpio_led Wireless_green - option addr 3 - option active hi - option mode csr - -config gpio_led Voice_green - option addr 9 - option active low - option mode direct - -config gpio_led Broadband_green - option addr 6 - option active hi - option mode csr - -config gpio_led Status_blue - option addr 7 - option active hi - option mode csr - -config gpio_led Status_green - option addr 39 - option active low - option mode direct - -config gpio_led Status_red - option addr 38 - option active low - option mode direct - -config gpio_led Internet_green - option addr 5 - option active hi - option mode csr - -config gpio_led Internet_red - option addr 4 - option active hi - option mode csr - -config gpio_led DECT_red - option addr 19 - option active low - option mode direct - -config gpio_led DECT_green - option addr 15 - option active low - option mode direct - -config gpio_led TV_green - option addr 35 - option active low - option mode direct - -config gpio_led WPS_green - option addr 2 - option active hi - option mode csr - -config gpio_led WPS_red - option addr 1 - option active hi - option mode csr - -config gpio_led WAN_yellow - option addr 21 - option active hi - option mode direct - -############### mapping led function to driver led - -config led_map led_dsl - list led_action_ok Broadband_green=ON - list led_action_off Broadband_green=OFF - list led_action_notice Broadband_green=FLASH_SLOW - list led_action_alert Broadband_green=FLASH_SLOW - list led_action_error Broadband_green=FLASH_FAST - -config led_map led_wifi - list led_action_ok Wireless_green=ON - list led_action_off Wireless_green=OFF - list led_action_notice Wireless_green=FLASH_SLOW - list led_action_alert Wireless_green=FLASH_SLOW - list led_action_error Wireless_green=FLASH_FAST - -config led_map led_wps - list led_action_ok 'WPS_green = ON' - list led_action_ok 'WPS_red = OFF' - list led_action_off 'WPS_green = OFF' - list led_action_off 'WPS_red = OFF' - list led_action_notice 'WPS_green = FLASH_SLOW' - list led_action_notice 'WPS_red = OFF' - list led_action_alert 'WPS_green = OFF' - list led_action_alert 'WPS_red = FLASH_SLOW' - list led_action_error 'WPS_green = OFF' - list led_action_error 'WPS_red = FLASH_FAST' - -config led_map led_lan - list led_action_ok Ethernet_green=ON - list led_action_off Ethernet_green=OFF - list led_action_notice Ethernet_green=FLASH_SLOW - list led_action_alert Ethernet_green=FLASH_SLOW - list led_action_error Ethernet_green=FLASH_FAST - -config led_map led_status - list led_action_ok 'Status_green = ON' - list led_action_ok 'Status_red = OFF' - list led_action_ok 'Status_blue = OFF' - - list led_action_off 'Status_green = OFF' - list led_action_off 'Status_red = OFF' - list led_action_off 'Status_blue = OFF' - - list led_action_notice 'Status_green = FLASH_SLOW' - list led_action_notice 'Status_red = OFF' - list led_action_notice 'Status_blue = OFF' - - list led_action_alert 'Status_green = OFF' - list led_action_alert 'Status_red = FLASH_SLOW' - list led_action_alert 'Status_blue = OFF' - - list led_action_error 'Status_green = OFF' - list led_action_error 'Status_red = FLASH_FAST' - list led_action_error 'Status_blue = OFF' - -config led_map led_tv - list led_action_ok TV_green=ON - list led_action_off TV_green=OFF - list led_action_notice TV_green=FLASH_SLOW - list led_action_alert TV_green=FLASH_SLOW - list led_action_error TV_green=FLASH_FAST - -config led_map led_wan - list led_action_off WAN_yellow=OFF - list led_action_alert WAN_yellow=ON - -config led_map led_internet - list led_action_ok 'Internet_green = ON' - list led_action_ok 'Internet_red = OFF' - - list led_action_off 'Internet_green = OFF' - list led_action_off 'Internet_red = OFF' - - list led_action_notice 'Internet_green = FLASH_SLOW' - list led_action_notice 'Internet_red = OFF' - - list led_action_alert 'Internet_green = OFF' - list led_action_alert 'Internet_red = FLASH_SLOW' - - list led_action_error 'Internet_green = OFF' - list led_action_error 'Internet_red = ON' - -config led_map led_voice1 - list led_action_ok Voice_green=ON - list led_action_off Voice_green=OFF - list led_action_notice Voice_green=FLASH_SLOW - list led_action_alert Voice_green=FLASH_SLOW - list led_action_error Voice_green=FLASH_FAST - -config led_map led_eco - list led_action_ok Status_blue=ON - list led_action_off Status_blue=OFF - list led_action_notice Status_blue=FLASH_SLOW - list led_action_alert Status_blue=FLASH_SLOW - list led_action_error Status_blue=FLASH_FAST - -# -# Led config , end -# -############################################################################### - - diff --git a/peripheral_manager/src/ledctl b/peripheral_manager/src/ledctl deleted file mode 100755 index 2e763b390..000000000 --- a/peripheral_manager/src/ledctl +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -name=$1 -status=$2 - - -name=$(echo $name | tr '[A-Z]' '[a-z]') -status=$(echo $status | tr '[A-Z]' '[a-z]') - -case $name in - normal) ubus call leds set '{"state":"normal"}' ;; - proximity) ubus call leds set '{"state":"proximity"}' ;; - test) ubus call leds set '{"state":"test"}' ;; - allon) ubus call leds set '{"state":"allon"}' ;; - alloff) ubus call leds set '{"state":"alloff"}' ;; - production) ubus call leds set '{"state":"production"}' ;; - broadband) db get hw.board.lednames | grep -iq broadband && name="dsl" || exit ;; - ethernet) name="lan" ;; - wireless) name="wifi" ;; - tel*|voice) name="voice1" ;; - video) name="tv" ;; - power) name="status" ;; -esac - -case $status in - on) status="ok" ;; - fail) status="error" ;; - blink) status="notice" ;; -esac - -ubus -s /tmp/ubus.s call led.$name set '{"state":"'$status'"}' & - diff --git a/peripheral_manager/src/src/sfp.c b/peripheral_manager/src/src/sfp.c index 09adca4c2..7848000e8 100644 --- a/peripheral_manager/src/src/sfp.c +++ b/peripheral_manager/src/src/sfp.c @@ -930,7 +930,7 @@ static int sfp_ddm_get_current_method(struct ubus_context *ubus_ctx, struct ubus static int sfp_ddm_get_tx_pwr(struct blob_buf *b, int raw) { float x; - char buf[10]; + char buf[16]; if (!ddm_prepare()) return 0; @@ -944,7 +944,9 @@ static int sfp_ddm_get_tx_pwr(struct blob_buf *b, int raw) } snprintf(buf, sizeof(buf), "%.4f mW", x * (1.0/10000)); blobmsg_add_string(b, "tx-pwr", buf); - + snprintf(buf, sizeof(buf), "%.4f dBm", + 10.0f * log10f(x * 1e-7) + 30.0f); + blobmsg_add_string(b, "tx-pwr-dBm", buf); return 1; } @@ -965,7 +967,7 @@ static int sfp_ddm_get_rx_pwr(struct blob_buf *b, int raw) { unsigned i; float x; - char buf[10]; + char buf[16]; if (!ddm_prepare()) return 0; @@ -988,6 +990,9 @@ static int sfp_ddm_get_rx_pwr(struct blob_buf *b, int raw) snprintf(buf, sizeof(buf), "%.4f mW", x * (1.0/10000)); blobmsg_add_string(b, "rx-pwr", buf); + snprintf(buf, sizeof(buf), "%.4f dBm", + 10.0 * log10(x * 1e-7) + 30.0); + blobmsg_add_string(b, "rx-pwr-dBm", buf); blobmsg_add_string(b, "rx-pwr-type", (sfp_ddm.type & 8) ? "average" : "OMA"); return 1; diff --git a/peripheral_manager/src/src/vox.c b/peripheral_manager/src/src/vox.c index 2045f0606..9ac6daa5a 100644 --- a/peripheral_manager/src/src/vox.c +++ b/peripheral_manager/src/src/vox.c @@ -121,7 +121,9 @@ void vox_init(struct server_ctx *s_ctx) { /* if config entries for vox leds exist register the spi as used. */ if(register_spi) { - board_ioctl(BOARD_IOCTL_SPI_INIT, SPI_SLAVE_SELECT, 0, 0, 0, 391000); + /* arg 4 is the spi mode encoded in a string pointer */ + /* mode is decribed i/bcm963xx/shared/opensource/include/bcm963xx/bcmSpiRes.h */ + board_ioctl(BOARD_IOCTL_SPI_INIT, SPI_SLAVE_SELECT, 0, (char*)0, 0, 391000); gpio_open_ioctl(); } } diff --git a/peripheral_manager/src/src/vox_test.c b/peripheral_manager/src/src/vox_test.c index 9a59c7343..540ddc23c 100644 --- a/peripheral_manager/src/src/vox_test.c +++ b/peripheral_manager/src/src/vox_test.c @@ -76,7 +76,9 @@ int pos; void display(void){ printf("\r"); - printf("%02x %02x %02x %02x \r", + printf("%02x %02x %02x %02x %02x %02x \r", + spi_data[0], + spi_data[1], spi_data[2], spi_data[3], spi_data[4], @@ -93,7 +95,7 @@ void display(void){ void inc(void){ - int byte = 2 + pos/2; + int byte = pos/2; int nibble = pos%2; int val_hi = (spi_data[byte] >> 4 ) & 0xF; @@ -113,7 +115,7 @@ void inc(void){ } void dec(void){ - int byte = 2 + pos/2; + int byte = pos/2; int nibble = pos%2; int val_hi = (spi_data[byte] >> 4 ) & 0xF; @@ -137,7 +139,9 @@ int main(int argc, char *argv[]) int ch; gpio_open_ioctl(); - board_ioctl(BOARD_IOCTL_SPI_INIT, SPI_SLAVE_SELECT, 0, 0, 0, 391000); + /* arg 4 is the spi mode encoded in a string pointer */ + /* mode is decribed i/bcm963xx/shared/opensource/include/bcm963xx/bcmSpiRes.h */ + board_ioctl(BOARD_IOCTL_SPI_INIT, SPI_SLAVE_SELECT, 0, (char *)0, 0, 391000); set_conio_terminal_mode(); fflush(stdout); @@ -147,8 +151,8 @@ int main(int argc, char *argv[]) /* right */ if (ch == 4414235) { pos++; - if (pos > 7) - pos = 7; + if (pos > 11) + pos = 11; } /* left */ if (ch == 4479771) {