Need help on sending 5 consecutive USB 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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux