qcdm: some devices do implement SW_VERSION
Like the MF627 for some reason. Also, the format appears to be more like the DM_CMD_VERSION_INFO response where at least the comp_date and comp_time fields are the same size as VERSION_INFO, just with some padding between.
This commit is contained in:
@@ -456,7 +456,7 @@ qcdm_cmd_sw_version_result (const char *buf, size_t len, int *out_error)
|
|||||||
{
|
{
|
||||||
QcdmResult *result = NULL;
|
QcdmResult *result = NULL;
|
||||||
DMCmdSwVersionRsp *rsp = (DMCmdSwVersionRsp *) buf;
|
DMCmdSwVersionRsp *rsp = (DMCmdSwVersionRsp *) buf;
|
||||||
char tmp[25];
|
char tmp[32];
|
||||||
|
|
||||||
qcdm_return_val_if_fail (buf != NULL, NULL);
|
qcdm_return_val_if_fail (buf != NULL, NULL);
|
||||||
|
|
||||||
|
@@ -311,9 +311,11 @@ typedef struct DMCmdStatusRsp DMCmdStatusRsp;
|
|||||||
/* DIAG_CMD_SW_VERSION */
|
/* DIAG_CMD_SW_VERSION */
|
||||||
struct DMCmdSwVersionRsp {
|
struct DMCmdSwVersionRsp {
|
||||||
u_int8_t code;
|
u_int8_t code;
|
||||||
char version[20];
|
char version[31];
|
||||||
char comp_date[11];
|
char comp_date[11];
|
||||||
|
u_int8_t _unknown1[2];
|
||||||
char comp_time[8];
|
char comp_time[8];
|
||||||
|
u_int8_t _unknown2[2];
|
||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
typedef struct DMCmdSwVersionRsp DMCmdSwVersionRsp;
|
typedef struct DMCmdSwVersionRsp DMCmdSwVersionRsp;
|
||||||
|
|
||||||
|
@@ -833,6 +833,7 @@ test_com_sw_version (void *f, void *data)
|
|||||||
gint len;
|
gint len;
|
||||||
QcdmResult *result;
|
QcdmResult *result;
|
||||||
gsize reply_len;
|
gsize reply_len;
|
||||||
|
const char *str;
|
||||||
|
|
||||||
len = qcdm_cmd_sw_version_new (buf, sizeof (buf));
|
len = qcdm_cmd_sw_version_new (buf, sizeof (buf));
|
||||||
g_assert (len == 4);
|
g_assert (len == 4);
|
||||||
@@ -846,12 +847,11 @@ test_com_sw_version (void *f, void *data)
|
|||||||
|
|
||||||
/* Parse the response into a result structure */
|
/* Parse the response into a result structure */
|
||||||
result = qcdm_cmd_sw_version_result (buf, reply_len, &err);
|
result = qcdm_cmd_sw_version_result (buf, reply_len, &err);
|
||||||
|
if (!result) {
|
||||||
|
g_assert_cmpint (err, ==, -QCDM_ERROR_RESPONSE_BAD_COMMAND);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Recent devices don't appear to implement this command */
|
|
||||||
g_assert (result == NULL);
|
|
||||||
g_assert_cmpint (err, ==, -QCDM_ERROR_RESPONSE_BAD_COMMAND);
|
|
||||||
|
|
||||||
/*
|
|
||||||
str = NULL;
|
str = NULL;
|
||||||
qcdm_result_get_string (result, QCDM_CMD_SW_VERSION_ITEM_VERSION, &str);
|
qcdm_result_get_string (result, QCDM_CMD_SW_VERSION_ITEM_VERSION, &str);
|
||||||
g_message ("%s: SW Version: %s", __func__, str);
|
g_message ("%s: SW Version: %s", __func__, str);
|
||||||
@@ -865,7 +865,6 @@ test_com_sw_version (void *f, void *data)
|
|||||||
g_message ("%s: Compiled Time: %s", __func__, str);
|
g_message ("%s: Compiled Time: %s", __func__, str);
|
||||||
|
|
||||||
qcdm_result_unref (result);
|
qcdm_result_unref (result);
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
Reference in New Issue
Block a user