My android devices 'power button'
sometimes use enable.
originally , when I clicked power button. immediately showing power menu.
but mostly not showing
I command in emulater
cat /proc/bus/input/devices
then showing
I: Bus=0000 Vendor=0000 Product=0000 Version =0000
N: Name="Android Power Button"
P: Phys=
S: Sysfs=/devices/virtual/input/input16
U: Uniq=
H: Handlers=kbd event13
B: PROP=0
B: EV=3
B: KEY=100000 0 0 0
I can check power button connected my device.
perhaps, Using this . power button control in my app?
surely, it should work power button
thanks.
Related
I am working on a kiosk project using an android tablet.If there is no input power to the kiosk for a long time then, the tablet will eventually shutdown.In order to auto-reboot the tab when the power comes back I modified the code in my tabs battery animation file(ipod) using:
#!/system/bin/sh
sleep 300
/system/bin/reboot
However,during the sleep period(shown above),the tabs screen remains in the ON state (and hence takes longer retries for the tab to charge and bootup).I need to turn the screen OFF.
What is the command I should use prior to the sleep command to turn my tabs screen OFF during the charging/bootup stage. Thanks !
Try this command too,
echo 100 > /sys/devices/platform/nov_cabc.0/leds/lcd-backlight/brightness
or
echo 100 > brightness
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
Rather than using a drag or swipe command in the android debug bridge or AndroidViewClient like this:
device.drag((600,800),(600,1200), 1000)
device.shell('input touchscreen swipe 600 800 600 1200 1000')
Is there some way to simulate something like the following?
1. press down on some coordinates (eventType=DOWN)
2. sleep 2 seconds (i.e. keep holding there)
3. move to some other coordinates
2. sleep 2 seconds (i.e. keep holding there)
5. release (eventType=UP)
Basically, you touch, hold there for a few seconds, drag and keep holding there for a few seconds, then release the pad.
If you take a look at AdbClient.longPress() you will see how the long press event is sent for some keys:
if name in KEY_MAP:
self.shell('sendevent %s 1 %d 1' % (dev, KEY_MAP[name]))
self.shell('sendevent %s 0 0 0' % dev)
time.sleep(duration)
self.shell('sendevent %s 1 %d 0' % (dev, KEY_MAP[name]))
self.shell('sendevent %s 0 0 0' % dev)
You can do something similar for your case.
To get an idea of what you should write, do the same set of events you mentioned and analyze them using getevent.
I successfuly installed (after 1 week of work) Android on BeagleBoard C4. As display I use Lilliput 669 with an eGalax Usb TouchController. Everything seems ok with exception of touchscreen which have X and Y axes reverse.
I: Bus=0003 Vendor=0eef Product=0001
Version=0210 N: Name="eGalax Inc. USB
TouchController" P:
Phys=usb-ehci-omap.0-2.2/input0 S:
Sysfs=/devices/platform/ehci-omap.0/usb1/1-2/1-2.2/1-2.2:1.0/input/input1
U: Uniq= H: Handlers=event1 B: EV=9
B: ABS=600000 3
I: Bus=0003 Vendor=0eef Product=0001
Version=0210 N: Name="eGalax Inc. USB
TouchController" P:
Phys=usb-ehci-omap.0-2.2/input0 S:
Sysfs=/devices/platform/ehci-omap.0/usb1/1-2/1-2.2/1-2.2:1.0/input/input2
U: Uniq= H: Handlers=mouse0 event2 B:
EV=1b B: KEY=400 0 0 0 0 0 0 0 0 0 0
B: ABS=600000 3 B: MSC=10
Do you know how to reverse X and Y axis for my touchscreen ?
I know that this post is old, but this was a problem I encountered recently while I swapped the broken touchscreen from my Android tablet. The replacement was a poorly manufactured p.o.c.s... Anyway, after I plugged it in, the xy was swapped first, then I turned the connector over and it was just an x-axis problem. I knew that if I flipped the glass over, it would fix it, but that would make the connector too far away from the port on the motherboard. So I just plugged it in, and went to the settings of the tablet, and calibrated the touchscreen from the settings menu. Done.
That's it.
SOLUTION:
Just go to the settings option in the menu and find the "Touchscreen Calibration" option and calibrate it again. This should fix it :) Or just flip connector around and try again :)
The reason I posted this is to help others who might have this problem :)
Inside my app, I need a way to turn off the lights on the standard Android phone keys (Home, Menu, Back, and Search) - how can I do this programmatically?
According to this page, the hardware key backlights can be controlled by writing to a specific file in the filesystem with superuser privileges (i.e. phone must be "rooted"):
Q: How can I control the keyboard
backlight?
A: The keyboard backlight can be
controlled via
/sys/class/leds/keyboard-backlight/brightness.
It appears that it's a simple on-off
control (echoing '0' turns it off,
echoing '1' or higher turns it on).
For some reason, the default system
backlight control stuff seems to set
this to "83", but I don't know why. I
can't seem to see any difference
between 83 and any other number. The
file is readable by anyone, but only
writable by root, so you'll need root
access to the phone to manipulate it
this way.
So to turn off the backlight programmatically, you could invoke exec() on the Runtime like so:
Runtime r = Runtime.getRuntime();
r.exec("echo 0 > /system/class/leds/keyboard-backlight/brightness");
Depends on what you are doing, but would probably be wise to check the result of exec() afterwards to see if a write error occurred.
Note: I tested this on my own phone and it seems to work without acting as root. However, this may not be the case on every phone, so you may have different results.
This is applicable only for the device samsung devices:
To get the BackLight sate:
int backLight = Settings.System.getInt(getContentResolver(), "button_key_light");
// if it return -1 it means that light is on
// if it return 0 the light is off
// some time it will return values like 600(1.5 sec)
if you want to put the backLight as off u can do like this
Settings.System.putInt(getApplicationContext().getContentResolver(), "button_key_light", 0);