Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 309396 Details for
Bug 451182
Fn keys in eeePC not working OOTB. need manual tweaks
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Add input support to eeepc hotkey driver
eeepc_input.diff (text/plain), 5.01 KB, created by
Matthew Garrett
on 2008-06-15 12:58:53 UTC
(
hide
)
Description:
Add input support to eeepc hotkey driver
Filename:
MIME Type:
Creator:
Matthew Garrett
Created:
2008-06-15 12:58:53 UTC
Size:
5.01 KB
patch
obsolete
>diff -ur linux-2.6.25.noarch.clean/drivers/misc/eeepc-laptop.c linux-2.6.25.noarch/drivers/misc/eeepc-laptop.c >--- linux-2.6.25.noarch.clean/drivers/misc/eeepc-laptop.c 2008-06-15 13:52:38.000000000 +0100 >+++ linux-2.6.25.noarch/drivers/misc/eeepc-laptop.c 2008-06-15 13:55:24.000000000 +0100 >@@ -28,6 +28,7 @@ > #include <acpi/acpi_drivers.h> > #include <acpi/acpi_bus.h> > #include <linux/uaccess.h> >+#include <linux/input.h> > > #define EEEPC_LAPTOP_VERSION "0.1" > >@@ -125,6 +126,8 @@ > by this BIOS */ > uint init_flag; /* Init flags */ > u16 event_count[128]; /* count for each event */ >+ struct input_dev *inputdev; >+ u16 *keycode_map; > }; > > /* The actual device the driver binds to */ >@@ -140,6 +143,28 @@ > > static struct platform_device *platform_device; > >+struct key_entry { >+ char type; >+ u8 code; >+ u16 keycode; >+}; >+ >+enum { KE_KEY, KE_SW, KE_END }; >+ >+static struct key_entry eeepc_keymap[] = { >+ /* Sleep and brightness already handled via generic ACPI code */ >+ {KE_SW, 0x10, SW_RADIO }, >+ {KE_SW, 0x11, SW_RADIO }, >+ {KE_KEY, 0x12, KEY_PROG1 }, >+ {KE_KEY, 0x13, KEY_MUTE }, >+ {KE_KEY, 0x14, KEY_VOLUMEDOWN }, >+ {KE_KEY, 0x15, KEY_VOLUMEUP }, >+ {KE_KEY, 0x30, KEY_SWITCHVIDEOMODE }, >+ {KE_KEY, 0x31, KEY_SWITCHVIDEOMODE }, >+ {KE_KEY, 0x32, KEY_SWITCHVIDEOMODE }, >+ {KE_END, 0}, >+}; >+ > /* > * The hotkey driver declaration > */ >@@ -328,8 +353,64 @@ > /* > * Hotkey functions > */ >+static struct key_entry *eepc_get_entry_by_scancode(int code) >+{ >+ struct key_entry *key; >+ >+ for (key = eeepc_keymap; key->type != KE_END; key++) >+ if (code == key->code) >+ return key; >+ >+ return NULL; >+} >+ >+static struct key_entry *eepc_get_entry_by_keycode(int code) >+{ >+ struct key_entry *key; >+ >+ for (key = eeepc_keymap; key->type != KE_END; key++) >+ if (code == key->keycode && key->type == KE_KEY) >+ return key; >+ >+ return NULL; >+} >+ >+static int eeepc_getkeycode(struct input_dev *dev, int scancode, int *keycode) >+{ >+ struct key_entry *key = eepc_get_entry_by_scancode(scancode); >+ >+ if (key && key->type == KE_KEY) { >+ *keycode = key->keycode; >+ return 0; >+ } >+ >+ return -EINVAL; >+} >+ >+static int eeepc_setkeycode(struct input_dev *dev, int scancode, int keycode) >+{ >+ struct key_entry *key; >+ int old_keycode; >+ >+ if (keycode < 0 || keycode > KEY_MAX) >+ return -EINVAL; >+ >+ key = eepc_get_entry_by_scancode(scancode); >+ if (key && key->type == KE_KEY) { >+ old_keycode = key->keycode; >+ key->keycode = keycode; >+ set_bit(keycode, dev->keybit); >+ if (!eepc_get_entry_by_keycode(old_keycode)) >+ clear_bit(old_keycode, dev->keybit); >+ return 0; >+ } >+ >+ return -EINVAL; >+} >+ > static int eeepc_hotk_check(void) > { >+ const struct key_entry *key; > struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; > int result; > >@@ -356,6 +437,35 @@ > "Get control methods supported: 0x%x\n", > ehotk->cm_supported); > } >+ ehotk->inputdev = input_allocate_device(); >+ if (!ehotk->inputdev) { >+ printk(EEEPC_INFO "Unable to allocate input device\n"); >+ return 0; >+ } >+ ehotk->inputdev->name = "Asus EeePC extra buttons"; >+ ehotk->inputdev->phys = EEEPC_HOTK_FILE "/input0"; >+ ehotk->inputdev->id.bustype = BUS_HOST; >+ ehotk->inputdev->getkeycode = eeepc_getkeycode; >+ ehotk->inputdev->setkeycode = eeepc_setkeycode; >+ >+ for (key = eeepc_keymap; key->type != KE_END; key++) { >+ switch (key->type) { >+ case KE_KEY: >+ set_bit(EV_KEY, ehotk->inputdev->evbit); >+ set_bit(key->keycode, ehotk->inputdev->keybit); >+ break; >+ case KE_SW: >+ set_bit(EV_SW, ehotk->inputdev->evbit); >+ set_bit(key->keycode, ehotk->inputdev->swbit); >+ break; >+ } >+ } >+ result = input_register_device(ehotk->inputdev); >+ if (result) { >+ printk(EEEPC_INFO "Unable to register input device\n"); >+ input_free_device(ehotk->inputdev); >+ return 0; >+ } > } else { > printk(EEEPC_ERR "Hotkey device not present, aborting\n"); > return -EINVAL; >@@ -386,6 +496,7 @@ > > static void eeepc_hotk_notify(acpi_handle handle, u32 event, void *data) > { >+ static struct key_entry *key; > if (!ehotk) > return; > if (event == NOTIFY_WLAN_ON && (DISABLE_ASL_WLAN & ehotk->init_flag)) >@@ -394,6 +505,29 @@ > notify_brn(); > acpi_bus_generate_proc_event(ehotk->device, event, > ehotk->event_count[event % 128]++); >+ if (ehotk->inputdev) { >+ key = eepc_get_entry_by_scancode(event); >+ if (key) { >+ switch (key->type) { >+ case KE_KEY: >+ input_report_key(ehotk->inputdev, key->keycode, >+ 1); >+ input_sync(ehotk->inputdev); >+ input_report_key(ehotk->inputdev, key->keycode, >+ 0); >+ input_sync(ehotk->inputdev); >+ break; >+ case KE_SW: >+ /* 0x10 for on, 0x11 for off. RFKill wants 1 >+ for on, 0 for off */ >+ input_report_switch(ehotk->inputdev, >+ key->keycode, >+ event % 2 ? 1 : 0); >+ input_sync(ehotk->inputdev); >+ break; >+ } >+ } >+ } > } > > static int eeepc_hotk_add(struct acpi_device *device) >@@ -543,6 +677,8 @@ > { > if (eeepc_backlight_device) > backlight_device_unregister(eeepc_backlight_device); >+ if (ehotk->inputdev) >+ input_unregister_device(ehotk->inputdev); > eeepc_backlight_device = NULL; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 451182
:
309396
|
309502
|
319477