Mailing List Archive

N810 & FN key & X
Hi

The FN key on N810 keyboard seems to send (the standard FN) keycode 464
which is a bit tricky as X doesn't support keycodes over 255 (afaik).

HAL should be able to remap the keycodes using the EVIOCSKEYCODE with
the ioctl but I get EINVAL on n810 and n800 when I try to use it. On my
PC it works without errors.

I wonder how's this done in Maemo's Xomap?

--
Tuomas
Re: N810 & FN key & X [ In reply to ]
I only readed xomap code. So I'm not 100% sure about this.

But anyway - How it works with xomap:

1. read fn:s code from evdev (0x1d0)

2. put fn:s code (__u16) to KdEnqueeueKeyboardEvent-functions scan_code
(unsigned char). This looks dangerous and (propably) drops msbyte
away. only 0xd0 stays. How about "and" and "typecast"?

3. key_code = scan_code + KD_MIN_KEYCODE - ki->minScanCode

scan_code=0xd0, KD_MIN_KEYCODE=8, ki->minScanCode is propably 0
result: 0xd8 = 216 which can be found from
/usr/share/X11/xkb/keycodes/evdev as <FN>


...and same with sources

----------------------------
linux-kernel-headers/input.h
----------------------------
....
struct input_event {
struct timeval time;
__u16 type;
__u16 code;
__s32 value;
};
.....

