Discussing the nuts and bolts of software development

Monday, April 02, 2012


Disabling the console switching keys for Android

Some time ago I was doing development on an Android phone and using a BlueTooth keyboard I came across an intriguing behaviour.  Hitting the Alt+Left or Alt+Right key combo, the phone would seemingly stop working and give all the symptoms of a frozen device, no more animated wallpaper and unresponsive touchscreen.  This stems from a functionality inherited from Linux for the desktop.  In this article I will describe the origin of the issue, how to recover from it and how it can be fixed at the kernel level.

Background information

In Linux there exist some special key combinations that are handled at the kernel level.  In this article we'll be looking at the console key combinations, specifically:
* Alt refers to the left Alt key on the keyboard

Let's start with Alt+F1 through F12; these allow accessing the tty's.  On a typical Linux installation Alt+F1 through F6 allows the user to switch between tty1 through tty6 respectively directly and Alt+F7 (F1 in Fedora) is a special tty in which the graphical interface runs.  This can change from distro to distro.

These Alt commands work from the tty's, but don't from the graphical interface.  That's where the Ctrl+Alt+Fn combinations come in, to let you leave the graphical interface.  Now the Alt+Left and Alt+Right commands let you cycle through the tty's to the left or to the right.  i.e. using Alt+Right from tty3 will lead you to tty4.

I don't have these keys on my Android phone...

That's right!  For the most part these key combinations do not come into play on an Android phone as you can't find them on the touchscreen.

When users start connecting BlueTooth or USB keyboards to interface with their Android mobile, that's when the surprise comes for the unsuspecting user.  On my Galaxy S for example, pressing the Alt+Right combo freezes the display.  The live wallpaper stops moving; and the touchscreen becomes unresponsive.  This can be fixed by any of these three options:
That gets the user back to the graphical interface tty and make it responsive again.

Modifying the kernel default key map

The Default kernel keymap in the Android source is located in kernel/drivers/char/defkeymap.map as of Gingerbread (2.3).  Entries in this file look like the following:

keycode  59 = F1               F11              Console_13
        control keycode  59 = F1
        alt     keycode  59 = Console_1
        control alt     keycode  59 = Console_1
keycode 105 = Left
        alt     keycode 105 = Decr_Console
keycode 106 = Right
        alt     keycode 106 = Incr_Console

In our case, we want to disable the combinations associated to Console so in the above entries we simply need to comment the lines that declare these.

keycode  59 = F1               F11              Console_13
        control keycode  59 = F1
#        alt     keycode  59 = Console_1
#        control alt     keycode  59 = Console_1
keycode 105 = Left
#        alt     keycode 105 = Decr_Console
keycode 106 = Right
#        alt     keycode 106 = Incr_Console

There are more entries not shown here that declare Console related key combinations.  The instructions at the top of the defkeymap.c_shipped file read:

/* Do not edit this file! It was automatically generated by   */
/*    loadkeys --mktable defkeymap.map > defkeymap.c          */

When I do run this loadkeys command, the generated file does not match the shipped file provided in the Android source as can be seen by difference in the files size.

$ ll defkeymap.c*
-rw-rw-r--. 1 jpl jpl 18433 Oct 19 12:46 defkeymap.c
-rw-rw-r--. 1 jpl jpl 11007 Oct 12 19:35 defkeymap.c_shipped

Running diff also shows that the provided shipped file has not been generated from the accompanying defkeymap.map file.  Simply generating defkeymap.c from our modified defkeymap.map won't do either as our new defkeymap.c is overwritten with a copy of defkeymap.c_shipped during the build.

What do we do now?  The way I worked around this is a bit tedious but will make sure that we don't lose changes that were applied to the shipped file and not reflected in the defkeymap.map.

Workaround: I generated a defkeymap.c file from the original defkeymap.map and a defkeymap.c from the modified defkeymap.map to remove the Alt+X combinations.  Then I generated the diff of the 2 files and manually applied it to the shipped file.

Labels: , , ,

Something tells me that if you look here you will get some tips on how to write dissertations. It could be a good and helpful hints
Pastinya anda memiliki sebuah tujuan untuk bermain judi dimana tujuan anda harus meraih keuntungan. Tetapi jika anda bermain dengan tergesa gesa maka kemenangan akan sulit anda dapatkan
bandar ceme terpercaya
freebet tanpa deposit
paito warna
syair sgp
Saat memilih pilihan saya untuk taruhan sepak bola, saya ingin mempersenjatai diri dengan pengetahuan terbaru yang tersedia. Salah satu dari banyak teknik yang saya gunakan ketika mempertimbangkan tim untuk bertaruh adalah
data sgp
data sydney
syair sydney
paito warna
live hk 6d
live sydney
These administrations are pocket-accommodating as well as ecstasy for understudies attempting to finish their assignments on schedule.
my assignment help
Custom Article Review Writing Services you secure from the firm are versatile such as Custom Article Review Help and Legitimate Article Review Writing Help and any other form of writing, contact them for assistance.

Great blog, thank you so much for sharing with us. Get a custom mobile app development services at Appslure WebSolution by the professional ios app designers and developers and also get e-commerce app Services
App development company in mumbai
Do you require Affordable Nursing Research Papers Services for your assignments’ needs, but you are unsure of the Legitimate Nursing Research Paper Writing firm to contract? Our Nursing Research Paper Writing Company has credibility and has been providing homework solutions.

Datang dan bergabung bersama Agen Game Taruhan Bola resmi dan terpercaya login sbobet88 mobile
Excellent information Providing by your Article, thank you for taking the time to share with us such a nice article. Amazing insight you have on this, it's nice to find a website that details so much information about different artists. Kindly visit the LiveWebTutors website we providing the best assignment help services in Australia.

