Getting Touchwake to respond to the touchkeys - Galaxy Note II, Galaxy S III Developer Discussion

Hi,
I was wondering if someone could guide me in the right direction. I'm trying to extend touchwake's functionality to the touchkeys (while holding the device, I find it's easier for me to tap a key than the screen).
I've almost gotten it working by copying the changes to the old cypress driver that had touchwake functionality built in.
Here is my code: https://dl.dropboxusercontent.com/u/21884233/cypress-touchkey.txt
The problem is the code in cypress_touchwake_disable(). I get this build error:
cypress-touchkey.c:992:43: error: 'struct i2c_client' has no member named 'update_work'
When I gut the function just to test everything else, touchwake otherwise works as expected. Can anyone suggest how to get touchwakedevdata to have the data it's looking for? I have set touchwakedevdata = devdata; in the probe function, as the original implementation did.
Edit:
Fixed. The problem was using i2c_client instead of touchkey_i2c for *touchwakedevdata.

Related

[HACK REQUEST] Manual Orientation Change (Spoof Keyboard Slide Out?)

I'm tired of Automatic Orientation switching! Whether I'm walking down the street too roughly, in the process of pulling my phone out of my pocket, wanting to read something lying down in bed, or coming back to landscape mode from a lockscreen...the automatic orientation seems to be my enemy more often than my savior.
But before you tell me turn it off, I still want to be able to reorient my phone into landscape mode on demand. I have a MyTouch so I don't have personal experience with the wonderful hardware keyboard you G1, Droid, Cliq, etc. owners have. If I understand it correctly, when you slide out your keyboard the screen reorients to landscape and stays that way?
My question...can this action be spoofed on a phone that doesn't have a slide out hardware keyboard? Is there some flag that can be toggled? Some config file that can be edited? Can this be done with an App? A script? I have a feeling it will require root. Could it be cooked directly into a ROM?
Ideally I'd be able to co-opt a hardware key (maybe long-press back button) to toggle the orientation. I could also deal with having a shortcut in the Notification Drawer to perform the toggle.
It was my intention to investigate this on my own, teach myself android development and do some deeper poking around if it required root. I'm still going to do that...eventually. But I thought I'd open this up to others with much more knowledge to see if anybody else is interested in this or has a better idea of what this would require.
What do ya think? Would you want this feature or am I the only one? Would you want to develop it? Do you have any info that could help us?
keywords: automatic orient orientation rotate rotation hardware keyboard slide spoof
download spare parts from the market if you don't have it already. You can use that to toggle automatic orientation on the launcher.
You can go to settings to toggle automatic orientation for the apps in the sound and display settings.
UberMario said:
download spare parts from the market if you don't have it already. You can use that to toggle automatic orientation on the launcher.
You can go to settings to toggle automatic orientation for the apps in the sound and display settings.
Click to expand...
Click to collapse
Thanks but I'm familiar with both of those.
Well after some more snooping I found this post about remapping keys:
http://forum.xda-developers.com/showthread.php?t=551344
Might help with part of this problem. We'll see if it leads me in the right direction...
I spent a bit of time searching through the source and following the various hardKeyboardHidden flags but that didn't really get me anywhere.
Does someone with a G1 (or Droid, or Cliq or whatever slidey phone I guess) want to do me a real quick favor? I want to see if there is a keyevent generated when you slide the keyboard out and back in. To check this:
Plug your phone in.
Run
Code:
adb shell getevent
Tell me what your device mapping is. Should look something like this:
Code:
add device 1: /dev/input/event5
name: "compass"
add device 2: /dev/input/event4
name: "sapphire-keypad"
add device 3: /dev/input/event3
name: "sapphire-nav-button"
add device 4: /dev/input/event2
name: "sapphire-nav"
add device 5: /dev/input/event1
name: "synaptics-rmi-touchscreen"
add device 6: /dev/input/event0
name: "h2w headset"
Slide your keyboard out and check if there are events.
Slide your keyboard in and check for events.
Paste the events here.
This should tell me the scancode if there is one. Getevent and sendevent are pretty interesting. With sendevent you can simulate any keypress or touchscreen input or whatever.
Thanks!
A kernel point of view is to send a SW_LID 0/1 event. Still, it can be done from userland with uevent.
phhusson said:
A kernel point of view is to send a SW_LID 0/1 event. Still, it can be done from userland with uevent.
Click to expand...
Click to collapse
Ah. Thanks for the keywords! They helped a lot:
http://www.google.com/codesearch?q=package:git://android.git.kernel.org+SW_LID&hl=en
http://www.google.com/codesearch/p?...ckage:git://android.git.kernel.org uevent&d=1
So it doesn't look like it'll be as easy as I was hoping, but maybe one day I'll figure out how to play with uevent. This does mean I'll have to write some C code, right? I'll save that research for another day but feel free to pitch in if you have any tips on where I could get started. I haven't really looked into what it takes to run C on Android.
I'd like to be able to shake the phone in a certain way to get it to rotate, but not just to rotate whenever I happen to tilt the phone. It should be a conscious event.

[Q] Automatic Date & Time setting not saving

UPDATE: See Post 3 for results. (Tl;dr: disabling a badly!intentionalbad coded broadcastreceiver fixed my issue)
Anyone have an issue with the Automatic Date & Time setting not sticking as it should?
I like keeping my phone 8 minutes ahead. So I uncheck Auto Date & Time, then adjust the time.
Yet every time I reboot or shutdown and restart the phone, the setting won't stick. It will always revert back to Automatic Date and Time.
It's really annoying.
It happen on Stock KD1, and having just odin flashed stock KD2, still happens. Anyone else have this issue?
Checked the logcat while rebooting. Seems the system server makes the setting change right before this thing finishes booting (broadxasts the boot.completed intent). I can add the relevent log entries when i get home. Any ideas?
Code:
V/SettingsProvider( 2731): system <- value=1 name=auto_time
V/SettingsProvider( 2731): property: sys.settings_system_version=6
I/GsmServiceStateTracker( 2819): Auto time state changed
V/SettingsProvider( 2731): notifying: content://settings/system/auto_time
I/DateTimeSettingsBroadcastReceiver( 2878): ipAddress :null :Port : null
E/SettingsIntentReceiver( 2878): USB debugging enabled
E/Setting ( 2878): Intent Action android.intent.action.BOOT_COMPLETED
Mucked around. Being led all sorts of places.
Most importantly, seems like DateTimeSettingsBroadcastReceiver.smali in Setting.apk is set to go as follows:
Code:
onReceive(context, intent)
If (intent == "android.intent.action.BOOT_COMPLETED") {
Log.i("shlim","onReceive: Boot Complete. ")
#shows up on my adb logcat as "I/shlim ( 2878): onReceive: Boot Complete. "
Settings.System.putInt(context.getContentResolver(), Settings.System.auto_time, 1);
updateWifiProxyURL(); #why is this in DateTimeSettingsBroadcastReceiver anyway??
}
return(void);
}
The damn thing is written to ALWAYS change auto_time to on, anytime it receives a Boot Complete intent!!! WTFCRAPCODINGOMFGDIEINABLOODYFIREPLZKTHXZ
No seriously, wtf purpose is that, unless there is some hardware bug or something, and even then, it should be commented. DateTimeSettingsBroadcastReceiver.java is not apart of the kd1 sources samsung has shared.
The Fix? Two options (third being live with it, but well, frak that).
1) Make a change to the decompiled stock Settings.apk DateTimeSettingsBroadcastReceiver.smali to fix this over sight. I am not a android developer or rom hacker. I know enough to find this mess right now, and how/when to change a simple string (did that on my Pandigital Novel to change how the notification bar clock is displayed) or integer value. I don't recall if we can downright change an entire method to pretty much remove an entire if section. (Last I remember was changing a StringBuilder section, which in real code is just stringC = stringA + stringB statement) Note: if you use a web/http proxy, the method would need to be changed so that the auto_time part is not done, while the updateWifiProxyUrl is. Scratch that. There is a WifiSettingsBroadcastReceiver.smali that has the SAME EXACT updateWifiProxyUrl method, that also runs on receiving the Boot_Completed intent... Crap coding.
2) Use some app like AutoStarts, which can change which broadcastreceiver is triggered or not I lucked out. The second "Settings" receiver under the "After Boot" section is the datetimesettingsbroadcastreceiver I needed to get rid of. Disabled it, no other intents were disabled as a result, reboot, and BINGFingBango no more reverting to auto_time = 1, no more Automatic Update of Time, and I am golden.
Time to pass out. Screw you samsung, you win this time.

