mirror of
https://github.com/linux-msm/diag.git
synced 2026-02-25 13:11:48 -08:00
diag: router: Add handling of Event Report Control command (cmd_id=96)
Implemented and registered a handler for the Event Report Control command request. Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org> [bjorn: Moved implementation to common_cmds.c, removed uncessary error handling of unkown status values, use return value to return bad command errors] Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This commit is contained in:
committed by
Bjorn Andersson
parent
b06f733fbb
commit
2dfd76ed2b
@@ -71,6 +71,8 @@ struct diag_log_cmd_mask {
|
||||
|
||||
#define DIAG_CMD_SET_MASK 0x82
|
||||
|
||||
#define DIAG_CMD_EVENT_REPORT_CONTROL 0x60
|
||||
|
||||
static int handle_logging_configuration(struct diag_client *client,
|
||||
const void *buf, size_t len)
|
||||
{
|
||||
@@ -540,10 +542,37 @@ static int handle_event_set_mask(struct diag_client *client,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int handle_event_report_control(struct diag_client *client,
|
||||
const void *buf, size_t len)
|
||||
{
|
||||
const struct {
|
||||
uint8_t cmd_code;
|
||||
uint8_t operation_switch;
|
||||
} __packed *req = buf;
|
||||
struct {
|
||||
uint8_t cmd_code;
|
||||
uint16_t length;
|
||||
} __packed pkt;
|
||||
|
||||
if (sizeof(*req) != len)
|
||||
return -EMSGSIZE;
|
||||
|
||||
diag_cmd_toggle_events(!!req->operation_switch);
|
||||
peripheral_broadcast_event_mask();
|
||||
|
||||
pkt.cmd_code = DIAG_CMD_EVENT_REPORT_CONTROL;
|
||||
pkt.length = 0;
|
||||
|
||||
hdlc_enqueue(&client->outq, &pkt, sizeof(pkt));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void register_common_cmds(void)
|
||||
{
|
||||
register_common_cmd(DIAG_CMD_LOGGING_CONFIGURATION, handle_logging_configuration);
|
||||
register_common_cmd(DIAG_CMD_EXTENDED_MESSAGE_CONFIGURATION, handle_extended_message_configuration);
|
||||
register_common_cmd(DIAG_CMD_GET_MASK, handle_event_get_mask);
|
||||
register_common_cmd(DIAG_CMD_SET_MASK, handle_event_set_mask);
|
||||
register_common_cmd(DIAG_CMD_EVENT_REPORT_CONTROL, handle_event_report_control);
|
||||
}
|
||||
|
||||
9
masks.c
9
masks.c
@@ -588,11 +588,10 @@ int diag_cmd_update_event_mask(uint16_t num_bits, const uint8_t *mask)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void diag_cmd_toggle_events(uint8_t operation)
|
||||
void diag_cmd_toggle_events(bool enabled)
|
||||
{
|
||||
if (operation == DIAG_CTRL_MASK_ALL_DISABLED) {
|
||||
memset(event_mask.ptr, 0xFF, event_mask.mask_len);
|
||||
} else if (operation == DIAG_CTRL_MASK_ALL_ENABLED) {
|
||||
if (enabled)
|
||||
memset(event_mask.ptr, 0x00, event_mask.mask_len);
|
||||
}
|
||||
else
|
||||
memset(event_mask.ptr, 0xff, event_mask.mask_len);
|
||||
}
|
||||
|
||||
2
masks.h
2
masks.h
@@ -144,6 +144,6 @@ void diag_cmd_set_all_msg_mask(uint32_t mask);
|
||||
uint8_t diag_get_event_mask_status();
|
||||
int diag_cmd_get_event_mask(uint16_t num_bits, uint8_t **mask);
|
||||
int diag_cmd_update_event_mask(uint16_t num_bits, const uint8_t *mask);
|
||||
void diag_cmd_toggle_events(uint8_t operation);
|
||||
void diag_cmd_toggle_events(bool enabled);
|
||||
|
||||
#endif /* MASKS_H_ */
|
||||
|
||||
Reference in New Issue
Block a user