summaryrefslogtreecommitdiffstats
path: root/sensors
diff options
context:
space:
mode:
authorDavid Turner <digit@google.com>2016-06-21 07:38:01 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2016-06-21 07:38:02 +0000
commitd6b1ea816edbe6d3bef383774b729a6adcf1bd75 (patch)
treeda2a4bb5556e6f3cc57ae173a0e92530a3cd4749 /sensors
parentdfc610e672404757ac0dcc70d4833e9e65274a1e (diff)
parent51a0c12d0841d45824385a567ab0699d85d86122 (diff)
downloadandroid_device_generic_goldfish-d6b1ea816edbe6d3bef383774b729a6adcf1bd75.tar.gz
android_device_generic_goldfish-d6b1ea816edbe6d3bef383774b729a6adcf1bd75.tar.bz2
android_device_generic_goldfish-d6b1ea816edbe6d3bef383774b729a6adcf1bd75.zip
Merge "Use new <system/qemu_pipe.h> header."
Diffstat (limited to 'sensors')
-rw-r--r--sensors/sensors_qemu.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/sensors/sensors_qemu.c b/sensors/sensors_qemu.c
index 0567411..741a404 100644
--- a/sensors/sensors_qemu.c
+++ b/sensors/sensors_qemu.c
@@ -23,9 +23,9 @@
*/
-/* we connect with the emulator through the "sensors" qemud service
+/* we connect with the emulator through the "sensors" qemu pipe service
*/
-#define SENSORS_SERVICE_NAME "sensors"
+#define SENSORS_SERVICE_NAME "pipe:qemud:sensors"
#define LOG_TAG "QemuSensors"
@@ -45,7 +45,7 @@
#define E(...) ALOGE(__VA_ARGS__)
-#include <hardware/qemud.h>
+#include <system/qemu_pipe.h>
/** SENSOR IDS AND NAMES
**/
@@ -143,9 +143,9 @@ typedef struct SensorDevice {
* from different threads, and poll() is blocking.
*
* Note that the emulator's sensors service creates a new client for each
- * connection through qemud_channel_open(), where each client has its own
+ * connection through qemu_pipe_open(), where each client has its own
* delay and set of activated sensors. This precludes calling
- * qemud_channel_open() on each request, because a typical emulated system
+ * qemu_pipe_open() on each request, because a typical emulated system
* will do something like:
*
* 1) On a first thread, de-activate() all sensors first, then call poll(),
@@ -165,7 +165,7 @@ typedef struct SensorDevice {
static int sensor_device_get_fd_locked(SensorDevice* dev) {
/* Create connection to service on first call */
if (dev->fd < 0) {
- dev->fd = qemud_channel_open(SENSORS_SERVICE_NAME);
+ dev->fd = qemu_pipe_open(SENSORS_SERVICE_NAME);
if (dev->fd < 0) {
int ret = -errno;
E("%s: Could not open connection to service: %s", __FUNCTION__,
@@ -187,7 +187,7 @@ static int sensor_device_send_command_locked(SensorDevice* dev,
}
int ret = 0;
- if (qemud_channel_send(fd, cmd, strlen(cmd)) < 0) {
+ if (qemu_pipe_frame_send(fd, cmd, strlen(cmd)) < 0) {
ret = -errno;
E("%s(fd=%d): ERROR: %s", __FUNCTION__, fd, strerror(errno));
}
@@ -258,7 +258,7 @@ static int sensor_device_poll_event_locked(SensorDevice* dev)
/* read the next event */
char buff[256];
- int len = qemud_channel_recv(fd, buff, sizeof(buff) - 1U);
+ int len = qemu_pipe_frame_recv(fd, buff, sizeof(buff) - 1U);
/* re-acquire the lock to modify the device state. */
pthread_mutex_lock(&dev->lock);
@@ -591,22 +591,23 @@ static struct sensor_t sSensorList[MAX_NUM_SENSORS];
static int sensors__get_sensors_list(struct sensors_module_t* module __unused,
struct sensor_t const** list)
{
- int fd = qemud_channel_open(SENSORS_SERVICE_NAME);
+ int fd = qemu_pipe_open(SENSORS_SERVICE_NAME);
char buffer[12];
int mask, nn, count;
int ret = 0;
if (fd < 0) {
- E("%s: no qemud connection", __FUNCTION__);
+ E("%s: no qemu pipe connection", __FUNCTION__);
goto out;
}
- ret = qemud_channel_send(fd, "list-sensors", -1);
+ static const char kListSensors[] = "list-sensors";
+ ret = qemu_pipe_frame_send(fd, kListSensors, sizeof(kListSensors) - 1);
if (ret < 0) {
E("%s: could not query sensor list: %s", __FUNCTION__,
strerror(errno));
goto out;
}
- ret = qemud_channel_recv(fd, buffer, sizeof buffer-1);
+ ret = qemu_pipe_frame_recv(fd, buffer, sizeof buffer-1);
if (ret < 0) {
E("%s: could not receive sensor list: %s", __FUNCTION__,
strerror(errno));