Test kernel: Zoom bar acting as multitouch pinch to zoom

Search This thread

manekineko

Senior Member
Jul 26, 2009
1,005
229
Someone asked what the point of the new .39 kernel is, well here's a new feature I've coded up that was made possible due to the more modern kernel.

I have modified the touchscreen driver in the kernel so that the zoom bar is now working, and it sends signals to Android that make it think you're sending a multitouch pinch-to-zoom.

I've got it set so that it sends an input from the center of the screen. As you slide right, the driver tells Android two fingers are moving apart from the center. As you slide left, the driver tells Android two fingers are sliding from the sides towards the center. The net result is that the zoom bar works in any app that supports pinch to zoom.

I've uploaded a video showing it in action:
http://www.youtube.com/watch?v=GRWUzPveU14

I'm going to submit this patch soon, and I'd like it if some people would try it out and give any feedback before I do so. I suppose things to pay attention to would be any increased wonkiness in the touch response, as well as boundaries for the zoom bar. Also, if you have a better idea on how this should work, it's now or never.

Unfortunately, this is a modification of the new .39 kernel, which means that a lot of things are not working on it, and this test kernel will most likely not be suitable for daily use if you like wifi and the other things that don't work on .39 yet.

In order to install you must do the following:
1. Replace your zImage with the one attached.
2. Use the .39 haret (included in the zip for your convenience) with the .39 startup.txt line (set initrd_offset 0x00a00000)
3. Place the included android.hardware.touchscreen.multitouch.xml under /system/etc/permissions. I tried bind-mounting it from conf, but for some reason that did not work for me. If you don't do add this permission file, the multitouch points will still be sent to Android (and will show up in the app Multitouch Test), but Google's own apps like Browser will ignore them.
 

Attachments

  • KernelAttachments.zip
    2.1 MB · Views: 285

fortunz

Senior Member
Apr 19, 2009
859
130
inside
I assume pinch-to-zoom is pretty well supported in Android. Does this mean the zoom bar is now more supported (for zooming, button hacks aside) in XDAndroid than it ever was in officially baked HTC WinMo?

Impressive. Thanks for the vid. :D

I'm planning to give the .39 kernel a quick test run, hopefully this weekend. There's some software that crashes on me on open now and I'd like to see if its any different with .39. I'll try to give this a whirl then.

As for functionality, the p2z is cool, but not something I've been pining for. I don't know exactly what your plans are, but I'd love it if that function could be switched off easily (a line in startup.txt?), so future hacks creating, say, soft buttons on the bar instead could be more easily implemented.
 
  • Like
Reactions: manekineko

LinoX

Senior Member
May 10, 2005
383
123
44
Roma
I'd love it if that function could be switched off easily (a line in startup.txt?), so future hacks creating, say, soft buttons on the bar instead could be more easily implemented.
well that bar has been designed to be a zoom bar. you can do whatever you want with it but always a zoom bar remains :D using it as a "virtual button" is possible but on the phone you will always have the magnifying glasses printed :D
What you suggest is an hack to the original zoom bar design and it's not as useful as the zoom function (that on our resistive single touch screens is missing) :)
 

LinoX

Senior Member
May 10, 2005
383
123
44
Roma
All I suggest is flexibility. I'm not trying to steal your zoom ;)
All you are actually suggesting is complexity, indeed. A "soft" array button must be handled properly by the kernel / os / applications and it is a lot more than "one hack" for a function that will be probably not used because the zoom is a bit more important than a button :D
 

fortunz

Senior Member
Apr 19, 2009
859
130
inside
I'm going to have to break out the bold, aren't I? I'm not asking for soft buttons. I'm asking that this implementation be flexible enough to allow for future hacks like soft buttons, whether they are your favorite or not. I don't even know if the request is necessary, but I never imagined it would be controversial. If that flexibility really is too complex, forgive the request and ignore it.
 

Starfox

Senior Member
Jun 1, 2007
279
106
It's "controversial" because you are asking for a strip of capacitive touch to turn into buttons. As the OP indicated, implementing this requires not only a new kernel+touch, but files in system.ext2, so the system _thinks_ you have p2z when you still have a resistive screen. So what you are asking for is to make that "flexible" when the base feature has barely been coded+tested.

If you truly want capacitive soft buttons, look at the DIAM or RAPH. Back way then (2.0ish), the LED on the bottom button-panel/scroll would light up on finger contact (not pressed) when running xdandroid. It was more of a "wow it's cool" thing because it was a strip of capacitive touch with 5+ LEDs. I don't remember if the p2z worked with the center scrolly or not...

-- Starfox
 

arrrghhh

Inactive Recognized Developer
Feb 10, 2007
11,906
3,851
I'm going to have to break out the bold, aren't I? I'm not asking for soft buttons. I'm asking that this implementation be flexible enough to allow for future hacks like soft buttons, whether they are your favorite or not. I don't even know if the request is necessary, but I never imagined it would be controversial. If that flexibility really is too complex, forgive the request and ignore it.

