
Add a new iio_fixup_sampling_frequency() helper to iio-buffer-utils.c and call this for all iio devices. iio_fixup_sampling_frequency() makes sure that devices with *sampling_frequency attributes are sampling at 10Hz or more. This fixes 2 problems: 1) Some buffered devices default their sampling_frequency to 0Hz and then never produce any readings. This fixes e.g. the sensors on Asus T100HA 2-in-1s not working. 2) Some polled devices default to 1Hz and wait for a fresh sample before returning from sysfs *_raw reads, blocking all of iio-sensor-proxy for multiple seconds, this fixes e.g. rotation being detected up to 10 seconds later then the actual rotating of the device on a Lenovo Miix 320.
43 lines
1.4 KiB
C
43 lines
1.4 KiB
C
/*
|
|
* Modified from industrialio buffer test code, and Lenovo Yoga (2 Pro) orientation helper
|
|
* Copyright (c) 2008 Jonathan Cameron
|
|
* Copyright (c) 2014 Peter F. Patel-Schneider
|
|
* Copyright (c) 2014 Bastien Nocera <hadess@hadess.net>
|
|
* Copyright (c) 2015 Elad Alfassa <elad@fedoraproject.org>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
* under the terms of the GNU General Public License version 3 as published by
|
|
* the Free Software Foundation.
|
|
*/
|
|
|
|
#include <glib.h>
|
|
#include <gudev/gudev.h>
|
|
|
|
typedef struct iio_channel_info iio_channel_info;
|
|
|
|
typedef struct {
|
|
GUdevDevice *device;
|
|
char *trigger_name;
|
|
const char *dev_dir_name;
|
|
int channels_count;
|
|
iio_channel_info **channels;
|
|
int scan_size;
|
|
} BufferDrvData;
|
|
|
|
typedef struct {
|
|
ssize_t read_size;
|
|
char *data;
|
|
} IIOSensorData;
|
|
|
|
void process_scan_1 (char *data,
|
|
BufferDrvData *buffer_data,
|
|
const char *ch_name,
|
|
int *ch_val,
|
|
gdouble *ch_scale,
|
|
gboolean *ch_present);
|
|
gboolean iio_fixup_sampling_frequency (GUdevDevice *dev);
|
|
|
|
void buffer_drv_data_free (BufferDrvData *buffer_data);
|
|
BufferDrvData *buffer_drv_data_new (GUdevDevice *device,
|
|
const char *trigger_name);
|