mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Need help on sending 5 consecutive USB keyboard LED on's.
@ 2005-12-26  2:09 Andrew Chuah
  0 siblings, 0 replies; only message in thread
From: Andrew Chuah @ 2005-12-26  2:09 UTC (permalink / raw)
  To: linux-kernel

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-12-26  2:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-26  2:09 Need help on sending 5 consecutive USB keyboard LED on's Andrew Chuah

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®