Sending 5 consecutive keyboard LED on's.

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

 



Hi,

I just bought an IPAC-VE from www.ultimarc.com. It is basically a USB
keyboard emulator and I can hook it up to my arcade joystick to play MAME.
Now, the problem is that there is no programming utility for it in Linux, so
I am taking a look at trying to make one. There was one written in 2002 at
http://www.zumbrovalley.net/ipacutil/ but it no longer works for kernel 2.6.

The problem is that the way the PC talks to the emulator is by sending
keyboard LED signals. The first handshake is done by PC sending 5 "all LED
on" codes, and the emulator replies by sending a "z". So, I downloaded the
source for ipacutil and ran it, but it didn't work. I looked through the
kernel source (I'm running 2.6.9), and it looked like Linux doesn't send 2
"on" events consecutively.

So, I made the following changes in drivers/input/input.c:
        case EV_LED:

//            if (code > LED_MAX || !test_bit(code, dev->ledbit) ||
!!test_bit(code, dev->led) == value) {
            if (code > LED_MAX || !test_bit(code, dev->ledbit)) {
                printk(KERN_WARNING "Failed to turn on LED in input.c");
                return;
            }
            if (value == 1) {
                printk(KERN_WARNING "Setting LED now in input.c");
                set_bit(code, dev->led);
            } else if (value == 0) {
                printk(KERN_WARNING "Clearing LED now in input.c");
                clear_bit(code, dev->led);
            }
            // change_bit(code, dev->led);
            if (dev->event) dev->event(dev, type, code, value);

            break;

Instead of change_bit, I used set_bit and clear_bit. I also changed
drivers/char/keyboard.c

void setledstate(struct kbd_struct *kbd, unsigned int led)
{
    if (!(led & ~7)) {
        ledioctl = led;
        ledstate = 0xff; -- added this line
        printk(KERN_WARNING "In setledstate: flushing ledstate");
        kbd->ledmode = LED_SHOW_IOCTL;
    } else {
        printk(KERN_WARNING "In setledstate: in else");
        kbd->ledmode = LED_SHOW_FLAGS;
    }
    set_leds();
}


After all this, I modprobe evbug, and I see that ipacutil is "sending"
5 all LED ons, according to the log messages. However, I still don't
get a response. Is there something else I'm missing??? Can someone who
is more knowledgable point me to how to send all LED ons 5 times?

thx,
andrew

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[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