add detection for the class field in the TP-DCS octet
authorFelix Fietkau <nbd@openwrt.org>
Mon, 18 Feb 2013 22:57:37 +0000 (23:57 +0100)
committerFelix Fietkau <nbd@openwrt.org>
Mon, 18 Feb 2013 22:57:37 +0000 (23:57 +0100)
commands-wms.c

index 9e28f655284024c45c6ec2765fbebb32b26a1c3b..296f5fb4f3e208c55a51fcf788c039ebc41226ab 100644 (file)
@@ -156,7 +156,7 @@ static void cmd_wms_get_message_cb(struct qmi_dev *qmi, struct qmi_request *req,
        char *str;
        int i, cur_len;
        bool sent;
-       unsigned char first;
+       unsigned char first, dcs;
 
        qmi_parse_wms_raw_read_response(msg, &res);
        data = (unsigned char *) res.data.raw_message_data.raw_data;
@@ -197,9 +197,15 @@ static void cmd_wms_get_message_cb(struct qmi_dev *qmi, struct qmi_request *req,
                return;
 
        /* Data Encoding */
-       if (*(data++) != 0)
+       dcs = *(data++);
+
+       /* only 7-bit encoding supported for now */
+       if (dcs & 0x0c)
                return;
 
+       if (dcs & 0x10)
+               blobmsg_add_u32(&status, "class", (dcs & 3));
+
        if (sent) {
                /* Message validity */
                data++;