Movatterモバイル変換


[0]ホーム

URL:


CN103353835B - The migration process method and device of the compatible multiple Sensor equipment of the same race of android system Sensor HAL layer - Google Patents

The migration process method and device of the compatible multiple Sensor equipment of the same race of android system Sensor HAL layer
Download PDF

Info

Publication number
CN103353835B
CN103353835BCN201310016831.3ACN201310016831ACN103353835BCN 103353835 BCN103353835 BCN 103353835BCN 201310016831 ACN201310016831 ACN 201310016831ACN 103353835 BCN103353835 BCN 103353835B
Authority
CN
China
Prior art keywords
sensor
value
equipment
module
sensors
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310016831.3A
Other languages
Chinese (zh)
Other versions
CN103353835A (en
Inventor
银兰凤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Allwinner Technology Co Ltd
Original Assignee
Allwinner Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Allwinner Technology Co LtdfiledCriticalAllwinner Technology Co Ltd
Priority to CN201310016831.3ApriorityCriticalpatent/CN103353835B/en
Publication of CN103353835ApublicationCriticalpatent/CN103353835A/en
Application grantedgrantedCritical
Publication of CN103353835BpublicationCriticalpatent/CN103353835B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

The invention discloses the migration process method and device of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer, wherein method includes arranging initiation parameter;Read the device name of registration in device drives, and mate with defined device name, determine the Sensor equipment used in system;Resolve configuration file, need the parameter value carrying out changing that the adjustment with direction is set according to direction value and the different Sensor of corresponding module in the title reading configuration file of module;According to the title of facility registration in the driving read, add corresponding equipment to sensor list;Android system starts the poll function in corresponding thread dispatching Sensors HAL layer and obtains the data of bottom relevant device.The migration process method and device of the compatible multiple Sensor equipment of the same race of the android system Sensor HAL layer that the present invention provides can judge that hardware device is to carry out the realization of the corresponding interface dynamically, thus replace Sensor equipment rapidly and realize the adjustment of Sensor device orientation, without carrying out new compiling and configuration operation.

Description

Android system SensorThe migration process method and device of the compatible multiple Sensor equipment of the same race of HAL layer
Technical field
The hardware that the present invention relates to Sensors is taken out as layer processing technology field, particularly relates to the migration process method and device of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer.
Background technology
Hardware abstraction layer HAL(Hardware Abstraction Layer), hardware abstraction layer is in the interface layer between operating system nucleus and hardware circuit, its object is to hardware abstraction.It conceals the hardware interface details of particular platform, provides virtual hardware platform for operating system so that it is have hardware independence, can transplant in kinds of platform.The application of the hardware of bottom with upper strata is effectively isolated by Sensor hardware abstraction layer, and as tie therein, reads the data of bottom hardware, changes accordingly and submits to system afterwards and use.Realizing of hardware abstraction layer is fairly simple, and main task is to describe corresponding equipment and the process of data, and it is not a standard that each side realizes, because implementing flexible and changeable.
From the perspective of software and hardware is tested, the test job of software and hardware all can be based respectively on hardware abstraction layer and complete so that being possibly realized parallel of software and hardware test job.
Sensors Hardware Module i.e. Sensor hardware abstraction layer, be typically called the HAL layer of Sensors.The application of the hardware of bottom with upper strata is effectively isolated by HAL layer, and as tie therein, reads the data of bottom hardware, changes accordingly and submits to system afterwards and use.Realizing of hardware abstraction layer is fairly simple, in migration process, needs to pay close attention to key point at three, is illustrated in fig. 1 shown below: the sensing system structure of Android.
One, filling hardware use the relevant information of Sensor.
The relevant information of Sensors is described by Sensor_t structure, and this structure is mainly used in function get_Sensors_list (), is used for obtaining sensor list.
Two, the realization of SetDelay and enable function in HAL layer.
SetDelay function mainly controls the speed of hardware device reported data;Enable function mainly controls the enable of hardware device, the switch the most whether worked.The key point one that function realizes realizes the reported data time of the interface control device of corresponding SetDelay and enable and enables switch for Kernel driver;Two need to find the interface path of Kernel driver function in HAL layer, carry out corresponding read-write, and then realize SetDelay and enable function.
Three, the equipment of registration in Driver is mainly found in the reading of data, and opens it and then read data therein.The direction processing mainly process data of data and the system that converts data to spendable data form.
The numerical value direction of some Sensor also suffers from the impact of hardware designs, and as a example by mma7660 gravity sensor (GSensor), the direction in hardware device will affect the directivity of data, be illustrated in fig. 2 shown below:
In the prior art, the method for conditional compilation is used to define the module title that differently configured module uses, direction value and the Sensor_t structure of corresponding Sensor.
The shortcoming of the common method of prior art is: when the poor direction finding the module configured is true and when using another module instead, need configuration again and compiling;When revising the directioin parameter of module in the most compiled firmware, compiling after needing the order performing once to update under the catalogue in source file, the direction value of amendment just can come into force.
Summary of the invention
The invention provides the migration process method and device of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer, realize the compatibility of multiple Sensor equipment, and can judge that hardware device is to carry out the realization of the corresponding interface dynamically, such that it is able to replace Sensor equipment easily and fast, without carrying out new compiling and configuration.
Based on the problems referred to above, the migration process method of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer that the present invention provides, specifically include following steps:
Drive according to the Sensors supported in linux system, Sensor HAL layer is carried out initialization process;When initializing, title and the conversion value of all modules driving platform to be supported is set;Preset Gsensor direction value path and the path of Sensor equipment, preset the identification title of Gsensor direction variable and configure corresponding direction variable configuration file;For different Sensor equipment, corresponding Sensor_t structure is set;Wherein, the title of each module of setting and the device name one_to_one corresponding in Sensor facility registration to Linux input subsystem;
After the Driver of Sensors equipment is registered to the input subsystem of Linux, the node that Sensors HAL layer is corresponding according to generating Sensors equipment, determine title and the module obtaining current registered Sensors equipment;
After Android HAL layer determines and obtains current registered Sensor device name, path according to default Sensor device orientation value, read described direction variable configuration file and resolve the Sensor direction value preset, the Sensor direction value preset described in comparison and required Sensor direction value, adjust the direction of Sensor equipment;
Obtain the Sensor_t structure information that Sensor equipment is corresponding, the module used is added in sensor list, it is achieved described module is registered to Android layer in hardware;
Described Android layer starts the poll function in corresponding thread dispatching Sensors HAL layer and obtains the data of bottom relevant device.
It is preferred that as a kind of embodiment, the described title arranging all modules driving platform to be supported and conversion value comprise the steps:
After the title determining all modules driving platform to be supported and conversion value, utilize device name and the conversion value of Sensor of structure name record module;Wherein: conversion value is the maximum that the Driver of Sensor equipment reports;
The identification title of described default Gsensor direction variable also configures corresponding direction variable configuration file, comprises the steps:
According to the title of different modules, the direction being respectively provided with the X, Y, Z axis of corresponding module and the mark whether XY axle exchanged;The identification title of described Gsensor direction variable is for identifying the direction value of Sensor equipment;The Gsensor direction variable information configuration of setting and is preserved in direction variable configuration file Gsensor.cfg;
Described corresponding Sensor_t structure is set for different Sensor equipment, comprises the steps:
According to different Sensor equipment, the description information of corresponding Sensor_t structure is set.
It is preferred that as a kind of embodiment, described Sensors HAL layer, according to generating the node corresponding with Sensors equipment, determines title and the module of the current registered Sensors equipment of acquisition, comprises the steps:
After the Driver of current Sensors equipment is registered to the input subsystem of Linux, that Sensors HAL layer generates according to described input subsystem and with described current Sensors equipment node one to one storage position, finds the input equipment storage position that described current Sensors equipment is corresponding;
Wherein: the node of described equipment is present under "/sys/class/input/inputX " catalogue, and X is positive integer, X numerical value is equal to the input sequence sequence number corresponding according to the input equipment of linux system;X numerical value carries out ascending order arrangement along with input sequence;
Utilize the title of Sensors equipment under function read reading/sys/class/input/inputX;
The title of the Sensors equipment of described reading is compared with the title of Sensors equipment driving platform to arrange, finds the consistent module of title with the Sensors equipment of described reading in hardware;
Determine node path and the value of X of current registered Sensors equipment.
It is preferred that as a kind of embodiment, described read direction variable configuration file also resolves Sensor direction value, the Sensor direction value preset described in comparison and required Sensor direction value, adjust the direction of Sensor equipment, comprise the steps:
Utilize function Gsensor_cfg read direction variable configuration file Gsensor.cfg, all modules of record determine in described Gsensor.cfg file the module mated with the Sensor device name read, and resolves the Sensor direction value that corresponding coupling module is preset;
Wherein, described Gsensor.cfg file is for recording the direction value of all modules driving platform to support;
When reading true value, default Sensor direction value is positive direction value;When reading false value, default Sensor direction value is negative direction value;Described positive direction value is positive number+1, and described negative direction value is negative-1;Judge that the direction value of required Sensor is the most consistent with the Sensor direction value preset, if it is judged that be consistent, then will need not adjust the direction of Sensor;If it is judged that be inconsistent, by the direction adjusting Sensor it is and the opposite direction presetting Sensor direction then.
It is preferred that as a kind of embodiment, the Sensor_t structure information that described acquisition Sensor equipment is corresponding, the module used is added in sensor list, comprise the steps: in hardware
The driving platform at the title place according to module stores position, obtains corresponding Sensor_t structure information, utilize get_sensors_list function to be added in sensor list by the module used in hardware;
Poll function in described startup corresponding thread dispatching Sensors HAL layer obtains the data of bottom relevant device and comprises the steps:
Utilize Poll function to report value by reading in real time, carry out corresponding data conversion according to conversion formula, and use numerically offering android system after conversion;
Described conversion formula is: numerical value=(G/ conversion value) × direction value × report value after conversion;
Wherein: G is unit value and is constant, and the G-value that different types of Sensor equipment is corresponding is different;Conversion value is constant, and the conversion value that different types of Sensor equipment is corresponding is different;
Described Sensor_t structure is used for describing Sensor equipment characteristic information;Information described by described Sensor_t structure includes the title of sensor, the version of sensor, the handle of sensor, the type of sensor, the maximum magnitude of sensor, the resolution of sensor, the consumption energy of sensor, interval of events minimum time.
Correspondingly, present invention also offers the migration process device of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer, module and data read module is added, wherein including initialization module, equipment read module, direction adjusting module, module:
Described initialization module, for driving according to the Sensors supported in linux system, carries out initialization process to SensorHAL layer;When initializing, title and the conversion value of all modules driving platform to be supported is set;Preset Gsensor direction value path and the path of Sensor equipment, preset the identification title of Gsensor direction variable and configure corresponding direction variable configuration file;For different Sensor equipment, corresponding Sensor_t structure is set;Wherein, the title of each module of setting and the device name one_to_one corresponding in Sensor facility registration to Linux input subsystem;
Described equipment read module, is used for after the Driver of Sensors equipment is registered to the input subsystem of Linux, the node that Sensors HAL layer is corresponding according to generating Sensors equipment, determines title and the module obtaining current registered Sensors equipment;
Described direction adjusting module, after determining obtain current registered Sensor device name at Android HAL layer, path according to default Sensor device orientation value, read described direction variable configuration file and resolve the Sensor direction value preset, the Sensor direction value preset described in comparison and required Sensor direction value, adjust the direction of Sensor equipment;
Described module adds module, for obtaining the Sensor_t structure information that Sensor equipment is corresponding, is added to by the module used in sensor list, it is achieved described module is registered to Android layer in hardware;
Described data read module, starts the poll function in corresponding thread dispatching Sensors HAL layer for described Android layer and obtains the data of bottom relevant device.
It is preferred that as a kind of embodiment, described initialization module includes that record sub module, direction are preset submodule and first and arranged submodule, wherein:
Record sub module, for after the title determining all modules driving platform to be supported and conversion value, utilizes device name and the conversion value of Sensor of structure name record module;Wherein: conversion value is the maximum that the Driver of Sensor equipment reports;
Submodule is preset in described direction, for the title according to different modules, the direction being respectively provided with the X, Y, Z axis of corresponding module and the mark whether exchanged by XY axle;The identification title of described Gsensor direction variable is for identifying the direction value of Sensor equipment;The Gsensor direction variable information configuration of setting and is preserved in direction variable configuration file Gsensor.cfg;
Described first arranges submodule, for according to different Sensor equipment, arranging the description information of corresponding Sensor_t structure.
It is preferred that as a kind of embodiment, described equipment read module includes searching submodule, the first reading submodule, comparer module and determining submodule, wherein:
Described lookup submodule, after being registered to the input subsystem of Linux at the Driver of current Sensors equipment, that Sensors HAL layer generates according to described input subsystem and with described current Sensors equipment node one to one storage position, finds the input equipment storage position that described current Sensors equipment is corresponding;
Wherein: the node of described equipment is present under "/sys/class/input/inputX " catalogue, and X is positive integer, X numerical value is equal to the input sequence sequence number corresponding according to the input equipment of linux system;X numerical value carries out ascending order arrangement along with input sequence;
Described first reading submodule, is used for utilizing the title of the Sensors equipment under function read reading/sys/class/input/inputX;
Described comparer module, for the title of the title of the Sensors equipment of described reading with the Sensors equipment driving platform setting being compared, finds the consistent module of title with the Sensors equipment of described reading in hardware;
Described determine submodule, for determining node path and the value of X of current registered Sensors equipment.
It is preferred that as a kind of embodiment, described direction adjusting module includes mating analyzing sub-module and adjusting submodule, wherein:
Described coupling analyzing sub-module, for utilizing function Gsensor_cfg read direction variable configuration file Gsensor.cfg, all modules of record determine in described Gsensor.cfg file the module mated with the Sensor device name read, and resolves the Sensor direction value that corresponding coupling module is preset;
Wherein, described Gsensor.cfg file is for recording the direction value of all modules driving platform to support;
Described adjustment submodule, for when reading true value, default Sensor direction value is positive direction value;When reading false value, default Sensor direction value is negative direction value;Described positive direction value is positive number+1, and described negative direction value is negative-1;Judge that the direction value of required Sensor is the most consistent with the Sensor direction value preset, if it is judged that be consistent, then will need not adjust the direction of Sensor;If it is judged that be inconsistent, by the direction adjusting Sensor it is and the opposite direction presetting Sensor direction then.
It is preferred that as a kind of embodiment, described module adds module and includes that module adds submodule, wherein:
Described module adds submodule, for according to storing position in the driving platform at the title place of module, obtaining corresponding Sensor_t structure information, utilize get_sensors_list function to be added in sensor list by the module used in hardware;
Described data read module includes that data convert and reports submodule, wherein:
Described data convert and report submodule, are used for utilizing Poll function to report value by reading in real time, carry out corresponding data conversion according to conversion formula, and use numerically offering android system after conversion;
Described conversion formula is: numerical value=(G/ conversion value) × direction value × report value after conversion;
Wherein: G is unit value and is constant, and the G-value that different types of Sensor equipment is corresponding is different;TurnChanging value is constant, and the conversion value that different types of Sensor equipment is corresponding is different.
The beneficial effect comprise that
The migration process method and device of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer that the present invention provides, wherein method includes arranging initiation parameter;Read the device name of registration in device drives, and mate with defined device name, determine the Sensor equipment used in system;Resolve configuration file, need the parameter value carrying out changing that the adjustment with direction is set according to direction value and the different Sensor of corresponding module in the title reading configuration file of module;According to the title of facility registration in the driving read, add corresponding equipment to sensor list;Android system starts the poll function in corresponding thread dispatching Sensors HAL layer and obtains the data of bottom relevant device.The migration process method and device of the compatible multiple Sensor equipment of the same race of the android system Sensor HAL layer that the present invention provides can judge that hardware device is to carry out the realization of the corresponding interface dynamically, thus replace Sensor equipment rapidly and realize the adjustment of Sensor device orientation, without carrying out new compiling and configuration operation.
Accompanying drawing explanation
Fig. 1 is the sensing system structural representation of Android in prior art;
Fig. 2 is the schematic diagram of the directivity of the numerical value aspect effect data of Sensor equipment in prior art;
Fig. 3 is the schematic flow sheet of an embodiment of migration process method of the present invention;
Fig. 4 be migration process method of the present invention an embodiment in Name structure definition related content;
Fig. 5 be migration process method of the present invention an embodiment defined in the related content of fixed route;
Fig. 6 is the Gsensor direction variable information arranged in an embodiment of migration process method of the present invention;
Fig. 7 is the description information of the Sensor_t structure definition arranged in an embodiment of migration process method of the present invention;
Fig. 8 be migration process method of the present invention an embodiment in the reading result of Sensor equipment;
Fig. 9 is the structural representation of an embodiment of migration process device of the present invention.
Detailed description of the invention
Below in conjunction with Figure of description, the detailed description of the invention of the migration process method and device of multiple of the same race Sensor equipment compatible to the android system Sensor HAL layer in the embodiment of the present invention illustrates.
The hardware of Sensors is taken out as in layer, the structure having several key needs user to process, such as: sensors_module_t structure is used for defining sensor module, sensor_t structure is used for defining a sensors equipment, sensors_event_t is used for defining sensor data, and sensors_poll_device_t is used for defining the control of sensor.
The migration process method of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer that the embodiment of the present invention provides, for adapting to the migration process of multiple Sensor equipment of the same race.
Fig. 3 is the flow chart of the migration process method of the compatible multiple Sensor equipment of the same race of android system Sensor HAL layer of the embodiment of the present invention.As it is shown on figure 3, the method that the present embodiment is used includes following several step:
S100, according in linux system support Sensors drive, Sensor HAL layer is carried out initialization process;When initializing, title and the conversion value of all modules driving platform to be supported is set;Preset Gsensor direction value path and the path of Sensor equipment, preset the identification title of Gsensor direction variable and configure corresponding direction variable configuration file;For different Sensor equipment, corresponding Sensor_t structure is set;Wherein, the title of each module of setting and the device name one_to_one corresponding in Sensor facility registration to Linux input subsystem;
S200, after the Driver of Sensors equipment is registered to the input subsystem of Linux, Sensors HAL layer, according to generating node corresponding to Sensors equipment, determines title and the module obtaining current registered Sensors equipment.
S300, after Android HAL layer determines and obtains current registered Sensor device name, path according to default Sensor device orientation value, read described direction variable configuration file and resolve the Sensor direction value preset, the Sensor direction value preset described in comparison and required Sensor direction value, adjust the direction of Sensor equipment;
S400, the Sensor_t structure information that acquisition Sensor equipment is corresponding, add to the module used in hardware in sensor list, it is achieved described module is registered to Android layer;
S500, described Android layer start the poll function in corresponding thread dispatching Sensors HAL layer and obtain the data of bottom relevant device.
The above steps of the migration process method that the embodiment of the present invention realizes android system Sensor HAL layer compatible multiple Sensor equipment of the same race below is described in detail:
It is preferred that as a kind of embodiment, in described step S100, the described title arranging all modules driving platform to be supported and conversion value comprise the steps:
S101, after determining the title of all modules and conversion value driving platform to be supported, utilize device name and the conversion value of Sensor of structure name record module;Wherein: conversion value is the maximum that the Driver of Sensor equipment reports;
In above-mentioned steps S101, drive at array Linux Sensor and on platform, initiation parameter is set, arranging the title of the Gsensor module supported in system, this title needs consistent with the title of facility registration in driving, and purpose is for being used for the system that identifies the most chartered hardware device module.
As shown in Figure 4, Fig. 4 illustrates the related content of described Name structure definition.
In above-mentioned steps S100, preset Gsensor direction value path and the path of Sensor equipment, see Fig. 5, Fig. 5 and illustrate the fixed route (including presetting Gsensor direction value path and the path of Sensor equipment) of definition.
In above-mentioned steps S100, the identification title of described default Gsensor direction variable also configures corresponding direction variable configuration file, specifically includes following steps:
S102, title according to different modules, the direction being respectively provided with the X, Y, Z axis of corresponding module and the mark whether XY axle exchanged;The identification title of described Gsensor direction variable is for identifying the direction value of Sensor equipment;The Gsensor direction variable information configuration of setting and is preserved in direction variable configuration file Gsensor.cfg;See the Gsensor direction variable information that Fig. 6, Fig. 6 illustrate to arrange.
The direction configuration of each module all only has five, shown in concrete implication such as following table (table 1):
gsensor_nameThe title of the module supported
gsensor_direct_xX-direction
gsensor_direct_yY direction
gsensor_direct_zZ-direction
gsensor_xy_revertXY direction is the need of reversion
Table 1
In described step S100, described corresponding Sensor_t structure is set for each Sensor equipment, specifically includes following steps:
S103, according to different Sensor equipment, the description information of corresponding Sensor_t structure is set;See Fig. 7, Fig. 7 to illustrate embodiment of the present invention migration process method and implement the description information arranging Sensor_t structure.
When configuration parameter, need to arrange Gsensor direction variable, the path of configuration parameter file;And the information such as the Sensor_t structure that respective Sensor is set.
It is preferred that as a kind of embodiment, described Sensor_t structure is used for describing Sensor equipment characteristic information;Information described by described Sensor_t structure includes the information such as the title of sensor, the version of sensor, the handle of sensor, the type of sensor, the maximum magnitude of sensor, the resolution of sensor, the consumption energy of sensor, interval of events minimum time.Any one sensor equipment being required for arranging a sensor_t structure, illustrates, Fig. 7 illustrates the particular content of above-mentioned information.Information described by Sensor_t structure includes above-mentioned information, but is not limited to this, and this is repeated by the embodiment of the present invention the most one by one.
Specifically, because the structure of Sensor_t that different module uses describes information and differs use, therefore all use Sensor_t structure to describe accordingly the module supported, describe calling of information accordingly according to the hardware device read.
It is preferred that as a kind of embodiment, in described step S200, described Sensors HAL layer, according to generating the node corresponding with Sensors equipment, determines title and the module of the current registered Sensors equipment of acquisition, comprises the steps:
S201, after the Driver of current Sensors equipment is registered to the input subsystem of Linux, that Sensors HAL layer generates according to described input subsystem and with described current Sensors equipment node one to one storage position, finds the input equipment storage position that described current Sensors equipment is corresponding;
Wherein: the node of described equipment is present under "/sys/class/input/inputX " catalogue, and X is positive integer, X numerical value is equal to the input sequence sequence number corresponding according to the input equipment of linux system;X numerical value carries out ascending order arrangement along with input sequence;Such as: the node of Input equipment is present under "/sys/class/input/inputX " catalogue, X is the numerical value such as 1,2,3,4, carries out the increase of ascending order according to the input equipment of system.
S202, the title of the Sensors equipment utilized under function read reading/sys/class/input/inputX;
S203, the title of the Sensors equipment of described reading is compared with the title of Sensors equipment driving platform to arrange, find the consistent module of title with the Sensors equipment of described reading in hardware;
S204, the node path determining current registered Sensors equipment and the value of X.
In above-mentioned steps S200, when the Driver of Sensors equipment is by input (input) subsystem being registered to linux, it will generate the node corresponding with equipment, Sensors HAL layer can find corresponding equipment according to the node generated.(operate hardware device and i.e. operate the function interface of respective nodes).
It is preferred that as a kind of embodiment, in described step S300, described read direction variable configuration file also resolves Sensor direction value, the Sensor direction value preset described in comparison and required Sensor direction value, adjust the direction of Sensor equipment, comprise the steps:
Utilize function Gsensor_cfg read direction variable configuration file Gsensor.cfg, all modules of record determine in described Gsensor.cfg file the module mated with the Sensor device name read, and resolves the Sensor direction value that corresponding coupling module is preset;
Wherein, described Gsensor.cfg file is for recording the direction value of all modules driving platform to support;
When reading true value, default Sensor direction value is positive direction value;When reading false value, default Sensor direction value is negative direction value;Described positive direction value is positive number+1, and described negative direction value is negative-1;Judge that the direction value of required Sensor is the most consistent with the Sensor direction value preset, if it is judged that be consistent, then will need not adjust the direction of Sensor;If it is judged that be inconsistent, by the direction adjusting Sensor it is and the opposite direction presetting Sensor direction then.As shown in Figure 8, Fig. 8 illustrates the reading acetonideexample of a Sensor equipment.
It is preferred that as a kind of embodiment, in described S400 step, the Sensor_t structure information that described acquisition Sensor equipment is corresponding, the module used is added in sensor list, comprise the steps: in hardware
The driving platform at the title place according to module stores position, obtains corresponding Sensor_t structure information, utilize get_sensors_list function to be added in sensor list by the module used in hardware;
In described S500 step, the poll function in described startup corresponding thread dispatching Sensors HAL layer obtains the data of bottom relevant device and comprises the steps:
Utilize Poll function to report value by reading in real time, carry out corresponding data conversion according to conversion formula, and use numerically offering android system after conversion;
Described conversion formula is: numerical value=(G/ conversion value) × direction value × report value after conversion;
Wherein: G is unit value and is constant, and the G-value that different types of Sensor equipment is corresponding is different;Conversion value is constant, and the conversion value that different types of Sensor equipment is corresponding is different.
For example, conversion formula (G/ conversion value) × direction value × report value is utilized) i.e. can get spendable numerical value in system, G is unit value, and the G-value such as Gsensor is 9.81.Conversion value is also the constant arranged, and obtain only in real time reports value different, and the most above-mentioned formula can realize the conversion operation of data.By perform conversion operation, the data that Driver is reported be converted to android system can data.
Illustrate, the Sensor equipment of different manufacturers, the figure place of data output is different, some is 8, and some is ten, and the numerical value reported in Driver is int categorical data, and the float type used in android system, and Sensors has special unit value and numerical range, if gravity sensing sensor is with G(9.81) for maximum output valve, it is therefore desirable to the data that Driver is reported be converted to android system can data.
Generally speaking, the migration process method that the embodiment of the present invention is provided is achieved by the steps of:
The first step: initiation parameter is set;
Second step: read the device name of registration in device drives, and carry out mating so that it is determined that the Sensor equipment that uses in system with defined device name;
3rd step: resolve configuration file, reads the direction value of corresponding module in gSensor.cfg according to the title of module, and different Sensor needs the parameter value that carries out changing;Have only to when poor direction is true revise the parameter in this file;
4th step: according to reading the title of facility registration in driving, add corresponding sensor list;
5th step: android system starts the poll function in corresponding thread dispatching Sensors HAL layer and obtains the data of bottom relevant device.
The migration process method essence that the embodiment of the present invention is provided is: in being driven by reading, the device name of registration carries out calling of corresponding Gsensor interface dynamically, the direction of Gsensor is extracted one configuration file of formation, it is gsensor.cfg file by the name definition of this document, deposit in system /system/usr/ path under, the direction of all Gsensor supported in system is write wherein;By to drive in the device name that reads carry out mating and resolve configuration file and obtain the information such as transfer parameter value of the direction value of used Gsensor and the use of corresponding Sensor_t structure, module.
Wherein, the hardware abstraction layer of the Sensor that the embodiment of the present invention is provided mainly is called by poll and returns the data obtained from lower floor, changes accordingly and reports system use afterwards.Hardware abstraction layer need the structure building a Sensor_t type represent corresponding equipment module;Process for data, mainly conversion parameter and direction, the precision of different modules and resolution are all different, and the key point that therefore the multiple Sensor of hardware abstraction layer realizes is Sensor_t structure, the process of module direction and precision resolution etc..The migration process method that the embodiment of the present invention is provided can compatible multiple Gsensor equipment, by judging that hardware device carries out the realization of the corresponding interface dynamically, Sensor equipment can be replaced quickly and easily and realize the adjustment of Sensor device orientation rapidly, without carrying out new compiling and configuration.
Based on same inventive concept, the embodiment of the present invention additionally provides the migration process device of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer, owing to the migration process method of the principle of this device solution problem multiple of the same race Sensor equipment compatible to aforementioned a kind of android system Sensor HAL layer is similar, therefore the enforcement of this device may refer to the enforcement of preceding method, repeats no more in place of repetition.
The migration process device 10 of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer that the embodiment of the present invention provides, as shown in Figure 9, described migration process device 10 includes that initialization module 91, equipment read module 92, direction adjusting module 93, module add module 94 and data read module 95, wherein:
Described initialization module 91, for driving according to the Sensors supported in linux system, carries out initialization process to Sensor HAL layer;When initializing, title and the conversion value of all modules driving platform to be supported is set;Preset Gsensor direction value path and the path of Sensor equipment, preset the identification title of Gsensor direction variable and configure corresponding direction variable configuration file;For different Sensor equipment, corresponding Sensor_t structure is set;Wherein, the title of each module of setting and the device name one_to_one corresponding in Sensor facility registration to Linux input subsystem;
Described equipment read module 92, is used for after the Driver of Sensors equipment is registered to the input subsystem of Linux, the node that Sensors HAL layer is corresponding according to generating Sensors equipment, determines title and the module obtaining current registered Sensors equipment;
Described direction adjusting module 93, after determining obtain current registered Sensor device name at Android HAL layer, path according to default Sensor device orientation value, read described direction variable configuration file and resolve the Sensor direction value preset, the Sensor direction value preset described in comparison and required Sensor direction value, adjust the direction of Sensor equipment;
Described module adds module 94, for obtaining the Sensor_t structure information that Sensor equipment is corresponding, is added to by the module used in sensor list, it is achieved described module is registered to Android layer in hardware;
Described data read module 95, starts the poll function in corresponding thread dispatching Sensors HAL layer for described Android layer and obtains the data of bottom relevant device.
It is preferred that as a kind of embodiment, described initialization module 91 includes that record sub module, direction are preset submodule and first and arranged submodule, wherein:
Record sub module, for after the title determining all modules driving platform to be supported and conversion value, utilizes device name and the conversion value of Sensor of structure name record module;Wherein: conversion value is the maximum that the Driver of Sensor equipment reports;
Submodule is preset in described direction, for the title according to different modules, the direction being respectively provided with the X, Y, Z axis of corresponding module and the mark whether exchanged by XY axle;The identification title of described Gsensor direction variable is for identifying the direction value of Sensor equipment;The Gsensor direction variable information configuration of setting and is preserved in direction variable configuration file Gsensor.cfg;
Described first arranges submodule, for according to different Sensor equipment, arranging the description information of corresponding Sensor_t structure.
It is preferred that as a kind of embodiment, described equipment read module 92 includes searching submodule, the first reading submodule, comparer module and determining submodule, wherein:
Described lookup submodule, after the input subsystem being registered to Linux at the Driver of current Sensors equipment, that Sensors HAL layer generates according to described input subsystem and with described current Sensors equipment node one to one storage position, finds the input equipment storage position that described current Sensors equipment is corresponding;
Wherein: the node of described equipment is present under "/sys/class/input/inputX " catalogue, and X is positive integer, X numerical value is equal to the input sequence sequence number corresponding according to the input equipment of linux system;X numerical value carries out ascending order arrangement along with input sequence;
Described first reading submodule, is used for utilizing the title of the Sensors equipment under function read reading/sys/class/input/inputX;
Described comparer module, for the title of the title of the Sensors equipment of described reading with the Sensors equipment driving platform setting being compared, finds the consistent module of title with the Sensors equipment of described reading in hardware;
Described determine submodule, for determining node path and the value of X of current registered Sensors equipment.
It is preferred that as a kind of embodiment, described direction adjusting module 93 includes mating analyzing sub-module and adjusting submodule, wherein:
Described coupling analyzing sub-module, for utilizing function Gsensor_cfg read direction variable configuration file Gsensor.cfg, all modules of record determine in described Gsensor.cfg file the module mated with the Sensor device name read, and resolves the Sensor direction value that corresponding coupling module is preset;
Wherein, described Gsensor.cfg file is for recording the direction value of all modules driving platform to support;
Described adjustment submodule, for when reading true value, default Sensor direction value is positive direction value;When reading false value, default Sensor direction value is negative direction value;Described positive direction value is positive number+1, and described negative direction value is negative-1;Judge that the direction value of required Sensor is the most consistent with the Sensor direction value preset, if it is judged that be consistent, then will need not adjust the direction of Sensor;If it is judged that be inconsistent, by the direction adjusting Sensor it is and the opposite direction presetting Sensor direction then.
It is preferred that as a kind of embodiment, described module adds module 94 and includes that module adds submodule, wherein:
Described module adds submodule, for according to storing position in the driving platform at the title place of module, obtaining corresponding Sensor_t structure information, utilize get_sensors_list function to be added in sensor list by the module used in hardware;
Described data read module 95 includes that data convert and reports submodule, wherein:
Described data convert and report submodule, are used for utilizing Poll function to report value by reading in real time, carry out corresponding data conversion according to conversion formula, and use numerically offering android system after conversion;
Described conversion formula is: numerical value=(G/ conversion value) × direction value × report value after conversion;
Wherein: G is unit value and is constant, and the G-value that different types of Sensor equipment is corresponding is different;Conversion value is constant, and the conversion value that different types of Sensor equipment is corresponding is different.
The migration process method and device of the compatible multiple Sensor equipment of the same race of a kind of android system Sensor HAL layer that the embodiment of the present invention provides, wherein method includes arranging initiation parameter;Read the device name of registration in device drives, and mate with defined device name, determine the Sensor equipment used in system;Resolve configuration file, need the parameter value carrying out changing that the adjustment with direction is set according to direction value and the different Sensor of corresponding module in the title reading configuration file of module;According to the title of facility registration in the driving read, add corresponding equipment to sensor list;Android system starts the poll function in corresponding thread dispatching Sensors HAL layer and obtains the data of bottom relevant device.
The compatible multiple Sensor equipment of migration process method and device of the compatible multiple Sensor equipment of the same race of the android system Sensor HAL layer that the embodiment of the present invention provides, can judge that hardware device is to carry out the realization of the corresponding interface dynamically, thus replace Sensor equipment rapidly and realize the adjustment of Sensor device orientation, without carrying out new compiling and configuration operation.
Embodiment described above only have expressed the several embodiments of the present invention, and it describes more concrete and detailed, but therefore can not be interpreted as the restriction to the scope of the claims of the present invention.It should be pointed out that, for the person of ordinary skill of the art, without departing from the inventive concept of the premise, it is also possible to make some deformation and improvement, these broadly fall into protection scope of the present invention.Therefore, the protection domain of patent of the present invention should be as the criterion with claims.

