diff --git a/common.c b/common.c
index b4a0b8e23b6badee81e4f1e47173382ea2d7a9be..1d44ec3708b22422ec3c90e40d2c2b3df8e4f297 100644
--- a/common.c
+++ b/common.c
@@ -152,13 +152,13 @@ fail:
return -1;
}
-int pin_status(struct blob_buf *bb, char *ip_addr)
+int pin_status(struct blob_buf *bb, struct device *dev)
{
struct json_object *response, *rv_json;
const char *rv;
int pin_status;
- response = mobile_get_pin_status_zte(ip_addr);
+ response = mobile_get_pin_status(dev);
if (!response) {
debug_print("no response from get_pin_status!\n");
goto fail_response;
diff --git a/common.h b/common.h
index d96ebcf6ff163f63f588b539d16ef033bda6db07..7a7b6ad0be1f4d3db3c5c3d8707f1fa03aad949e 100644
--- a/common.h
+++ b/common.h
@@ -80,6 +80,6 @@ struct json_object *xml_to_json_converter(struct write_result *result);
int isdigits(const char *pin);
int validate_puk_format(char *puk);
int validate_pin_format(char *pin);
-int pin_status(struct blob_buf *bb, char *ip_addr);
+int pin_status(struct blob_buf *bb, struct device *dev);
int check_response(struct json_object *response);
#endif
diff --git a/dongle_infrastructure.c b/dongle_infrastructure.c
index 6277856fc45ab072c4f4c243fa0f0c90f1fae73c..33f40a28cf3386097c41e59c4879a31bcbaee752 100644
--- a/dongle_infrastructure.c
+++ b/dongle_infrastructure.c
@@ -126,13 +126,14 @@ int disable_pin(struct ubus_context *ctx, struct ubus_object *obj,
goto fail_input;
}
pin = (char *)blobmsg_data(tb[PIN]);
+
rv = validate_pin_format(pin);
if (rv < 0) {
debug_print("invalid pin format!\n");
goto fail_input;
}
- if (!pin_status(&bb, global_dev->ip)) {
+ if (!pin_status(&bb, global_dev)) {
ubus_send_reply(ctx, req, bb.head);
debug_print("pin already disabled!\n");
goto disabled;
diff --git a/libmobile_wrapper.c b/libmobile_wrapper.c
index 9232d78d7194f296d4d58cd3dc508967b197b3f3..b0a20ce3449e3cae9790e1ce8415140238b941d6 100644
--- a/libmobile_wrapper.c
+++ b/libmobile_wrapper.c
@@ -179,3 +179,13 @@ struct json_object *mobile_get_roam_status(struct device *dev)
return NULL;
}
+
+struct json_object *mobile_get_pin_status(struct device *dev)
+{
+ if (strcmp(dev->usb.if_name, "usb0") == 0)
+ return mobile_get_pin_status_zte(dev->ip);
+ else if (strcmp(dev->usb.if_name, "eth5") == 0)
+ return mobile_get_pin_status_hilink();
+
+ return NULL;
+}
\ No newline at end of file
diff --git a/libmobile_wrapper.h b/libmobile_wrapper.h
index ab20e06372ec074194a27beed86d493d1583596e..d2dac90429e1ab67c3516abf03ac27847b111ec7 100644
--- a/libmobile_wrapper.h
+++ b/libmobile_wrapper.h
@@ -34,4 +34,5 @@ struct json_object *mobile_set_apn_profile(struct device *dev, char *name);
struct json_object *mobile_create_apn_profile(struct device *dev, char *profile_name, char *wan_apn, char *pdp_type);
struct json_object *mobile_get_current_apn(struct device *dev);
struct json_object *mobile_get_rssi(struct device *dev);
+struct json_object *mobile_get_pin_status(struct device *dev);
#endif
\ No newline at end of file