1 /* Medfield sensor plugins
2 * Copyright (C) 2013 Intel Corporation
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; version 2.1.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public
14 * License along with this library; if not, write to the
15 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
16 * Boston, MA 02111-1307, USA.
19 #include "compassprocessor.h"
20 #include "sensor_geomag.h"
23 CompassProcessor::CompassProcessor()
26 mName = "magnetometer";
28 find_input_device_by_name("hmc5883");
29 BaseProcessor::find_device_from_udev("compass");
30 mSysfsPath += "/hmc5883";
31 mSupportedEvents.push_back(GEOMAGNETIC_EVENT_RAW_DATA_REPORT_ON_TIME);
34 bool CompassProcessor::fill_values(unsigned int type, int &count,
35 data_unit_idx_t &unit, data_accuracy &accuracy)
37 if (type == GEOMAGNETIC_RAW_DATA_SET) {
39 unit = IDX_UNIT_MICRO_TESLA;
40 accuracy = ACCURACY_GOOD;
47 int CompassProcessor::get_property(unsigned int property_level,
48 base_property_struct &result)
50 strcpy(result.sensor_name, "hmc5883");
51 strcpy(result.sensor_vendor,"Honeywell");
52 if (property_level == GEOMAGNETIC_RAW_DATA_SET) {
53 result.sensor_unit_idx = IDX_UNIT_MICRO_TESLA;
54 result.sensor_min_range = 0;
55 result.sensor_max_range = 1000;
56 result.sensor_resolution = 1;