Claims (9)

CN201310016831.3A2013-01-172013-01-17The migration process method and device of the compatible multiple Sensor equipment of the same race of android system Sensor HAL layerActiveCN103353835B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201310016831.3ACN103353835B (en)2013-01-172013-01-17The migration process method and device of the compatible multiple Sensor equipment of the same race of android system Sensor HAL layer

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201310016831.3ACN103353835B (en)2013-01-172013-01-17The migration process method and device of the compatible multiple Sensor equipment of the same race of android system Sensor HAL layer

Publications (2)

Publication NumberPublication Date
CN103353835A CN103353835A (en)2013-10-16
CN103353835Btrue CN103353835B (en)2016-08-10

Family

ID=49310209

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201310016831.3AActiveCN103353835B (en)2013-01-172013-01-17The migration process method and device of the compatible multiple Sensor equipment of the same race of android system Sensor HAL layer

Country Status (1)

CountryLink
CN (1)CN103353835B (en)

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN104506902B (en)*2014-12-052018-11-06惠州Tcl移动通信有限公司A kind of method, device and mobile terminal of device compatibility
CN105893283A (en)*2015-11-202016-08-24乐视移动智能信息技术(北京)有限公司Camera parameter reading-writing method and apparatus as well as terminal device
CN106502681B (en)*2016-10-312019-07-16Oppo广东移动通信有限公司Sensor registration method and device and mobile terminal
CN107239283B (en)*2017-05-312020-11-20苏州浪潮智能科技有限公司 A storage system management software adaptation method and device
CN107423075B (en)*2017-08-282021-06-08深圳传音控股股份有限公司Driven registration method and user terminal
CN107911541A (en)*2017-11-092018-04-13广州视源电子科技股份有限公司Multi-camera switching use method and device based on Android system
CN113034873A (en)*2019-12-252021-06-25西安诺瓦星云科技股份有限公司Sensor communication method, device and system
CN113032018B (en)*2019-12-252024-03-01博泰车联网科技(上海)股份有限公司Improved method for read command and related device
CN114020364B (en)*2021-11-162024-04-26北京字节跳动网络技术有限公司Sensor device adaptation method, device, electronic device and storage medium
CN116708615B (en)*2022-11-152024-04-09荣耀终端有限公司Device registration method, device registration apparatus and storage medium
CN116028392B (en)*2022-12-232024-01-09中科驭数(北京)科技有限公司General drive management method, system and equipment oriented to hardware based on KPU architecture

Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101833452A (en)*2010-04-302010-09-15中国海洋大学Monitor software design method based on sensor
CN102279746A (en)*2011-08-212011-12-14中国海洋大学Sensor-based monitoring software development platform system and method
CN102314348A (en)*2011-09-152012-01-11Tcl集团股份有限公司Android system development framework and development device
CN102662665A (en)*2012-03-292012-09-12福州瑞芯微电子有限公司Input subsystem enabling Android to support various sensors

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
CN101833452A (en)*2010-04-302010-09-15中国海洋大学Monitor software design method based on sensor
CN102279746A (en)*2011-08-212011-12-14中国海洋大学Sensor-based monitoring software development platform system and method
CN102314348A (en)*2011-09-152012-01-11Tcl集团股份有限公司Android system development framework and development device
CN102662665A (en)*2012-03-292012-09-12福州瑞芯微电子有限公司Input subsystem enabling Android to support various sensors

