qcdm: add qcdm_cmd_control_new() to set operating mode
This commit is contained in:
@@ -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
|
size_t
|
||||||
qcdm_cmd_cdma_status_new (char *buf, size_t len)
|
qcdm_cmd_cdma_status_new (char *buf, size_t len)
|
||||||
{
|
{
|
||||||
|
@@ -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 */
|
/* Values for QCDM_CMD_CDMA_STATUS_ITEM_RF_MODE */
|
||||||
enum {
|
enum {
|
||||||
QCDM_CMD_CDMA_STATUS_RF_MODE_ANALOG = 0,
|
QCDM_CMD_CDMA_STATUS_RF_MODE_ANALOG = 0,
|
||||||
|
@@ -246,6 +246,19 @@ struct DMCmdSubsysHeader {
|
|||||||
} __attribute__ ((packed));
|
} __attribute__ ((packed));
|
||||||
typedef struct DMCmdSubsysHeader DMCmdSubsysHeader;
|
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 */
|
/* DIAG_CMD_NV_READ / DIAG_CMD_NV_WRITE */
|
||||||
struct DMCmdNVReadWrite {
|
struct DMCmdNVReadWrite {
|
||||||
u_int8_t code;
|
u_int8_t code;
|
||||||
|
Reference in New Issue
Block a user