LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 07-07-2018, 04:28 AM   #1
francesco.pileo
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Rep: Reputation: Disabled
Question Module programming - keyboard layout


I'm developing a kernel module for didactic purposes, does anyone know a way to get the keyboard layout in use when the module is inserted?
 
Old 07-07-2018, 05:06 PM   #2
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 382

Rep: Reputation: Disabled
# i'm unsure but i need this on debian to get into a "normal mode" so X11 takes essential to operation keystrokes
# i'm unsure how it works
# but if your loading a special module that f's up the keyboard, then use lsmod to see if it's currently loaded?

#!/bin/sh

[ -x /bin/loadkeys ] && {
[ -z "$1" ] && [ -s /etc/console/defkeymap_V1.0.kmap.gz ] && \
/bin/loadkeys -s /etc/console/defkeymap_V1.0.kmap.gz
[ ! -z "$1" ] && [ -s $1 ] && /bin/loadkeys -s $1
}

# make sure debian didn't make console unicode

[ -x /usr/bin/kbd_mode ] && {
/usr/bin/kbd_mode -a
/usr/bin/kbd_mode
}

/bin/true

# KBD_MODE(1) Linux User's Manual KBD_MODE(1)

NAME
kbd_mode - report or set the keyboard mode

SYNOPSIS
kbd_mode [ -auks ]

it comes with "console tools", and the source may show you how it (talks with the kernel)

Last edited by X-LFS-2010; 07-07-2018 at 05:08 PM.
 
Old 07-07-2018, 05:11 PM   #3
X-LFS-2010
Member
 
Registered: Apr 2016
Posts: 382

Rep: Reputation: Disabled
keyboards have been known as a "security item" since the 80's (drivers also chips)

it's not really a toy for teaching. it should be code that is inspected to not allow breaches and operated on "well known chips".

when you add in the factor "they expect it to be internationalized" but want to submit hacked code to do it. it's a disaster to support 2,000 languages.

what i mean is: it's not an introductory topic that hacks should be submitting code changes to - not that your a hack. i'm saying using it as a teaching tool is not a great idea

anyway are you doing this only when another kbd is attacheed? sounds like students could lock their keyboard and maybe damage their computer by forcing a reset

Last edited by X-LFS-2010; 07-07-2018 at 05:13 PM.
 
Old 07-09-2018, 05:26 AM   #4
francesco.pileo
LQ Newbie
 
Registered: Jul 2018
Posts: 3

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by X-LFS-2010 View Post
keyboards have been known as a "security item" since the 80's (drivers also chips)

it's not really a toy for teaching. it should be code that is inspected to not allow breaches and operated on "well known chips".

when you add in the factor "they expect it to be internationalized" but want to submit hacked code to do it. it's a disaster to support 2,000 languages.

what i mean is: it's not an introductory topic that hacks should be submitting code changes to - not that your a hack. i'm saying using it as a teaching tool is not a great idea

anyway are you doing this only when another kbd is attacheed? sounds like students could lock their keyboard and maybe damage their computer by forcing a reset
I'm developing a "malevolent" module that works like a keysniffer. The module works great, but i want to try to translate the keycode to the corresponding key-value, and this depends on the keyboard layout in use.
This module is in the context of an university project, and this is not really dangerous (insmod require super user permissions)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting the correct keyboard layout corresponding to my laptop's physical layout nidra Linux - Newbie 2 08-28-2017 09:14 AM
[SOLVED] Layout initially different between USB keyboard and laptop's integrated keyboard BrutalMusic Linux - Laptop and Netbook 6 02-07-2014 05:06 AM
[SOLVED] How to match X keyboard layout with the the kernel keyboard map? Didier Spaier Slackware 11 03-24-2013 03:40 PM
Keyboard layout plugin disappears after keyboard is plugged in XFCE4 fsb Linux - Laptop and Netbook 0 01-04-2013 06:45 PM
Switching keyboard layout - Mandriva2006 - K.D.E. Windows Layout! itz2000 Mandriva 3 08-13-2006 07:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 03:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration