qcdm: add qcdm_cmd_control_new() to set operating mode

This commit is contained in:
Dan Williams
2012-09-27 10:55:20 -05:00
parent 1b5804895f
commit fb65cba607
3 changed files with 55 additions and 0 deletions

View File

@@ -365,6 +365,35 @@ qcdm_cmd_esn_result (const char *buf, size_t len, int *out_error)
/**********************************************************************/
size_t
qcdm_cmd_control_new (char *buf, size_t len, u_int8_t mode)
{
char cmdbuf[5];
DMCmdControl *cmd = (DMCmdControl *) &cmdbuf[0];
qcdm_return_val_if_fail (buf != NULL, 0);
qcdm_return_val_if_fail (len >= sizeof (*cmd) + DIAG_TRAILER_LEN, 0);
memset (cmd, 0, sizeof (*cmd));
cmd->code = DIAG_CMD_CONTROL;
cmd->mode = htole16 ((u_int16_t) mode);
return dm_encapsulate_buffer (cmdbuf, sizeof (*cmd), sizeof (cmdbuf), buf, len);
}
QcdmResult *
qcdm_cmd_control_result (const char *buf, size_t len, int *out_error)
{
qcdm_return_val_if_fail (buf != NULL, NULL);
if (!check_command (buf, len, DIAG_CMD_CONTROL, sizeof (DMCmdControl), out_error))
return NULL;
return qcdm_result_new ();
}
/**********************************************************************/
size_t
qcdm_cmd_cdma_status_new (char *buf, size_t len)
{

View File

@@ -92,6 +92,19 @@ QcdmResult *qcdm_cmd_esn_result (const char *buf,
/**********************************************************************/
enum {
QCDM_CMD_CONTROL_MODE_OFFLINE = 1,
QCDM_CMD_CONTROL_MODE_RESET = 2,
};
size_t qcdm_cmd_control_new (char *buf, size_t len, u_int8_t mode);
QcdmResult *qcdm_cmd_control_result (const char *buf,
size_t len,
int *out_error);
/**********************************************************************/
/* Values for QCDM_CMD_CDMA_STATUS_ITEM_RF_MODE */
enum {
QCDM_CMD_CDMA_STATUS_RF_MODE_ANALOG = 0,

View File

@@ -246,6 +246,19 @@ struct DMCmdSubsysHeader {
} __attribute__ ((packed));
typedef struct DMCmdSubsysHeader DMCmdSubsysHeader;
typedef enum {
DM_CONTROL_MODE_OFFLINE = 1,
DM_CONTROL_MODE_RESET = 2,
} DMControlMode;
/* DIAG_CMD_CONTROL */
struct DMCmdControl {
u_int8_t code;
/* DMControlMode */
u_int16_t mode;
} __attribute__ ((packed));
typedef struct DMCmdControl DMCmdControl;
/* DIAG_CMD_NV_READ / DIAG_CMD_NV_WRITE */
struct DMCmdNVReadWrite {
u_int8_t code;