int req_sampling_rate; /* Requested ; may be different from granted */
int per_sensor_sampling_rate;
int per_device_sampling_rate;
+ int max_supported_rate = 0;
+ int limit;
char freqs_buf[100];
char* cursor;
int n;
/* Decode a single integer value */
n = atoi(cursor);
+ if (n > max_supported_rate)
+ max_supported_rate = n;
+
/* If this matches the selected rate, we're happy */
if (new_sampling_rate == n)
break;
}
}
- /* Cap sampling rates at 1000/s for the time being */
- if (new_sampling_rate > 1000000/POLL_MIN_INTERVAL) {
+ /* Cap sampling rate */
+
+ limit = 1000000/POLL_MIN_INTERVAL;
+
+ if (max_supported_rate && new_sampling_rate > max_supported_rate)
+ limit = max_supported_rate;
+
+ if (new_sampling_rate > limit) {
- new_sampling_rate = 1000000/POLL_MIN_INTERVAL;
+ new_sampling_rate = limit;
ALOGI( "Can't support %d sampling rate, lowering to %d\n",
req_sampling_rate, new_sampling_rate);