From b0cca708b3a37f32d27ce8926e1d3e5f977848d2 Mon Sep 17 00:00:00 2001 From: lefranc Date: Mon, 15 Feb 2010 09:50:11 +0000 Subject: cleo/plcd: add DRV_STA_SET_CONFIG, closes #1240 git-svn-id: svn+ssh://pessac/svn/cesar/trunk@6724 017c9cb6-072f-447c-8318-d5b54f68fe89 --- cleopatre/devkit/plcd/inc/plcd.h | 3 +++ cleopatre/devkit/plcd/src/hpav.c | 48 ++++++++++++++++++++++++++++++++++++++++ cleopatre/devkit/plcd/src/plcd.c | 1 + 3 files changed, 52 insertions(+) (limited to 'cleopatre/devkit') diff --git a/cleopatre/devkit/plcd/inc/plcd.h b/cleopatre/devkit/plcd/inc/plcd.h index c1d270680b..058abc4704 100644 --- a/cleopatre/devkit/plcd/inc/plcd.h +++ b/cleopatre/devkit/plcd/inc/plcd.h @@ -36,6 +36,7 @@ #define MME_TYPE_DRV_STA_SET_KEY 0xb040 #define MME_TYPE_DRV_STA_GET_KEY 0xb044 #define MME_TYPE_DRV_STA_SET_DAK 0xb048 +#define MME_TYPE_DRV_STA_SET_CONFIG 0xb04c #define MME_TYPE_REQ 0x0000 #define MME_TYPE_CNF 0x0001 @@ -87,6 +88,8 @@ typedef struct { char *hpav_info_path; /** path of HP AV config file */ char *hpav_conf_path; + /** path of interna config file */ + char *internal_conf_path; /** netlink socket descriptor for PLC driver comm */ int plc_sock; /** plcd netlink address descriptor for PLC driver comm */ diff --git a/cleopatre/devkit/plcd/src/hpav.c b/cleopatre/devkit/plcd/src/hpav.c index 8d57d7ae1a..7cfae42120 100644 --- a/cleopatre/devkit/plcd/src/hpav.c +++ b/cleopatre/devkit/plcd/src/hpav.c @@ -276,6 +276,47 @@ int hpav_send_tonemask (const plcd_ctx_t *plcd_ctx, const unsigned char *tonemas return hpav_send_single_value (plcd_ctx, MME_TYPE_DRV_STA_SET_TONEMASK, tonemask, 192); } +int hpav_send_internal (const plcd_ctx_t *plcd_ctx) +{ + char key[LIBSPID_KEY_MAX_LEN + 1]; + char *value[1], line_buffer[LIBSPID_LINE_MAX_LEN], mme_buffer[1400]; + int elt_number, result; + mme_buffer[0] = '\0'; + *key = '\0'; + + elt_number = 1; + /* get 1st key value */ + if((result = libspid_config_read_line (plcd_ctx->internal_conf_path, "= \t", key, &elt_number, value, line_buffer, LIBSPID_LINE_MAX_LEN)) < 0) + return 0; + + /* get all items */ + while(strlen (key) > 0) + { + elt_number = 1; + /* push label into buffer */ + strcat (mme_buffer, key); + strcat (mme_buffer, ":"); + /* get value */ + if((result = libspid_config_read_line (plcd_ctx->internal_conf_path, "= \t", key, &elt_number, value, line_buffer, LIBSPID_LINE_MAX_LEN)) < 0) + { + syslog (LOG_WARNING, "wrong config format: %s", key); + return 0; + } + if(elt_number != 1) + continue; + /* push value into buffer */ + strcat (mme_buffer, value[0]); + strcat (mme_buffer, " "); + } + /* replace last space by a NULL char */ + mme_buffer[strlen (mme_buffer) - 1] = '\0'; + + //syslog (LOG_WARNING, "buffer='%s'", mme_buffer); + + /* send MME */ + return (hpav_send_single_value (plcd_ctx, MME_TYPE_DRV_STA_SET_CONFIG, mme_buffer, strlen (mme_buffer))); +} + int hpav_send_start (const plcd_ctx_t *plcd_ctx) { return hpav_send_single_value (plcd_ctx, MME_TYPE_DRV_STA_MAC_START, NULL, 0); @@ -362,6 +403,13 @@ int hpav_init (plcd_ctx_t *plcd_ctx) if(0 > hpav_send_tonemask (plcd_ctx, plcd_ctx->nvram->tonemask)) return -1; + /* send internals config parameters */ + if(0 > hpav_send_internal (plcd_ctx)) + { + syslog (LOG_WARNING, "abort due to wrong internal.conf format"); + return -1; + } + /* start the AV stack */ if(0 > hpav_send_start (plcd_ctx)) return -1; diff --git a/cleopatre/devkit/plcd/src/plcd.c b/cleopatre/devkit/plcd/src/plcd.c index 004f790901..95cc2bc18b 100644 --- a/cleopatre/devkit/plcd/src/plcd.c +++ b/cleopatre/devkit/plcd/src/plcd.c @@ -68,6 +68,7 @@ int plcd_init (plcd_ctx_t *ctx) ctx->hardware_info_path = LIBSPID_HARDWARE_INFO_PATH; ctx->hpav_info_path = LIBSPID_HPAV_INFO_PATH; ctx->hpav_conf_path = LIBSPID_HPAV_CONF_PATH; + ctx->internal_conf_path = LIBSPID_INTERNAL_CONF_PATH; init_info_file (ctx); -- cgit v1.2.3