keyboard driver question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi.

I`m sorry if this isn`t the right place to post my question, but first I tried posting it on forum.kernelnewbies.org and nobody answered. Here`s my question:


I have a Gembird kb-9140l keyboard with some multimedia keys which are not working on linux. I thought about writing my own driver for it, so as a start, I wrote a small module, which registers an interrupt handler on irq 1 with the IRQF_SHARED flag. In the handler function I put a simple printk with the scancode read from the keyboard. The problem is, that the handler never gets executed. I searched on google, and found that because the native driver doesn`t share its interrupt with another modules, before I call request_irq I have to free the original interrupt handler from the native driver. This would make my computer practically unusable until I reboot, but at least I would see, it works, but it doesn`t. The original driver works fine after I insert my module, and the interrupt handler still doesn`t get called. The weird thing is, when I remove my module, my handler executes ones, and the scancode is 0xFE. 

The code is the following: 

#include <linux/module.h> 
#include <linux/kernel.h> 
#include <linux/init.h> 
#include <linux/interrupt.h> 
#include <asm/io.h> 


MODULE_LICENSE("Dual BSD/GPL");

static int gembirdkb_init(void); 
static void gembirdkb_exit(void); 


irq_handler_t irq_handler (int irq, void *dev_id, struct pt_regs *regs) 

static unsigned char scancode; 

scancode = inb (0x60); 

printk("gembirdkb: irq handled... scancode: %d\n",scancode); 

return (irq_handler_t) IRQ_HANDLED; 



static int gembirdkb_init(void) 

int ret; 

/* free original interrupt handler */ 
// free_irq(1, NULL); 

ret = request_irq (1, (irq_handler_t) irq_handler, IRQF_SHARED, "gembirdkb", (void *)&irq_handler); 

printk("gembirdkb: request_irq result: %d\n", ret); 

return ret; 


static void gembirdkb_exit(void) 

free_irq(1, (void *)&irq_handler); 



module_init(gembirdkb_init); 
module_exit(gembirdkb_exit); 

Is there any way I can remove the native driver, or I need to recompile the kernel without it, and insert mine? 

P.s.: Why every topic on the forum is full with questions about mac, iphone, samsung galaxy etc.?
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux