linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* BUG: cannot enable iso_layout with apple keyboard
@ 2021-07-08 14:19 Julian Weigt
  2021-07-14  7:57 ` José Expósito
  0 siblings, 1 reply; 3+ messages in thread
From: Julian Weigt @ 2021-07-08 14:19 UTC (permalink / raw)
  To: jikos, benjamin.tissoires; +Cc: linux-input, linux-kernel

Hi,

I have an apple keyboard model A1644 EMC 2815 with Finnish/Swedish ISO layout. When I connect it via cable it works fine. But when I connect it via bluetooth, then the buttons >/< and §/° are swapped. It seems to make no difference if I set iso_layout to 0 or to 1. I checked and it turns out that hid->country below equals 0, and removing the check

diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
index 6b8f0d004d34..8a764ce4e518 100644
--- a/drivers/hid/hid-apple.c
+++ b/drivers/hid/hid-apple.c
@@ -267,13 +267,11 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
        }

        if (iso_layout) {
-               if (hid->country == HID_COUNTRY_INTERNATIONAL_ISO) {
                        trans = apple_find_translation(apple_iso_keyboard, usage->code);
                        if (trans) {
                                input_event(input, usage->type, trans->to, value);
                                return 1;
                        }
-               }
        }

        if (swap_opt_cmd) {

makes the buttons act correctly. Please let me know how I can help fixing this.

Best regards,
Julian Weigt

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: BUG: cannot enable iso_layout with apple keyboard
  2021-07-08 14:19 BUG: cannot enable iso_layout with apple keyboard Julian Weigt
@ 2021-07-14  7:57 ` José Expósito
  2021-07-27 21:58   ` Alex Henrie
  0 siblings, 1 reply; 3+ messages in thread
From: José Expósito @ 2021-07-14  7:57 UTC (permalink / raw)
  To: juw; +Cc: alexhenrie24, benjamin.tissoires, jikos, linux-input, linux-kernel

> Hi,
> 
> I have an apple keyboard model A1644 EMC 2815 with Finnish/Swedish ISO layout. When I connect it via 
> cable it works fine. But when I connect it via bluetooth, then the buttons >/< and §/° are swapped.
> It seems to make no difference if I set iso_layout to 0 or to 1. I checked and it turns out that
> hid->country below equals 0, and removing the check
> 
> diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
> index 6b8f0d004d34..8a764ce4e518 100644
> --- a/drivers/hid/hid-apple.c
> +++ b/drivers/hid/hid-apple.c
> @@ -267,13 +267,11 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
>         }
> 
>         if (iso_layout) {
> -               if (hid->country == HID_COUNTRY_INTERNATIONAL_ISO) {
>                         trans = apple_find_translation(apple_iso_keyboard, usage->code);
>                         if (trans) {
>                                 input_event(input, usage->type, trans->to, value);
>                                 return 1;
>                         }
> -               }
>         }
> 
>         if (swap_opt_cmd) {
> 
> makes the buttons act correctly. Please let me know how I can help fixing this.
> 
> Best regards,
> Julian Weigt

Hi Julian,

I can confirm I can reproduce the issue with a Spanish/Spain keyboard.

The problem seems to be that the field "bCountryCode" is not present when the keyboard is connected over bluetooth.

CCing Alex Henrie, hopefully he can add useful information about the issue.

Best wishes,
Jose


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: BUG: cannot enable iso_layout with apple keyboard
  2021-07-14  7:57 ` José Expósito
@ 2021-07-27 21:58   ` Alex Henrie
  0 siblings, 0 replies; 3+ messages in thread
From: Alex Henrie @ 2021-07-27 21:58 UTC (permalink / raw)
  To: José Expósito
  Cc: juw, Benjamin Tissoires, Jiri Kosina, open list:HID CORE LAYER, LKML

On Wed, Jul 14, 2021 at 1:57 AM José Expósito <jose.exposito89@gmail.com> wrote:
>
> > Hi,
> >
> > I have an apple keyboard model A1644 EMC 2815 with Finnish/Swedish ISO layout. When I connect it via
> > cable it works fine. But when I connect it via bluetooth, then the buttons >/< and §/° are swapped.
> > It seems to make no difference if I set iso_layout to 0 or to 1. I checked and it turns out that
> > hid->country below equals 0, and removing the check
> >
> > diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c
> > index 6b8f0d004d34..8a764ce4e518 100644
> > --- a/drivers/hid/hid-apple.c
> > +++ b/drivers/hid/hid-apple.c
> > @@ -267,13 +267,11 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
> >         }
> >
> >         if (iso_layout) {
> > -               if (hid->country == HID_COUNTRY_INTERNATIONAL_ISO) {
> >                         trans = apple_find_translation(apple_iso_keyboard, usage->code);
> >                         if (trans) {
> >                                 input_event(input, usage->type, trans->to, value);
> >                                 return 1;
> >                         }
> > -               }
> >         }
> >
> >         if (swap_opt_cmd) {
> >
> > makes the buttons act correctly. Please let me know how I can help fixing this.
> >
> > Best regards,
> > Julian Weigt
>
> Hi Julian,
>
> I can confirm I can reproduce the issue with a Spanish/Spain keyboard.
>
> The problem seems to be that the field "bCountryCode" is not present when the keyboard is connected over bluetooth.
>
> CCing Alex Henrie, hopefully he can add useful information about the issue.
>
> Best wishes,
> Jose

Thanks Julian and José for bringing this to my attention. I also found
an Ubuntu bug report [1] which suggests that some of Apple's USB ISO
keyboards do not set the country code either. I have ordered a variety
of Apple keyboards from eBay for testing and I will send a fix as soon
as I am able.

-Alex

[1] https://bugs.launchpad.net/ubuntu/+source/xkeyboard-config/+bug/1886215

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-07-27 21:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-08 14:19 BUG: cannot enable iso_layout with apple keyboard Julian Weigt
2021-07-14  7:57 ` José Expósito
2021-07-27 21:58   ` Alex Henrie

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).