Also Published As

Publication numberPublication date
CN103353835A (en)2013-10-16

Similar Documents

PublicationPublication DateTitle
CN103353835B (en)The migration process method and device of the compatible multiple Sensor equipment of the same race of android system Sensor HAL layer
Gellersen et al.Physical prototyping with smart-its
EP2793450B1 (en)System and method for determining sensor accuracy of a portable electronic device
CN102521412B (en)Data association device and data association method
CN104215264A (en)Portable electronic device with integrated temperature sensor being compensated by other sensing data
CN104121932A (en)Portable electronic device with integrated temperature sensor
CN103649888A (en)Linear device value estimating method, capacitance detection method, integrated circuit, touch sensor system, and electronic device
CN102999320A (en)Automatic test case generation method and system
CN101833452A (en)Monitor software design method based on sensor
CN112836814A (en) Storage and computing integrated processor, processing system and deployment method of algorithm model
CN107273176A (en)The Compilation Method and device of a kind of adaptive hardware framework
CN102983999A (en)Method and system for parameter configuration of monitoring platform system and device group
KR20190111545A (en)Device and method for compensating temperature variation of strain-gauge pressure sensor, and method for implmentation of strain-gauge pressure sensor from capacitance touch screen element
Song et al.A high-efficiency bidirectional active balance for electric vehicle battery packs based on model predictive control
EP1796031A4 (en) DEVICE AND METHOD FOR TOTALIZING ENVIRONMENTAL LOAD
CN118395194B (en)Model training method, product, equipment and computer readable storage medium
CN107682691B (en)A kind of method, terminal and the computer readable storage medium of camera focus calibration
EP2808651A1 (en)Portable electronic device with integrated temperature sensor being compensated by other sensing data
CN103221956A (en)System construction support tool and system construction support device
Ferreira et al.Multi-agent architecture for reconfiguration of precision modular assembly systems
CN103345454A (en)Peripheral device connection method of mobile terminal
Zuefle et al.Assessing the influence of digital innovations on the organizational design of product family generations
CN104750089B (en)Sensor signal detection method and device
Di Jasio et al.PIC Microcontrollers: know it all
Subramaniam et al.Driving cycle tracking device big data storing and management

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
C14Grant of patent or utility model
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp