Lines Matching refs:cmd
499 struct MsgCmd *cmd; in setLeftyMode() local
506 cmd = (struct MsgCmd *)malloc(sizeof(struct MsgCmd) + sizeof(bool)); in setLeftyMode()
508 if (cmd) { in setLeftyMode()
509 cmd->evtType = EVT_APP_FROM_HOST; in setLeftyMode()
510 cmd->msg.appId = APP_ID_MAKE(APP_ID_VENDOR_GOOGLE, APP_ID_APP_GAZE_DETECT); in setLeftyMode()
511 cmd->msg.dataLen = sizeof(bool); in setLeftyMode()
512 memcpy((bool *)(cmd+1), &enable, sizeof(bool)); in setLeftyMode()
514 ret = sendCmd(cmd, sizeof(*cmd) + sizeof(bool)); in setLeftyMode()
515 if (ret == sizeof(*cmd) + sizeof(bool)) in setLeftyMode()
522 cmd->msg.appId = APP_ID_MAKE(APP_ID_VENDOR_GOOGLE, APP_ID_APP_UNGAZE_DETECT); in setLeftyMode()
524 ret = sendCmd(cmd, sizeof(*cmd) + sizeof(bool)); in setLeftyMode()
525 if (ret == sizeof(*cmd) + sizeof(bool)) in setLeftyMode()
532 cmd->msg.appId = APP_ID_MAKE(APP_ID_VENDOR_GOOGLE, APP_ID_APP_WRIST_TILT_DETECT); in setLeftyMode()
534 ret = sendCmd(cmd, sizeof(*cmd) + sizeof(bool)); in setLeftyMode()
535 if (ret == sizeof(*cmd) + sizeof(bool)) in setLeftyMode()
542 free(cmd); in setLeftyMode()
1005 struct ConfigCmd cmd; in restoreSensorState() local
1007 initConfigCmd(&cmd, i); in restoreSensorState()
1010 … cmd.sensorType, i, mSensorState[i].enable, frequency_q10_to_period_ns(mSensorState[i].rate), in restoreSensorState()
1013 int ret = sendCmd(&cmd, sizeof(cmd)); in restoreSensorState()
1014 if (ret != sizeof(cmd)) { in restoreSensorState()
1015 ALOGW("failed to send config command to restore sensor %d\n", cmd.sensorType); in restoreSensorState()
1018 cmd.cmd = CONFIG_CMD_FLUSH; in restoreSensorState()
1022 int ret = sendCmd(&cmd, sizeof(cmd)); in restoreSensorState()
1023 if (ret != sizeof(cmd)) { in restoreSensorState()
1024 ALOGW("failed to send flush command to sensor %d\n", cmd.sensorType); in restoreSensorState()
1552 void HubConnection::initConfigCmd(struct ConfigCmd *cmd, int handle) in initConfigCmd() argument
1554 memset(cmd, 0x00, sizeof(*cmd)); in initConfigCmd()
1556 cmd->evtType = EVT_NO_SENSOR_CONFIG_EVENT; in initConfigCmd()
1557 cmd->sensorType = mSensorState[handle].sensorType; in initConfigCmd()
1560 cmd->cmd = CONFIG_CMD_ENABLE; in initConfigCmd()
1561 cmd->rate = mSensorState[handle].rate; in initConfigCmd()
1562 cmd->latency = mSensorState[handle].latency; in initConfigCmd()
1564 cmd->cmd = CONFIG_CMD_DISABLE; in initConfigCmd()
1567 cmd->rate = UINT32_C(0); in initConfigCmd()
1568 cmd->latency = UINT64_MAX; in initConfigCmd()
1577 cmd->cmd = CONFIG_CMD_ENABLE; in initConfigCmd()
1579 if (mSensorState[alt].rate > cmd->rate) { in initConfigCmd()
1580 cmd->rate = mSensorState[alt].rate; in initConfigCmd()
1582 if (mSensorState[alt].latency < cmd->latency) { in initConfigCmd()
1583 cmd->latency = mSensorState[alt].latency; in initConfigCmd()
1588 mergeDirectReportRequest(cmd, handle); in initConfigCmd()
1593 struct ConfigCmd cmd; in queueActivate() local
1606 initConfigCmd(&cmd, handle); in queueActivate()
1608 ret = sendCmd(&cmd, sizeof(cmd)); in queueActivate()
1609 if (ret == sizeof(cmd)) { in queueActivate()
1612 cmd.sensorType, handle, enable); in queueActivate()
1616 cmd.sensorType, handle, enable); in queueActivate()
1624 struct ConfigCmd cmd; in queueSetDelay() local
1636 initConfigCmd(&cmd, handle); in queueSetDelay()
1638 ret = sendCmd(&cmd, sizeof(cmd)); in queueSetDelay()
1639 if (ret == sizeof(cmd)) in queueSetDelay()
1641 cmd.sensorType, handle, sampling_period_ns); in queueSetDelay()
1644 cmd.sensorType, handle, sampling_period_ns); in queueSetDelay()
1655 struct ConfigCmd cmd; in queueBatch() local
1668 initConfigCmd(&cmd, handle); in queueBatch()
1670 ret = sendCmd(&cmd, sizeof(cmd)); in queueBatch()
1671 if (ret == sizeof(cmd)) { in queueBatch()
1674 cmd.sensorType, handle, sampling_period_ns, max_report_latency_ns); in queueBatch()
1677 cmd.sensorType, handle, sampling_period_ns, max_report_latency_ns); in queueBatch()
1693 struct ConfigCmd cmd; in queueFlushInternal() local
1713 initConfigCmd(&cmd, handle); in queueFlushInternal()
1714 cmd.cmd = CONFIG_CMD_FLUSH; in queueFlushInternal()
1716 ret = sendCmd(&cmd, sizeof(cmd)); in queueFlushInternal()
1717 if (ret == sizeof(cmd)) { in queueFlushInternal()
1719 cmd.sensorType, handle); in queueFlushInternal()
1722 " with error %s", cmd.sensorType, handle, strerror(errno)); in queueFlushInternal()
1731 struct ConfigCmd *cmd = (struct ConfigCmd *)malloc(sizeof(struct ConfigCmd) + length); in queueDataInternal() local
1734 if (cmd && isValidHandle(handle)) { in queueDataInternal()
1735 initConfigCmd(cmd, handle); in queueDataInternal()
1736 memcpy(cmd->data, data, length); in queueDataInternal()
1737 cmd->cmd = CONFIG_CMD_CFG_DATA; in queueDataInternal()
1739 ret = sendCmd(cmd, sizeof(*cmd) + length); in queueDataInternal()
1740 if (ret == sizeof(*cmd) + length) in queueDataInternal()
1742 cmd->sensorType, length); in queueDataInternal()
1745 cmd->sensorType, length); in queueDataInternal()
1749 free(cmd); in queueDataInternal()
1852 struct MsgCmd *cmd = (struct MsgCmd *)malloc(sizeof(struct MsgCmd) + sizeof(float)); in queueUsbMagBias() local
1855 if (cmd) { in queueUsbMagBias()
1856 cmd->evtType = EVT_APP_FROM_HOST; in queueUsbMagBias()
1857 cmd->msg.appId = APP_ID_MAKE(APP_ID_VENDOR_GOOGLE, APP_ID_APP_BMI160); in queueUsbMagBias()
1858 cmd->msg.dataLen = sizeof(float); in queueUsbMagBias()
1859 memcpy((float *)(cmd+1), &mUsbMagBias, sizeof(float)); in queueUsbMagBias()
1861 ret = sendCmd(cmd, sizeof(*cmd) + sizeof(float)); in queueUsbMagBias()
1862 if (ret == sizeof(*cmd) + sizeof(float)) in queueUsbMagBias()
1866 free(cmd); in queueUsbMagBias()
1979 void HubConnection::mergeDirectReportRequest(struct ConfigCmd *cmd, int handle) { in mergeDirectReportRequest() argument
2002 cmd->rate = (rate > cmd->rate || cmd->cmd == CONFIG_CMD_DISABLE) ? rate : cmd->rate; in mergeDirectReportRequest()
2003 cmd->latency = 0; in mergeDirectReportRequest()
2004 cmd->cmd = CONFIG_CMD_ENABLE; in mergeDirectReportRequest()
2090 struct ConfigCmd cmd; in stopAllDirectReportOnChannel() local
2091 initConfigCmd(&cmd, sensor_handle); in stopAllDirectReportOnChannel()
2093 int result = sendCmd(&cmd, sizeof(cmd)); in stopAllDirectReportOnChannel()
2094 ret = ret && (result == sizeof(cmd)); in stopAllDirectReportOnChannel()
2131 struct ConfigCmd cmd; in configDirectReport() local
2132 initConfigCmd(&cmd, sensor_handle); in configDirectReport()
2134 int ret = sendCmd(&cmd, sizeof(cmd)); in configDirectReport()
2139 ret = (ret == sizeof(cmd)) ? sensor_handle : BAD_VALUE; in configDirectReport()