mirror of
git://git.openwrt.org/openwrt/openwrt.git
synced 2024-12-12 01:44:54 +00:00
ltq-vdsl-app: prepare for multiple mei ioctls
Refactor so that the outer function opens and closes the mei fd and passes it around, just as with the main fd. That also allows us to use the IOCTL macro in get_vector_status() and clean up accordingly. Switch to AUTORELEASE while at it. Signed-off-by: Andre Heider <a.heider@gmail.com>
This commit is contained in:
parent
1d2bc94f78
commit
276c80bdc0
@ -9,7 +9,7 @@ include $(INCLUDE_DIR)/kernel.mk
|
|||||||
|
|
||||||
PKG_NAME:=ltq-vdsl-app
|
PKG_NAME:=ltq-vdsl-app
|
||||||
PKG_VERSION:=4.17.18.6
|
PKG_VERSION:=4.17.18.6
|
||||||
PKG_RELEASE:=9
|
PKG_RELEASE:=$(AUTORELEASE)
|
||||||
PKG_BASE_NAME:=dsl_cpe_control
|
PKG_BASE_NAME:=dsl_cpe_control
|
||||||
PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
|
PKG_SOURCE:=$(PKG_BASE_NAME)_vrx-$(PKG_VERSION).tar.gz
|
||||||
PKG_SOURCE_URL:=@OPENWRT
|
PKG_SOURCE_URL:=@OPENWRT
|
||||||
|
@ -477,32 +477,28 @@ static void g997_xtu_system_enabling(int fd, standard_t *standard) {
|
|||||||
m_str("standard", str);
|
m_str("standard", str);
|
||||||
}
|
}
|
||||||
|
|
||||||
static vector_t get_vector_status() {
|
static void get_vector_status(int fd, vector_t *status) {
|
||||||
|
*status = VECTOR_UNKNOWN;
|
||||||
|
|
||||||
#ifdef INCLUDE_DSL_CPE_API_VRX
|
#ifdef INCLUDE_DSL_CPE_API_VRX
|
||||||
int fd = open(DSL_CPE_DSL_LOW_DEV "/0", O_RDWR, 0644);
|
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return VECTOR_UNKNOWN;
|
return;
|
||||||
|
|
||||||
IOCTL_MEI_dsmStatus_t out;
|
IOCTL(IOCTL_MEI_dsmStatus_t, FIO_MEI_DSM_STATUS_GET);
|
||||||
memset(&out, 0, sizeof(IOCTL_MEI_dsmStatus_t));
|
|
||||||
int ret = ioctl(fd, FIO_MEI_DSM_STATUS_GET, &out);
|
|
||||||
close(fd);
|
|
||||||
|
|
||||||
if (ret)
|
|
||||||
return VECTOR_UNKNOWN;
|
|
||||||
|
|
||||||
switch (out.eVectorStatus) {
|
switch (out.eVectorStatus) {
|
||||||
case e_MEI_VECTOR_STAT_OFF:
|
case e_MEI_VECTOR_STAT_OFF:
|
||||||
return VECTOR_OFF;
|
*status = VECTOR_OFF;
|
||||||
|
break;
|
||||||
case e_MEI_VECTOR_STAT_ON_DS:
|
case e_MEI_VECTOR_STAT_ON_DS:
|
||||||
return VECTOR_ON_DS;
|
*status = VECTOR_ON_DS;
|
||||||
|
break;
|
||||||
case e_MEI_VECTOR_STAT_ON_DS_US:
|
case e_MEI_VECTOR_STAT_ON_DS_US:
|
||||||
return VECTOR_ON_DS_US;
|
*status = VECTOR_ON_DS_US;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return VECTOR_UNKNOWN;
|
break;
|
||||||
};
|
};
|
||||||
#else
|
|
||||||
return VECTOR_UNKNOWN;
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,7 +716,7 @@ static int metrics(struct ubus_context *ctx, struct ubus_object *obj,
|
|||||||
struct ubus_request_data *req, const char *method,
|
struct ubus_request_data *req, const char *method,
|
||||||
struct blob_attr *msg)
|
struct blob_attr *msg)
|
||||||
{
|
{
|
||||||
int fd;
|
int fd, fd_mei;
|
||||||
void *c, *c2;
|
void *c, *c2;
|
||||||
standard_t standard = STD_UNKNOWN;
|
standard_t standard = STD_UNKNOWN;
|
||||||
profile_t profile = PROFILE_UNKNOWN;
|
profile_t profile = PROFILE_UNKNOWN;
|
||||||
@ -734,6 +730,12 @@ static int metrics(struct ubus_context *ctx, struct ubus_object *obj,
|
|||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return UBUS_STATUS_UNKNOWN_ERROR;
|
return UBUS_STATUS_UNKNOWN_ERROR;
|
||||||
|
|
||||||
|
#ifdef INCLUDE_DSL_CPE_API_VRX
|
||||||
|
fd_mei = open(DSL_CPE_DSL_LOW_DEV "/0", O_RDWR, 0644);
|
||||||
|
#else
|
||||||
|
fd_mei = -1;
|
||||||
|
#endif
|
||||||
|
|
||||||
blob_buf_init(&b, 0);
|
blob_buf_init(&b, 0);
|
||||||
|
|
||||||
version_information(fd);
|
version_information(fd);
|
||||||
@ -749,7 +751,7 @@ static int metrics(struct ubus_context *ctx, struct ubus_object *obj,
|
|||||||
|
|
||||||
if (standard == STD_G_993_2) {
|
if (standard == STD_G_993_2) {
|
||||||
band_plan_status(fd, &profile);
|
band_plan_status(fd, &profile);
|
||||||
vector = get_vector_status();
|
get_vector_status(fd_mei, &vector);
|
||||||
}
|
}
|
||||||
|
|
||||||
describe_mode(standard, profile, vector);
|
describe_mode(standard, profile, vector);
|
||||||
@ -803,6 +805,8 @@ static int metrics(struct ubus_context *ctx, struct ubus_object *obj,
|
|||||||
|
|
||||||
ubus_send_reply(ctx, req, b.head);
|
ubus_send_reply(ctx, req, b.head);
|
||||||
|
|
||||||
|
if (fd_mei >= 0)
|
||||||
|
close(fd_mei);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user