index

hacking-x

using /dev/input/event.

/p/xfree-4.3.99.901-r4/work/xc/programs/Xserver/hw/xfree86/common/xf86Events.c

this mustn't set the time (of key events) !! b/c we have the kernel set it. mmc_xf86PostKbdEvent translates the usb codes ? or simply avoids the other translations ?

/p/xfree-4.3.99.901-r4/work/xc/programs/Xserver/hw/xfree86/os-support/shared/std_kbdEv.c

reading the events. & translating codes.

/p/xfree-4.3.99.901-r4/work/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c

find_keyboard_event_file

and

/p/xfree-4.3.99.901-r4/work/xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_init.c

searching for keyboards

/p/xfree-4.3.99.901-r4/work/xc/programs/Xserver/hw/xfree86/common/xf86Io.c

time

CARD32 last_keyboard_read_time = 0; in /p/xfree-4.3.99.901-r4/work/xc/programs/Xserver/dix/events.c should be fixed!

todo:

heartbeat of the keyboard

ungrab C-M kp/

Led on Grab

How Time is kept (pushed ahead)

GetTimeInMillis ... (in dix) ... dispatch.c UpdateCurrentTime(If)

My idea is that after each GetTimeInMillis we have to look at all input devices.

UpdateCurrentTime -> ProcessInputEvents -> xf86eqProcessInputEvents(); ??

the keyboard driver:

to read it:

(defvar emacs-wiki-mode-ffap-outline-path

;; Need smarter defaults here! Suggestions welcome. '("/x/cvs/xfree/patched/"))

(defun ffap-emacs-wiki-mode (name) (ffap-locate-file name t ffap-outline-path)) (aput 'ffap-alist 'emacs-wiki-mode 'ffap-emacs-wiki-mode)

programs/Xserver/hw/xfree86/doc/DESIGN

from Main programs/Xserver/dix/main.c

-> InitInput followed by InitAndStartDevices()

-> programs/Xserver/hw/xfree86/common/xf86Init.c

dunno why InitOutput is used to collect even input modules

what is xf86ConfigLayout.inputs

char * identifier; char * driver; pointer commonOptions; pointer extraOptions; } IDevRec, IDevPtr;

so, IDevPtr must be produced before. in fact! programs/Xserver/hw/xfree86/common/xf86Helper.c

xf86InputDriverList

flags: XI86_KEYBOARD_CAPABLE XI86_CORE_KEYBOARD

pInfo->flags & XI86_CORE_KEYBOARD only one!!

xf86Info.inputPending = NULL;

pInfo = pDrv->PreInit(pDrv, pDev, 0);

after xf86InputDevs

/ Call the PreInit function for each input device instance. / "keyboard" special handling!

KbdDevPtr pKbd = pInfo->private;

pKbd->KbdInit = KbdInit; pKbd->KbdOn = KbdOn; pKbd->KbdOff = KbdOff; pKbd->Bell = SoundBell; pKbd->SetLeds = SetKbdLeds; pKbd->GetLeds = GetKbdLeds; pKbd->SetKbdRepeat = SetKbdRepeat; pKbd->KbdGetMapping = KbdGetMapping; pKbd->SpecialKey = SpecialKey;

pKbd->RemapScanCode = NULL; pKbd->GetSpecialKey = GetSpecialKey;

pKbd->OpenKeyboard = OpenKeyboard; pKbd->vtSwitchSupported = FALSE;

pKbd->private = xcalloc(sizeof(LnxKbdPrivRec), 1);

first take:

programs/Xserver/xkb/xkb.c /p/xfree-4.3.99.901-r4/work/xc/programs/Xserver/xkb/xkb.c

move the std_kbd into kbd.c or standalone evdev.c ??

processing keyboard event

os/connection.c

AddEnabledDevice(int fd) hidden by xf86AddEnabledDevice ? or xf86KbdProc

-> AllSockets

i tried AddMonitoredDevice i had to add it into hw/xfree86/loader/dixsym.c as SYMFUNC(AddMonitoredDevice)

but evdev doesn't raise...

os/WaitFor.c

<- XFD_COPYSET(&AllSockets, &LastSelectMask);

Because * hw/xfree86/common/xf86Init.c runs

RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup, NULL);

( RegisterBlockAndWakeupHandlers in dix/dixutils.c)

we run:

hw/xfree86/common/xf86Events.c

-> xf86Wakeup in

-> runs xf86InputDevs ..... ???

IFF pinfo->fd !!! pInfo->read_input(pInfo); ....

and also runs

-> InputHandlers iff ih->fd ...

who & how adds to xf86InputDevs ?

xf86AllocateInput

xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)

hard to find typedefs (structs )

DeviceIntPtr -> _DeviceIntRec DIX level!

it only communicates via ->deviceProc (DeviceProc)

keyboard module

xf86AddInputDriver

lnx_kbd

leds beeps kbdon/of GetSpecialKey

hw/xfree86/os-support/xf86OSKbd.h

hw/xfree86/os-support/shared/at_scancode.c

ATScancode: /* mmc: this is a sort of my plugin: it is fed scancodes and sometimes returns

* another one. i.e. it keeps a state (queue). For evdev kernel does it. /

called via pKbd->RemapScanCode from PostKbdEvent

alternatively (that means when we use CustomKeycodes for example) pKbd->scancodeMap is a table: it's used only in BSD

** step: special action keys:

->GetSpecialKey again: function or a table.

specialkey and then call xf86CommonSpecialKey(specialkey, ...)

and also (local) ->SpecialKey

global:

linux: ->vtSwitchSupported ?? only on console! if the keyboard is a separate device ...??

!xf86Info.vtSysreq ??? f1 & if enabled! alt & sysreq, f1

fixme: i hope keyc->state is not maintainde by xkb??? upper end!

in the end xf86PostKeyboardEvent

i had to:

xf86Wakeup -> xf86Info.kbdEvents i disable it! why needed? can't we select & have input on keyboard?

i should test, if "keyboard" (the legacy built-in driver) needs it.

kbd.c
specialkeys handling : only if: if (noXkbExtensionspecialkey == KEY_BackSpace) i added 1!

how events are read:

bugs:

if the input/eventX doese not exist i get segfault!

config

checkCoreInputDevices implicit !

kbd.c from the POW of modules:

-> xf86AddInputDriver(&KEYBOARD, module, 0);

preinit

init of the keyboard:

linux: pKbd->KbdInit

pKbd->KbdGetMapping

looking at evdev

it seems it uses xf86InputDevs

while kbd.c uses InputHandlers. i don't know why?

A: evdev handles mouse. and xf86InputDevs are called w/ SIGIO masked!

evdev calls: InitKeyClassDeviceStruct

kbd -> XkbInitKeyboardDeviceStruct

-> InitKeyboardDeviceStruct -> InitKeyClassDeviceStruct & InitFocusClassDeviceStruct & InitKbdFeedbackClassDeviceStruct

(device, pKeySyms, pModifiers, bellProc, controlProc)

Grabs:

ProcGrabKeyboard -> GrabDevice

calls dev->ActivateGrab with time = ClientTimeToServerTime(ctime); which is ActivateKeyboardGrab

this -> CheckGrabForSyncs -> ComputeFreezes

-> FreezeThaw

->

Bugs in grabbing:

ProcGrabKeyboard lower_bound_time: returning 0 GrabDevice: grab time: 3530871973 ProcGrabKeyboard failing: b/c GrabInvalidTime ProcUngrabKeyboard ProcUngrabKeyboard: grab time: 3530872200