Alright, settle down children.

I think you're looking a little too far ahead fortunz, but that's just my opinion.

To manekineko - holy crap dude, that was fast! Nice work, definitely want to check it out.

But if you're on CDMA... then I'd imagine the experience is painful with data connected... still, great work. I'm sure the .39 kernel folk will gladly accept your patches, that's seriously cool!
 

manekineko

Senior Member
Jul 26, 2009
1,005
229
Alright, settle down children.

I think you're looking a little too far ahead fortunz, but that's just my opinion.

To manekineko - holy crap dude, that was fast! Nice work, definitely want to check it out.

But if you're on CDMA... then I'd imagine the experience is painful with data connected... still, great work. I'm sure the .39 kernel folk will gladly accept your patches, that's seriously cool!

Yeah, after I got the .39 kernel, it took me like 30 minutes to get it working for the first time, and then a bit more time to clean up the code to look nicer.

Whereas I'd spent hours banging my head on the wall with .27, never quite sure where the problem was, since I thought I was sending all the right events in the driver. Now I know I was sending the right events (because it works in .39) which means that the problem must have been something in the kernel not passing along the multitouch sync events (I know it's that event missing from debugging the userland). That narrows things down quite a lot, but I don't think I really want to go back and spend the time fixing things up in the obsolete .27 kernel though.
 

Serren

Senior Member
Aug 19, 2008
186
31
Awesome work Manekineko!

I think the zoom bar code will be a fun addition to future cooks. It will be fun to see what uses people come up with. Be it soft buttons or just a zoom bar. Either way, cool stuff.
 

Starfox

Senior Member
Jun 1, 2007
279
106
There never is and will never be a "now or never" with Android. If you want a feature and it can be coded, take the source and run with it. You may run into walls, and there will be many, but at least you can try - that's the beauty of open source.

-- Starfox
 

manekineko

Senior Member
Jul 26, 2009
1,005
229
I assume pinch-to-zoom is pretty well supported in Android. Does this mean the zoom bar is now more supported (for zooming, button hacks aside) in XDAndroid than it ever was in officially baked HTC WinMo?

Yes it does :D

As for functionality, the p2z is cool, but not something I've been pining for. I don't know exactly what your plans are, but I'd love it if that function could be switched off easily (a line in startup.txt?), so future hacks creating, say, soft buttons on the bar instead could be more easily implemented.

Thanks for the suggestion. I'm not going to be implementing it at this time, but the way things are structured in the code, it wouldn't be hard for it to be done by someone interested in the future.

When I was fighting with getting .27 working, I considered at one point simply turning the zoom bar into soft buttons. However, I was never able to come up with a practical use for soft buttons on the zoom bar. The thing that makes it hard is that the list of keyevents Android understand are extremely limited.

You can see for yourself here:
http://developer.android.com/reference/android/view/KeyEvent.html
Set the filter level to API level 8 to see what's available on Froyo. Unfortunately, really useful keyevents like button zoom in/out only became available in Honeycomb (API level 11).

I'm not sure that soft buttons for things like home or power or search would be very convenient when they're not visible on the physical device, are right next to the screen, and could instantly rip you out of what you're doing.

Just in case anyone happens across this that is interested in doing so, here is how you'd probably want to do it:
Android's KeyInputQueue.java, which handles inputs from the touchscreen (and everything else). Do a search for readVirtualKeys and see that it reads from /sys/board_properties/virtualkeys.tssc_manager. Edit the driver so that it generates the virtualkeys file in the format specified in KeyInputQueue, and disable all of the topaz/rhodium zoom bar code.
 
  • Like
Reactions: Serren

randomblame

Recognized Developer
May 18, 2009
2,711
18,010
Thanks button activated! Great work!

whoops thanked fortunz accidentally -1 buddy :p
 
Last edited:

manekineko

Senior Member
Jul 26, 2009
1,005
229
If anybody could find an app that supports touch pressure on a regular kernel on XDAndroid, that would be really helpful. I need to check how much we support pressure to start with and make sure that still is the case with this patch.

I tried Crayon Doodle Lite from the Market, which claims to support pressure, but I'm not seeing any pressure on a regular no-zoom-bar build, so that's not working as a test. Or it may simply be the case that pressure touch has always been broken.
 

teemo

Senior Member
Nov 18, 2007
2,430
2,315
Kolding
Good job, but....

Broke my internet (is zoom tested with gprs or is it CDMA only ?)
Kernel.39+RIL2+F22 is running fine on my R100. After drop in of the Zoom-zImage, connection died.

Without zoom with working connection (SMS error is my operator NOT android):
k39_no_sms_log(537).txt

Zoom added - go to line 552
k39-zoom_no_data(552).txt
 

