According to Android documentation: https://developer.android.com/guide/topics/sensors/sensors_motion.html
linear acceleration = acceleration - acceleration due to gravity .
Which seems to work my 2 phones and LG Watch Urbane W150.
BUT, on my new Huawei Watch 2, linear acceleration still contains acceleration due to gravity. I'm running the same app on all devices, and only on Huawei Watch 2 I see this problem.
The command adb shell dumpsys sensorservice for LG Watch Urban W150 give this as output when the watch is lying on table:
Linear Acceleration: last 10 events
1 (ts=24353.048620089, wall=17:28:40.031) -0.92, -0.15, 0.23,
2 (ts=24353.115270480, wall=17:28:40.086) -0.79, -0.17, 0.33,
3 (ts=24353.181920870, wall=17:28:40.146) -0.75, -0.14, 0.21,
MPU6515 Accelerometer: last 50 events
1 (ts=93043.344428463, wall=12:33:30.392) -8.18, -2.35, 4.83,
2 (ts=93043.352240963, wall=12:33:30.392) -8.20, -2.35, 4.87,
3 (ts=93043.367865963, wall=12:33:30.392) -8.14, -2.35, 4.81,
As you see the x,y and z for LG watch is close to zero which is expected.
However, the same command but for Huawei Watch 2 gives:
huawei Linear Acceleration Sensor: last 10 events
1 (ts=31287.761652539, wall=17:31:07.258) -2.27, 6.58, 7.51,
2 (ts=31287.829730716, wall=17:31:07.325) -2.48, 6.41, 8.10,
3 (ts=31287.891682226, wall=17:31:07.387) -2.55, 6.60, 7.39,
BMI160 3-axis Accelerometer: last 50 events
1 (ts=100179.672482189, wall=12:39:19.258) 9.30, -3.46, 0.83,
2 (ts=100179.682469756, wall=12:39:19.258) 9.32, -3.46, 0.83,
3 (ts=100179.692457323, wall=12:39:19.258) 9.30, -3.47, 0.84,
And you see weird output for the linear acc sensor.
Is it a bug in Huawei Watch 2?
All huawei equipment have this problem, maybe the SOC design issue or the driver's math is wrong.
Tested in huawei p40 mate20 p10, all got high bias result.
Related
I use a touch screen 5 inch(800*480) tft LCD HDMI with raspberry pi 3 ,
I use this driver.
The touch driver works and emits points but shows the mouse cursor in the display. How so I disable the mouse cursor on the touch screen?
below picture show my problem .
OS Version:
1.0.12.5501548
My config.txt in boot files is:
max_usb_current=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
When I add below config to config.txt mouse cursor disappeared but the driver doesn't work also.
dtoverlay=ads7846,cs=1,penirq=25,penirq_pull=2,speed=50000,keep_vref_on=0,swapxy=0,pmax=255,xohms=150,xmin=200,xmax=3900,ymin=200,ymax=3900
I'm testing the TYPE_LINEAR_ACCELERATION sensor on Android - I'm setting it up in the standard way I think:
acceleration = sensorManager.getDefaultSensor(Sensor.TYPE_LINEAR_ACCELERATION);
...
sensorManager.registerListener(this, acceleration, kMotionUpdatePeriod);
...
public void onSensorChanged(SensorEvent event)
{
switch(event.sensor.getType())
{
case Sensor.TYPE_LINEAR_ACCELERATION:
Logger.info(this,"Linear Accel %.2f %.2f %.2f",event.values[0], event.values[1], event.values[2] );
break;
}
}
My understanding is that LINEAR_ACCELERATION is meant to be using sensor fusion to remove gravity from the accelerometer readings and produce the net acceleration the device is experiencing.
I've tested this on an Android Wear watch (Sony SWR50) running 5.1.1 and when the device is resting on the table I get these kinds of values:
03-04 09:58:58.309 Linear Accel -0.20 0.74 0.14
03-04 09:58:58.328 Linear Accel -0.20 0.70 0.14
03-04 09:58:58.341 Linear Accel -0.23 0.71 0.13
Also tested on a Galaxy S3 running 4.3 and I get:
03-04 09:48:22.307 Linear Accel -0.13 -0.11 -0.39
03-04 09:48:22.412 Linear Accel -0.11 -0.09 -0.34
03-04 09:48:22.507 Linear Accel -0.09 -0.11 -0.42
I'd expect a bit of an error on these - but these values seem way to high when the device is just sitting on the desk. The total acceleration works out to be around 0.7 m/s2 for the watch and 0.4 m/s2 for the Galaxy.
I'm also developing this on iOS and the userAcceleration figures I get from iOS devices when they are stationary are 0.01 m/s2 at the most which is what I think you'd expect.
Is there something I am missing when trying to use LINEAR_ACCELERATION?
Is anyone else getting figures more like I am getting from iOS on their Android devices?
OK so stupid mistake.
iOS is using units of G for its acceleration values, Android is using m/s2, hence a factor of 9.81 difference.
I'm struggling with calibration of a touchscreen on Android plataform.
It is an USB Single-Touch Touchscreen from vendor 0dfc and product 0001 as checked with dmesg:
<6>[ 4118.091541] input: USB Touchscreen 0dfc:0001 as /devices/platform/usb20_host/usb2/2-1/2-1.3/2-1.3:1.0/input/input23
I'm pushing the Vendor_0dfc_Product_0001.idc file /data/system/devices/idc/ (following the documentation from android source - IDC
I got the touch device with all requirements for single touch events:
root#android:/ # getevent -il /dev/input/event3
add device 1: /dev/input/event3
bus: 0003
vendor 0dfc
product 0001
version 0202
name: "USB Touchscreen 0dfc:0001"
location: "usb-usb20_host-1.3/input0"
id: ""
version: 1.0.1
events:
KEY (0001): BTN_TOUCH
ABS (0003): ABS_X : value 540, min 0, max 32767, fuzz 0, flat 0, resolution 0
ABS_Y : value 289, min 0, max 32767, fuzz 0, flat 0, resolution 0
input props:
<none>
I also enabled the Pointer Location option from Developer options (Android settings) in order to debug this stage of calibration.
Setup 1
touch.deviceType = touchScreen
With this setup (1) all the gestures on the touchscreen take place at the up-left corner - just a few pixels left/right/up/down no matter the gesture (swipe). All the touchscreen get events. All the gestures are reversed - when swipe left the pointer goes right; when swipe up, the pointer goes down.
Setup 2
touch.deviceType = pointer
touch.gestureMode = pointer
With this setup (2), as expected, it shows a pointer, placed at the position from the last pointer device left (mouse). All the gestures on the touchscreen (no matter the swipe size) keep beaving like setup 1 - move only a few pixels with each swipe event, and with reversed axis.
Setup 3
touch.deviceType = pointer
touch.gestureMode = spots
With this setup (3) the result is the same as setup 2. I just did that to prove that the IDC file is being interpreted correctly.
At this stage, as you can check by now, I have a working IDC file (setup 1) requiring calibration for this touch device.
I tried a lot of combinations from other IDC files (internet samples) and from android source - IDC - ANY OTHER PROPERTY TOOK EFFECT (NOT A SINGLE ONE) - raw.*, output.*, touch.size.*
Does anyone knows how to calibrate properly a touch screen in Android that could guide me in this process?
Same here,
but my calibration app did't do anything.
After a while, reading /system/etc/init.sh i found the following:
mkdir -p /data/misc/tscal
touch /data/misc/tscal/pointercal
chown 1000.1000 /data/misc/tscal /data/misc/tscal/*
chmod 775 /data/misc/tscal
chmod 664 /data/misc/tscal/pointercal
Just run those commands manually, reboot, and start the calibration app
I have developed a few apps for the SmartWatch 1 that take advantage of the watch's gyroscope. I finally got a SmartWatch 2 to develop on, but I notice that the gyroscope is way less responsive. For instance on the SmartWatch 1 it seems that every movement no matter how slight is recorded. However on the SmartWatch 2 the readings seem to run on a 100 millisecond timer. Here is how I interact with the sensor:
private final AccessorySensorEventListener mListener = new AccessorySensorEventListener() {
public void onSensorEvent(AccessorySensorEvent mySensorEvent) {
sensorEvent = mySensorEvent;
float[] values = sensorEvent.getSensorValues();
currentX = values[0];
currentY = values[1];
currentZ = values[2];
}
}
I have also tried different variations for registering my sensor:
mSensor.registerInterruptListener(mListener);
-- and --
mSensor.registerListener(mListener, Sensor.SensorRates.SENSOR_DELAY_FASTEST, Sensor.SensorInterruptMode.SENSOR_INTERRUPT_DISABLED);
-- and --
mSensor.registerFixedRateListener(mListener, Sensor.SensorRates.SENSOR_DELAY_FASTEST);
All of these seem to give the same exact effect. Am I doing this wrong for the SmartWatch 2, or is the gyroscope in the SmartWatch 2 really just less responsive?
There isn't a gyroscope in the SmartWatch 2, but there is an accelerometer. The accelerometer is limited to a 10Hz sampling rate. This is why you are only seeing 10 samples per second. I don't know of any way to increase the rate any higher.
There is additional info in this post: Sony Smartwatch SW2 - accelerometer output rate
I write simple program to get various information: signal strength, cell info etc... To test I use two phones with the same Android version 2.1 - Sony Ericsson and Samsung Galaxy Spice.
To extract Neighbour Cell Info I use:
telephonyConnectionAdapter.getNeighboringCellInfos()
On SE I am able to get Neighbour Cell info and in adb logcat -b radio I can see:
D/GSM ( 488): [GsmSST] Poll ServiceState done: oldSS=[0 home T-Mobile.pl
T- Mobile.pl 26002 EDGE:2 CSS not supported -1 -1 RoamInd=-1 DefRoamInd=-1
EmergOnly=false] newSS=[0 home T-Mobile.pl T-Mobile.pl 26002 EDGE:2 CSS not
supported -1 -1 RoamInd=-1 DefRoamInd=-1 EmergOnly=false] oldGprs=0 newData=0
oldMaxDataCalls=20 mNewMaxDataCalls=20
oldReasonDataDenied=-1 mNewReasonDataDenied=-1 oldType=EDGE:2 newType=EDGE:2
D/GSM ( 488): [EONS] Reading data from EF_OPL or EF_PNN is not complete.
Suppress operator name display until all EF_OPL/EF_PNN data is read.
D/RILJ ( 488): [8847]> REQUEST_GET_NEIGHBORING_CELL_IDS
D/RILJ ( 488): [8847]< REQUEST_GET_NEIGHBORING_CELL_IDS [b01b59c7#18 [b01b5260#27] [] [b01b63f9#19] [b01b2f4f#17]
but the same application could not extract Neighbour Cell Info on Samsung - the list is empty and adb logcat -b radio looks:
D/GSM ( 1993): Poll ServiceState done: oldSS=[0 home Play Play 26006 (manual)
EDGE CSS not supported -1 -1RoamInd: -1DefRoamInd: -1] newSS=[0 home Play Play
26006 (manual) EDGE CSS not supported -1 -1RoamInd: -1DefRoamInd: -1] oldGprs=0
newGprs=0 oldType=EDGE newType=EDGE D/RILJ ( 1993): [5590]> REQUEST_GET_NEIGHBORING_CELL_IDS
D/RILC ( 1855): [5590]> GET_NEIGHBORING_CELL_IDS
D/RILC ( 1855): [5590]< GET_NEIGHBORING_CELL_IDS fails by E_REQUEST_NOT_SUPPORTED
D/RILJ ( 1993): [5590]< REQUEST_GET_NEIGHBORING_CELL_IDS error: com.android.internal.telephony.CommandException: REQUEST_NOT_SUPPORTED
The is one more important information. When I use magic code *#*#197328640#*#* on Samsung and enter to service menu. There are few visible Neighbour Cells.
Any idea what is going on? Or at least what does this mean?
"com.android.internal.telephony.CommandException: REQUEST_NOT_SUPPORTED"
Each manufacturer implements the low level functionality for their devices as they see fit. In this case, Samsung has decided not to support this feature on this device. This means that you will not be able to get the list of neighboring cells on this device.