[Q] How to change value for keyboard system setting (barcode scanning)

Hi,
I'm currently in the process of turning some Nexus 7 tablets into hand-held scanners that we will use with our SAP ERP system to carry out transactions related to inventory management. I was able to configure most of the settings that I needed to and have successfully locked down the tablets causing them to act directly as kiosk type devices (yah). I have one problem left and that is when I plug the barcode scanner into the tablet (via Micro USB) it automatically disables the on screen keyboard. I'm aware that the system recognizes the scanner as a text input device and that is why it disables the on screen keyboard. I found that I can go into the SettingsLanguage & InputDefault, and change the input method for the Hardware/Physical Keyboard to off which in turn allows me to use both the on screen keyboard and the barcode scanner at the same time (perfect! right?). They need the on screen keyboard to type in their credentials with but also scan material id's, batch number, etc. with the barcode scanner. However the problem it that whenever the scanner is unplugged or the power is turned off the hardware/physical keyboard setting goes back to on thus locking the on screen keyboard from being accessed. Since we will have the tablets locked down, we will need some solution that will automatically turn this physical keyboard value to off whenever the scanner is plugged in as the user will not be able to navigate to the system settings (nor would we want them to). I initially thought that I could edit the code to change the default value for this setting to off however after some extensive research I haven’t found where this setting resides or how to change the value. I also thought if I could use a tasker like program to automatically change the setting to off whenever a physical keyboard is enabled that this would also work but I have not found a program that will allow me to automate in the details that I need. Can anyone please shed some light on this problem? Does anyone know where the value resides in the API/Android OS? It there a program that I could use to automate changing this setting whenever a physical input device (keyboard) is recognized by the system? Has anyone ever heard of someone successfully integrating barcode scanning with any android tablets (specifically SAP)?
Thank you for your time!
Cory
hello,
I assume that you have input fields in your tablet screend and when you click it a keyboard shows up. I am also searching a similar application novadays and found out this app: barcode-scanner-keyboard-for-android. you can find it in the market.
Basicly it installs a replacement keyboard to your tablet and during input if you change your stock keyboard to this, you can both scan barcode then send enter command by keystroke or other commands. when you check the link you will understand what i mean.
enjoy.