For More Info: Economics Assignment Help
Google can convert saved XLSX file using its Google sheets program. It is a type of zipping compressed and XML type of spreadsheet. xlsx file is an extension that is used for Microsoft Excel Open XML spreadsheets(XLSX) file created by Microsoft Excel. For more information, visit open xlsx file online.

It is undisputed that Sociology Assignment Writing Services pose challenges for students because preparation takes into consideration a lot of details needed for Sociology Coursework Writing Services and in-depth knowledge on the topic in order to come up with award winning Custom Sociology Research Paper Writing Services.

Many students opt to seek Custom Economics Writing Services since most writing companies are good in Economics Essay Writing Services and Economics Coursework Writing Services.


Very nicely explained and include all important information.I also recommend visiting mobile app development company

Awesome, thanks for the post.

ccskills | tldrlegal | hedonism | gamespot | informationweek | kiva | metal | bloggingmania
Do you have an insight where to acquire Medical Writing Services? Hire a Medical Assignment Help Writer for all your Medical Assignment Writing Services.

Thank you for the post it is very informative information. Get instant help regarding printer related issues at anytime by our expert. I am waiting for the next post. We are available 24 x 7. hp deskjet 2540 printer is offline
Finding Help with Medical Assignment is not easy unless one is keen to establish the best medical research paper writing service company by going through their medical assignment writers qualifications.

I really love to read your post which contains very informative information and i also like the way of explanation of the article. If you want to fix your HP Envy Printer Offline Windows 10 Error regarding issues then call our toll-free number to contact our expert technician to helping you in resolve your issues.
Thanks for sharing blog. Hey!! I want to suggest you for get instant printer help regarding the printer troubleshooting or any new printer setup or you have to find out WPS Pin for HP Printer. Call our toll free number or visit our official website for further details.
Purchase healthcare research paper services and healthcare coursework writing services since students find help when they visit Healthcare Essay Writing Services.

There are many engineering assignment help writing services and Engineering Writing Services to choose from for those stuck with their engineering research paper writing services and engineering term paper writing services.

Purchase biology research paper help services and biology coursework writing services since students find help when they visit Biology Essay Writing Services.

I know Laura well and she is principled, thoughtful, and extremely bright...more power to her!

iso 27001 consultant
Very helpful Post!!! This is the first time I have read a post like this. Find Career tips here.

iso 270012013
Online psychology essay writing services are very difficult to complete and many students are always searching for Help with Psychology Coursework Writing services to help them complete their psychology research paper writing services and psychology case study writing services.
The ultimate goal of descriptive essay help services is to provide Descriptive Essay Writing Services and descriptive essay services since descriptive essay writing help seekers lack time to complete their custom descriptive essay writing services.

Thanks for sharing such a piece of wonderful information. Moreover, it is very true that Entertainment company is ruling the world.
There is everything fame, money but first, you need to set-up your brand availability. Promote your brand, gain customers’ trust, present what the audience wants,
and you will be able to rule the entertainment company.
entertainment company

Accounting assignment writing services have become very popular for students studying finance & accounting coursework writing services as they engage the best online Accounting Writing Services.
Thank you for the auspicious writeup. It if truth be told was a enjoyment account it. Glance advanced to more added agreeable from you! However, how can we keep up a correspondence? We create together, measure always, and revise often, ensuring your customers stay at the focus.
Digital Marketing Services
Professional Human Resource Writing Services is very popular for students in search of human resource case study writing services and human resource research paper services.

Professional Human Resource Writing Services is very popular for students in search of human resource case study writing services and human resource research paper services.

It would be better for you to take help from experts of Dissertation Proposal Writing Service. They have highly qualified experts in every subject who are able to help you in any way they can.
PHP advancement is a well-known scripting language that is utilized to make intelligent and dynamic sites. Today, most business sites are made by utilizing php application development as it accompanies profoundly practical highlights and ease of use. So, organizations ready to make a customer's site with amazing information the executives highlights will require to recruit php development company. Our prime php website development improvement administrations start with understanding the client needs and stretches out to database driven top of the line custom undertaking web frameworks. Recruit devoted PHP engineers from Colan Infotech to plan php web development utilizing Photoshop, Flash etc. The php development India advancement administrations we offer are recorded underneath:
We are one among the best web design company in chennai. Our objective is to deliver clients with trending solutions that add values to their webpages and applications.We are Professional Website Design Services and we have efficient team of experts who are keen to complete the project within specified period. Our HTML5 developers are up to date in latest designing tools and technologies to build interactive websites.If you are looking for web designing services in chennai also you can hire web designer india we are here to help you.
Very nicely explained and include all important information. I also recommend visiting best astrologer in india
Amazing Article ! I would like to thank you for the efforts you had made for writing this awesome article.
Thanks for sharing such a nice info.I hope you will share more information like this. please keep on sharing!

internship in chennai
internship in chennai for cse
internship for mba in chennai
internship in chennai for hr
internship in chennai for mba
companies for internship in chennai
internship in chennai for ece
paid internship in chennai
internship in chennai for biotechnology
internship in chennai for b.com students
Mine is working excellent, but how to revert it. I've disabled the QM. to 1 and delete # in front of the line, but the hardware key still not working. How can I fix it? Please pay someone to write my assignment.
I appreciate for sharing this post keep sharing like this.I also recommend visiting mobile app development company
There is a reliable Healthcare Assignment Writing Service that is very popular for students in search of healthcare coursework writing services and nursing essay writing help services.

Thanks for sharing this solution for disabling the console switching keys for Android, if unable to understand get the assistance of a programming help service.
Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?