-----------------------
hw/kdrive/linux/evdev.c
-----------------------
....
evdev_device_read(int evdevPort, void *closure)
{
...
struct input_event events[NUM_EVENTS];
...
case EV_KEY:
if (info->type == Keyboard)
KdEnqueueKeyboardEvent(info->device, events[i].code,
!events[i].value);
...

----------------------
hw/kdrive/src/kinput.c
----------------------
KdEnqueueKeyboardEvent(KdKeyboardInfo *ki,
unsigned char scan_code,
unsigned char is_up)
{
unsigned char key_code;
KeyClassPtr keyc = NULL;
KeybdCtrl *ctrl = NULL;
int type, nEvents, i;
...
key_code = scan_code + KD_MIN_KEYCODE - ki->minScanCode;
...


----------------------
hw/kdrive/src/kdrive.h
----------------------
...
#define KD_MIN_KEYCODE 8
...


- Joni


On Tue, 11 Mar 2008, Tuomas Kulve wrote:

>
> Hi
>
> The FN key on N810 keyboard seems to send (the standard FN) keycode 464
> which is a bit tricky as X doesn't support keycodes over 255 (afaik).
>
> HAL should be able to remap the keycodes using the EVIOCSKEYCODE with
> the ioctl but I get EINVAL on n810 and n800 when I try to use it. On my
> PC it works without errors.
>
> I wonder how's this done in Maemo's Xomap?
>
> --
> Tuomas
>
>
>
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: N810 & FN key & X [ In reply to ]
On Tue, Mar 11, 2008 at 03:12:56PM +0200, Joni Valtanen wrote:
> I only readed xomap code. So I'm not 100% sure about this.
>
> But anyway - How it works with xomap:
>
> 1. read fn:s code from evdev (0x1d0)

Does xomap even use evdev? At least 1.1.99.3 used the keyboard
driver instead. I haven't looked at more recent sources.

--
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: N810 & FN key & X [ In reply to ]
Ville Syrjälä wrote:
> On Tue, Mar 11, 2008 at 03:12:56PM +0200, Joni Valtanen wrote:
>> I only readed xomap code. So I'm not 100% sure about this.
>>
>> But anyway - How it works with xomap:
>>
>> 1. read fn:s code from evdev (0x1d0)
>
> Does xomap even use evdev? At least 1.1.99.3 used the keyboard
> driver instead. I haven't looked at more recent sources.

I believe the 1.3.99.0~git20070321 does use it.

--
Tuomas
Re: N810 & FN key & X [ In reply to ]
Yes. xomap uses evdev, I just tested. And I tested that "cast" thing also.

__u16 y = 0x1234
unsigned char x = y,
result: x=0x34

But anyway Tuomas has another point in his question: Why that ioctl
doesn't work?

- Joni


On Tue, 11 Mar 2008, Ville Syrjälä wrote:

> On Tue, Mar 11, 2008 at 03:12:56PM +0200, Joni Valtanen wrote:
>> I only readed xomap code. So I'm not 100% sure about this.
>>
>> But anyway - How it works with xomap:
>>
>> 1. read fn:s code from evdev (0x1d0)
>
> Does xomap even use evdev? At least 1.1.99.3 used the keyboard
> driver instead. I haven't looked at more recent sources.
>
> --
> Ville Syrjälä
> syrjala@sci.fi
> http://www.sci.fi/~syrjala/
>
Re: N810 & FN key & X [ In reply to ]
On Tue, Mar 11, 2008 at 04:28:05PM +0200, Joni Valtanen wrote:
> Yes. xomap uses evdev, I just tested. And I tested that "cast" thing also.
>
> __u16 y = 0x1234
> unsigned char x = y,
> result: x=0x34
>
> But anyway Tuomas has another point in his question: Why that ioctl doesn't
> work?

It looks like the driver doesn't set some needed members (keycodesize at
least) in the input_dev structure which causes the ioctl to fail no matter
what parameters you give it.

--
Ville Syrjälä
syrjala@sci.fi
http://www.sci.fi/~syrjala/
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: N810 & FN key & X [ In reply to ]
I created a bug report about this issue (not sure if this should be
against kernel and not against xomap (or against both)):

http://bugs.maemo.org/show_bug.cgi?id=3021

--
Tuomas
Re: N810 & FN key & X [ In reply to ]
Tuomas Kulve wrote:
> Hi
>
> The FN key on N810 keyboard seems to send (the standard FN) keycode 464
> which is a bit tricky as X doesn't support keycodes over 255 (afaik).
>
> HAL should be able to remap the keycodes using the EVIOCSKEYCODE with
> the ioctl but I get EINVAL on n810 and n800 when I try to use it. On my
> PC it works without errors.

Sorry I can't help, but I wonder if someone can help me with my keyboard
problem?

I have a ThinkOutside stowaway bluetooth keyboard and several of the
keys are dead, as far as I can tell because evdev ignores their
keycodes. Unlike this case, however, the keycodes that get sent are
under 255, so it sounds like I should be able to do this
HAL/EVIOCSKEYCODE thing to remap them to something else.

Can someone give me some pointers on how to do this? After googling, I
think I need to use hal-set-property to set some properties, but after
trying to set various keys to "b", it doesn't seem to be having any
effect. I don't know if I'm allowed to simply append "input.keymap" to
the list of capabilities, and it will magically make my keyboard capable
of that?

Thanks,
Mat

hal-set-property --udi
/org/freedesktop/Hal/devices/computer_logicaldev_input_2 --key
input.keymap.data --strlist-post e01e:b
hal-set-property --udi
/org/freedesktop/Hal/devices/computer_logicaldev_input_2 --key
info.capabilities --strlist-post input.keymap

~ $ hal-device /org/freedesktop/Hal/devices/computer_logicaldev_input_2
udi = '/org/freedesktop/Hal/devices/computer_logicaldev_input_2'
linux.device_file = '/dev/input/event7' (string)
input.xkb_rules = 'base' (string)
input.product = 'Think Outside Keyboard' (string)
input.xkb_layout = 'us' (string)
info.capabilities = { 'input', 'input.keyboard', 'input.keypad',
'input.keys', 'button', 'input.keymap' } (string list)
info.udi = '/org/freedesktop/Hal/devices/computer_logicaldev_input_2'
(string)
linux.subsystem = 'input' (string)
info.product = 'Think Outside Keyboard' (string)
linux.hotplug_type = 2 (0x2) (int)
input.xkb_model = 'evdev' (string)
input.xkb_variant = '' (string)
linux.sysfs_path = '/sys/class/input/input7/event7' (string)
info.addons.singleton = { 'hald-addon-input' } (string list)
input.x11_driver = 'evdev' (string)
input.keymap.data = { 'e01e:b', 'e01c:b' } (string list)
info.category = 'input' (string)
input.device = '/dev/input/event7' (string)
input.xkb_options = '' (string)
info.parent = '/org/freedesktop/Hal/devices/computer' (string)
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: N810 & FN key & X [ In reply to ]
Tuomas Kulve wrote:
> Matthew Exon wrote:
>
>> I have a ThinkOutside stowaway bluetooth keyboard and several of the
>> keys are dead, as far as I can tell because evdev ignores their
>> keycodes. Unlike this case, however, the keycodes that get sent are
>> under 255, so it sounds like I should be able to do this
>> HAL/EVIOCSKEYCODE thing to remap them to something else.
>
> The EVIOCSKEYCODE is not limited to 255. I would guess that you cannot
> map them unless they are sent in the first place.
>
> You can use the attached evtest to see what the event device is sending
> below X and you can use the attached xev to see how X sees them.

OK, you're right, it's somewhere below X: I don't get anything from
evtest for my dead keys (I'd tried xev already).

But these keys work fine for my desktop machine, so I thought this
sounded similar to your problem. Maybe not.

Where does evtest come from?

Thanks,
Mat
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers
Re: dead keys with ThinkOutside stowaway bluetooth keyboard (was N810 & FN key & X) [ In reply to ]
Matthew Exon wrote:

> Where does evtest come from?

Originally, I don't know :)

http://tuomas.kulve.fi/tmp/x/evtest.c

--
Tuomas
Re: dead keys with ThinkOutside stowaway bluetooth keyboard (was N810 & FN key & X) [ In reply to ]
Tuomas Kulve wrote:
> Matthew Exon wrote:
>
>> Where does evtest come from?
>
> Originally, I don't know :)
>
> http://tuomas.kulve.fi/tmp/x/evtest.c

So my problem exists in the kernel, not X. Call me perverse, but that
actually makes it sound easier to solve :-)

Thanks a lot,
Mat
_______________________________________________
maemo-developers mailing list
maemo-developers@maemo.org
https://lists.maemo.org/mailman/listinfo/maemo-developers