[Kernel-Module] [MM] Sweep2Wake kernel module for Marshmallow

First things first: Hey everyone. Some of you may know me from other devices or because of some Moderator related business. Anyways, I recently thought I needed a tablet upgrade and so decided to order a shield tablet. I have been going through some threads, and was actually kinda surprised that this nice piece of technology doesn't have more development going on, especially regarding kernels.
After a few days of getting to know the tablet I noticed one very useful feature missing: sweep2wake, or at least doubletap2wake.
Unfortunately, though, Nvidia did not yet release the kernel sources for their marshmallow kernel, so I can't add it myself that easily. Which is why I had to make a detour adding s2w to the kernel using a module. This, however, has the downside that I cannot prevent the touchscreen driver from suspending, nor get the information whether the screen is turned on or off. Therefore I need a dedicated background service to retrieve exactly this information and reenable the touchscreen driver.
Requirements
Android Marshmallow
Root
Both the kernel module and my app
Installation
Download the latest kernel module and app
Install the app
Push the kernel module to your internal storage (/sdcard/sweep2wake.ko)
Usage
Open the app and press "insmod"
--> this will load the module but also set selinux to permissive
--> S2W is now up and running, but can only be used to turn the screen off
Press "start" to start the background service
--> This will reenable the touchscreen driver when the screen got turned off and also tell S2W that the screen is turned off
--> S2w will now work perfectly fine as long as the tablet is plugged in or another app holds a wakelock. If this is not the case and the tablet is in deep sleep, you will not be able to wake the device and touch input might not work after turning the screen on manually. If this is the case, just turn the screen off and back on and it will work as usual again.
--> In order to wake the device at all times, start the service with the "enforcing" switch turned on. This will make the service hold a wakelock while the screen is off. However, your battery will drain rather rapidly as the tablet cannot go into deep sleep
To stop the service again, simply press "stop"
Keeping in mind that this is still in a rather early stage, I did not add a "enable on boot" option for the service.
I really hope that Nvidia releases the M sources soon, so I can add S2W and DT2W to the kernel properly.
This module should be compatible with all (current) Marshmallow firmwares, on both the old and new shield.
XDA:DevDB Information
Sweep2Wake Module, Kernel for the Nvidia Shield Tablet
Contributors
laufersteppenwolf
Source Code: https://github.com/laufersteppenwolf/android_kernel_nvidia_shieldtablet_modules
Kernel Special Features: Sweep2Wake
Version Information
Status: Beta
Created 2016-01-16
Last Updated 2016-01-22
They've got a new repository up, which is not yet listed on their web page. Haven't checked, but these should be the marshmellow sources.
repo init -u git://nv-tegra.nvidia.com/manifest/android/binary.git -b rel-st8-l-r7-partner -m tlk/shieldtablet.xml
repo sync -j5
njhuiz said:
They've got a new repository up, which is not yet listed on their web page. Haven't checked, but these should be the marshmellow sources.
repo init -u git://nv-tegra.nvidia.com/manifest/android/binary.git -b rel-st8-l-r7-partner -m tlk/shieldtablet.xml
repo sync -j5
Click to expand...
Click to collapse
Nope, it's not the MM kernel. these sources are actually what my module is based on
laufersteppenwolf said:
Nope, it's not the MM kernel. these sources are actually what my module is based on
Click to expand...
Click to collapse
First of all, thnx for your work and bring this expected feature.
About sources, we are using rel-24-sb-r1-partner branch from Nvidia for CM-13.0 and Bliss6. This seems to be latest code for latest K1 MM OTA. Have you explored it ?
Very nice, thanks for starting work on the tablet. I've got requests for adding this to my CM builds, but I don't have the kernel experience to add it myself. Once I've gotten both roth and shieldtablet stable on cm-13.0 and pushed to official, I will want to look into pulling this in for both. It should port to the M kernel pretty directly. Maybe a difference in the mach-tegra file, but that should be it. The touch failing to re-enable sounds very familiar... Custom ROMs had the issue for a while, caused by blobbing the powerhal. It was mitigated for a while, but after we started compiling the powerhal, we haven't seen it since. I'd be interested to know if this was compiled into the kernel (not as a module) for a custom ROM if the problem still occurs.
Did you upload the code for the apk somewhere? I'm kinda curious how you are triggering touch enable/disable. By writing to the sysfs file like the powerhal does?
Are there any other obvious features missing in the kernel? The one that bugs me a bit is volume/button controls on headphones. Seems that needs kernel support and Nvidia didn't write that in.
BitOBSessiOn said:
First of all, thnx for your work and bring this expected feature.
About sources, we are using rel-24-sb-r1-partner branch from Nvidia for CM-13.0 and Bliss6. This seems to be latest code for latest K1 MM OTA. Have you explored it ?
Click to expand...
Click to collapse
No, I did not. I will look into it, though, as I definitely need a better kernel than the stock one I am running ATM
If you need a hand some time, feel free to drop me a PM and I will see what I can do
Steel01 said:
Very nice, thanks for starting work on the tablet. I've got requests for adding this to my CM builds, but I don't have the kernel experience to add it myself. Once I've gotten both roth and shieldtablet stable on cm-13.0 and pushed to official, I will want to look into pulling this in for both. It should port to the M kernel pretty directly. Maybe a difference in the mach-tegra file, but that should be it. The touch failing to re-enable sounds very familiar... Custom ROMs had the issue for a while, caused by blobbing the powerhal. It was mitigated for a while, but after we started compiling the powerhal, we haven't seen it since. I'd be interested to know if this was compiled into the kernel (not as a module) for a custom ROM if the problem still occurs.
Did you upload the code for the apk somewhere? I'm kinda curious how you are triggering touch enable/disable. By writing to the sysfs file like the powerhal does?
Are there any other obvious features missing in the kernel? The one that bugs me a bit is volume/button controls on headphones. Seems that needs kernel support and Nvidia didn't write that in.
Click to expand...
Click to collapse
First off, no, you cannot just cherry-pick this patch into another kernel. This is made to be working as a kernel module only. It'll most likely cause the kernel not to boot anymore when cherry-picked.
It should be rather easy to implement this directly into a kernel, though.
No, I did not upload the app's sources yet, I can, though, if you want me to. And yes, I do enable the ts driver by writing to the sysfs node.
Well, TBH, there's a lot that can be done to the kernel, it just depends on what one thinks is really necessary
Volume control is not kernel related, though. The kernel only passes the information "vol up pressed" on to the Android system, everything else is handled by Android's framework.
laufersteppenwolf said:
First off, no, you cannot just cherry-pick this patch into another kernel. This is made to be working as a kernel module only. It'll most likely cause the kernel not to boot anymore when cherry-picked.
It should be rather easy to implement this directly into a kernel, though.
Click to expand...
Click to collapse
I just glanced through the commit, but nothing stood out to me as working only for 'm' vs. 'y'. What in particular would cause a problem?
laufersteppenwolf said:
Well, TBH, there's a lot that can be done to the kernel, it just depends on what one thinks is really necessary
Volume control is not kernel related, though. The kernel only passes the information "vol up pressed" on to the Android system, everything else is handled by Android's framework.
Click to expand...
Click to collapse
I looked into the volume control thing a little while back. The code to detect the inaudible tone used by the headset buttons wasn't implemented in the stock kernel at that time. I haven't looked at the M kernel yet, but I expect it's the same.
I'm not one for extravagant features in a kernel, especially for the official CM devices I maintain. But when there are features missing that people expect as standard these days, I'll make an exception. D2W is one (not that I'd use it personally, but enough people expect it), and headset volume is another.
Steel01 said:
I just glanced through the commit, but nothing stood out to me as working only for 'm' vs. 'y'. What in particular would cause a problem?
I looked into the volume control thing a little while back. The code to detect the inaudible tone used by the headset buttons wasn't implemented in the stock kernel at that time. I haven't looked at the M kernel yet, but I expect it's the same.
I'm not one for extravagant features in a kernel, especially for the official CM devices I maintain. But when there are features missing that people expect as standard these days, I'll make an exception. D2W is one (not that I'd use it personally, but enough people expect it), and headset volume is another.
Click to expand...
Click to collapse
well, the general implementation including the modification of some other files (makefile, scripts,..)
But good news is I got the 3.10.67 kernel booting, which means it's time for yet another werewolf kernel S2W and DT2W is already implemented, but not yet properly working. Needs some more work.
My bad, I thought you were referring to the device's volume buttons and the "keep pressed for skip" feature
Haven't looked into that either TBH.
Hey man! Thanks for this feature! I used your kernel on LG Optimus 4X HD hope you can give us more rom development. Best of luck!
Enviado do meu wx_na_wf através de Tapatalk

Question config.txt & config.ini entries and macrodroid trigger

Three questions in this one.
1. In my config.txt there is an entry:
ro.fyt.splitscreen=0
Can anyone confirm what it does? I have attempted value of 1 and 2 (assumed it may not have been binary) but there is no result. I was hoping that it would force a split screen to stay a split screen when awakening. I have looked in the skipkillapp.prop but didn't see anything particularly relevant.
2. Continuing on from question 1, I have attempted to use Macrodroid to create a split screen which worked under Macrodroid test conditions but I cannot find a trigger that will run the macro in real life scenarios. I have attempted triggers of power on, screen on, wake from sleep, charging on and a few others. I have my Headunit set to sleep in factory settings. I could probably get the trigger to piggyback off my bluetooth connection to my phone but I would like something more instant. Does anyone have success in getting Marcodroid to trigger from a head unit screen on / wake up when the car powers up?
3. In the config.ini there are mic vol and mic level. What is their role in that file? They don't seem to overwrite the config.txt values for mic as changes in config.txt for mic change mic response. There is also reference to GOC-Android in Config.ini... Any ideas?
ludditefornow said:
Three questions in this one.
1. In my config.txt there is an entry:
ro.fyt.splitscreen=0
Can anyone confirm what it does? I have attempted value of 1 and 2 (assumed it may not have been binary) but there is no result. I was hoping that it would force a split screen to stay a split screen when awakening. I have looked in the skipkillapp.prop but didn't see anything particularly relevant.
2. Continuing on from question 1, I have attempted to use Macrodroid to create a split screen which worked under Macrodroid test conditions but I cannot find a trigger that will run the macro in real life scenarios. I have attempted triggers of power on, screen on, wake from sleep, charging on and a few others. I have my Headunit set to sleep in factory settings. I could probably get the trigger to piggyback off my bluetooth connection to my phone but I would like something more instant. Does anyone have success in getting Marcodroid to trigger from a head unit screen on / wake up when the car powers up?
3. In the config.ini there are mic vol and mic level. What is their role in that file? They don't seem to overwrite the config.txt values for mic as changes in config.txt for mic change mic response. There is also reference to GOC-Android in Config.ini... Any ideas?
Click to expand...
Click to collapse
For 1): Sorry to give a non-helping answer here, but I don't know either. I wondered about that one myself and also searched 4pda extensively, but can't find anything.
2) This will not work. As of Android 10 apps are not allowed to do a split-screen, only the user him/herself. It is a new security feature. (And then adding to 1): Maybe the ro.fyt.splitscreen still worked on the sc9853i Android 8.1 versions. I will get my device back on power on the bench.)
3) config.ini? Which config.ini? I searched the latest Joying and Mekede firmware and can't find a config.ini.
surfer63 said:
For 1): Sorry to give a non-helping answer here, but I don't know either. I wondered about that one myself and also searched 4pda extensively, but can't find anything.
2) This will not work. As of Android 10 apps are not allowed to do a split-screen, only the user him/herself. It is a new security feature. (And then adding to 1): Maybe the ro.fyt.splitscreen still worked on the sc9853i Android 8.1 versions. I will get my device back on power on the bench.)
3) config.ini? Which config.ini? I searched the latest Joying and Mekede firmware and can't find a config.ini.
Click to expand...
Click to collapse
1. You were helpful. You confirmed to me that the info is not easily obtainable. I've several hours that I have spent today looking for this and learning other things andf made a list of items where I need to learn and research more. This item will now go further down the list. So thank you.
2. It does work already when I trigger from within Macrodroid. The issue is that I can't find an auto trigger in macrodroid what works when I turn on a screen. For a moment forget that I want split screen. I just want Macrodroid to dop *something* when the screen comes on when I start the car.
I can't find what turning on the head unit triggers in macrodroid. Something must happen in the head unit OS that macrodroid can see, I would have thought.
3. I think I have answered this one already. Theshortcut was found in oem/apps. The config seems to be denoting what server or service it should look for for certain info. I have translated the chinese text and it makes sense now.
Attached is the config.ini with chinese characters and then below the end is the translated to english.
I'll put this here more for a reference for me.
thanks for replying.
ludditefornow said:
3. I think I have answered this one already. Theshortcut was found in oem/apps. The config seems to be denoting what server or service it should look for for certain info. I have translated the chinese text and it makes sense now.
Attached is the config.ini with chinese characters and then below the end is the translated to english.
I'll put this here more for a reference for me.
thanks for replying.
Click to expand...
Click to collapse
Thanks.
It must be created or copied somehow at the moment of flashing, or first boot or maybe on every boot. I can't find it in any of the partitions in the firmware.
When I look in the firmware system.img (system.new.dat.br) it is a symlink to "config.ini -> /oem/config.ini", but the oem is freshly created on flashing and than "filled" with the AllAppUpdate.bin apps.

Categories

Resources