Attachments

  • k39_no_sms_log(537).txt
    55.1 KB · Views: 7
  • k39-zoom_no_data(552).txt
    61.3 KB · Views: 3

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    Someone asked what the point of the new .39 kernel is, well here's a new feature I've coded up that was made possible due to the more modern kernel.

    I have modified the touchscreen driver in the kernel so that the zoom bar is now working, and it sends signals to Android that make it think you're sending a multitouch pinch-to-zoom.

    I've got it set so that it sends an input from the center of the screen. As you slide right, the driver tells Android two fingers are moving apart from the center. As you slide left, the driver tells Android two fingers are sliding from the sides towards the center. The net result is that the zoom bar works in any app that supports pinch to zoom.

    I've uploaded a video showing it in action:
    http://www.youtube.com/watch?v=GRWUzPveU14

    I'm going to submit this patch soon, and I'd like it if some people would try it out and give any feedback before I do so. I suppose things to pay attention to would be any increased wonkiness in the touch response, as well as boundaries for the zoom bar. Also, if you have a better idea on how this should work, it's now or never.

    Unfortunately, this is a modification of the new .39 kernel, which means that a lot of things are not working on it, and this test kernel will most likely not be suitable for daily use if you like wifi and the other things that don't work on .39 yet.

    In order to install you must do the following:
    1. Replace your zImage with the one attached.
    2. Use the .39 haret (included in the zip for your convenience) with the .39 startup.txt line (set initrd_offset 0x00a00000)
    3. Place the included android.hardware.touchscreen.multitouch.xml under /system/etc/permissions. I tried bind-mounting it from conf, but for some reason that did not work for me. If you don't do add this permission file, the multitouch points will still be sent to Android (and will show up in the app Multitouch Test), but Google's own apps like Browser will ignore them.
    1
    I assume pinch-to-zoom is pretty well supported in Android. Does this mean the zoom bar is now more supported (for zooming, button hacks aside) in XDAndroid than it ever was in officially baked HTC WinMo?

    Impressive. Thanks for the vid. :D

    I'm planning to give the .39 kernel a quick test run, hopefully this weekend. There's some software that crashes on me on open now and I'd like to see if its any different with .39. I'll try to give this a whirl then.

    As for functionality, the p2z is cool, but not something I've been pining for. I don't know exactly what your plans are, but I'd love it if that function could be switched off easily (a line in startup.txt?), so future hacks creating, say, soft buttons on the bar instead could be more easily implemented.
    1
    Alright, settle down children.

    Bu... but... even with the bold starfox still couldn't get it :p Nevertheless, I am reaching out for my zen.

    I think you're looking a little too far ahead fortunz, but that's just my opinion.

    Fair enough. I was just trying to avoid any potential "now or never" deadline issues. :)
    1
    I assume pinch-to-zoom is pretty well supported in Android. Does this mean the zoom bar is now more supported (for zooming, button hacks aside) in XDAndroid than it ever was in officially baked HTC WinMo?

    Yes it does :D

    As for functionality, the p2z is cool, but not something I've been pining for. I don't know exactly what your plans are, but I'd love it if that function could be switched off easily (a line in startup.txt?), so future hacks creating, say, soft buttons on the bar instead could be more easily implemented.

    Thanks for the suggestion. I'm not going to be implementing it at this time, but the way things are structured in the code, it wouldn't be hard for it to be done by someone interested in the future.

    When I was fighting with getting .27 working, I considered at one point simply turning the zoom bar into soft buttons. However, I was never able to come up with a practical use for soft buttons on the zoom bar. The thing that makes it hard is that the list of keyevents Android understand are extremely limited.

    You can see for yourself here:
    http://developer.android.com/reference/android/view/KeyEvent.html
    Set the filter level to API level 8 to see what's available on Froyo. Unfortunately, really useful keyevents like button zoom in/out only became available in Honeycomb (API level 11).

    I'm not sure that soft buttons for things like home or power or search would be very convenient when they're not visible on the physical device, are right next to the screen, and could instantly rip you out of what you're doing.

    Just in case anyone happens across this that is interested in doing so, here is how you'd probably want to do it:
    Android's KeyInputQueue.java, which handles inputs from the touchscreen (and everything else). Do a search for readVirtualKeys and see that it reads from /sys/board_properties/virtualkeys.tssc_manager. Edit the driver so that it generates the virtualkeys file in the format specified in KeyInputQueue, and disable all of the topaz/rhodium zoom bar code.
    1
    I tried bind-mounting it from conf, but for some reason that did not work for me.

    Just got around to trying this out (I know, I'm a slacker :p) and it works freakin beautifully! But re: the bind mount issue. rpierce99 mentioned on IRC that if the file doesn't exist you must ln -s (symlink) which did work.

    FYI folks, jonpry has pulled manekineko's patch into mainline .39. So far, for everyone I've talked to the code 'just works'. Kudos manekineko ;).