@@ -187,6 +187,15 @@ static const struct apple_key_translation *apple_find_translation(
187
187
return NULL ;
188
188
}
189
189
190
+ static void input_event_with_scancode (struct input_dev * input ,
191
+ __u8 type , __u16 code , unsigned int hid , __s32 value )
192
+ {
193
+ if (type == EV_KEY &&
194
+ (!test_bit (code , input -> key )) == value )
195
+ input_event (input , EV_MSC , MSC_SCAN , hid );
196
+ input_event (input , type , code , value );
197
+ }
198
+
190
199
static int hidinput_apple_event (struct hid_device * hid , struct input_dev * input ,
191
200
struct hid_usage * usage , __s32 value )
192
201
{
@@ -199,7 +208,8 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
199
208
200
209
if (usage -> code == fn_keycode ) {
201
210
asc -> fn_on = !!value ;
202
- input_event (input , usage -> type , KEY_FN , value );
211
+ input_event_with_scancode (input , usage -> type , KEY_FN ,
212
+ usage -> hid , value );
203
213
return 1 ;
204
214
}
205
215
@@ -240,7 +250,8 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
240
250
code = do_translate ? trans -> to : trans -> from ;
241
251
}
242
252
243
- input_event (input , usage -> type , code , value );
253
+ input_event_with_scancode (input , usage -> type , code ,
254
+ usage -> hid , value );
244
255
return 1 ;
245
256
}
246
257
@@ -258,8 +269,8 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
258
269
clear_bit (usage -> code ,
259
270
asc -> pressed_numlock );
260
271
261
- input_event (input , usage -> type , trans -> to ,
262
- value );
272
+ input_event_with_scancode (input , usage -> type ,
273
+ trans -> to , usage -> hid , value );
263
274
}
264
275
265
276
return 1 ;
@@ -270,7 +281,8 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
270
281
if (hid -> country == HID_COUNTRY_INTERNATIONAL_ISO ) {
271
282
trans = apple_find_translation (apple_iso_keyboard , usage -> code );
272
283
if (trans ) {
273
- input_event (input , usage -> type , trans -> to , value );
284
+ input_event_with_scancode (input , usage -> type ,
285
+ trans -> to , usage -> hid , value );
274
286
return 1 ;
275
287
}
276
288
}
@@ -279,15 +291,17 @@ static int hidinput_apple_event(struct hid_device *hid, struct input_dev *input,
279
291
if (swap_opt_cmd ) {
280
292
trans = apple_find_translation (swapped_option_cmd_keys , usage -> code );
281
293
if (trans ) {
282
- input_event (input , usage -> type , trans -> to , value );
294
+ input_event_with_scancode (input , usage -> type ,
295
+ trans -> to , usage -> hid , value );
283
296
return 1 ;
284
297
}
285
298
}
286
299
287
300
if (swap_fn_leftctrl ) {
288
301
trans = apple_find_translation (swapped_fn_leftctrl_keys , usage -> code );
289
302
if (trans ) {
290
- input_event (input , usage -> type , trans -> to , value );
303
+ input_event_with_scancode (input , usage -> type ,
304
+ trans -> to , usage -> hid , value );
291
305
return 1 ;
292
306
}
293
307
}
@@ -306,8 +320,8 @@ static int apple_event(struct hid_device *hdev, struct hid_field *field,
306
320
307
321
if ((asc -> quirks & APPLE_INVERT_HWHEEL ) &&
308
322
usage -> code == REL_HWHEEL ) {
309
- input_event (field -> hidinput -> input , usage -> type , usage -> code ,
310
- - value );
323
+ input_event_with_scancode (field -> hidinput -> input , usage -> type ,
324
+ usage -> code , usage -> hid , - value );
311
325
return 1 ;
312
326
}
313
327
0 commit comments