wskbd without wsdisplay

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

wskbd without wsdisplay

allan
I want to use an USB-keyboard/barcode-reader on a pc-engines apu.  Since
the apu has no graphics card, there is no wsdisplay and the keyboard stays
unconnected.

    # wsconscfg -k
    wsconscfg: /dev/ttyCcfg: Device not configured

How can I read that keyboard input?  Do I even have to write some C and use
usbhid.h or is there an api in wscons for that?  Or something simpler?
Any hints or directions to go would be appreciated.

Thanks.
Reply | Threaded
Open this post in threaded view
|

Re: wskbd without wsdisplay

allan
lol, how bout dat? only needin dem digits anyways.

    fd = fopen("/dev/wskbd0", "r");
    if (fd != NULL) {
        c = 0;
        while (c < 9) {
            fread(buf, 48, 1, fd);
            if (buf[0] == 2 && buf[1] == 0 && buf[2] == 0 && buf[3] == 0) {
                z = buf[4] - 29;
                if (z == 10)
                    z = 0;

                printf("%d", z);
                c++;
            }
        }
    } else
        perror("wskdb0");

On Wed, Sep 4, 2019 at 5:10 PM allan <[hidden email]> wrote:

> I want to use an USB-keyboard/barcode-reader on a pc-engines apu.  Since
> the apu has no graphics card, there is no wsdisplay and the keyboard stays
> unconnected.
>
>     # wsconscfg -k
>     wsconscfg: /dev/ttyCcfg: Device not configured
>
> How can I read that keyboard input?  Do I even have to write some C and
> use usbhid.h or is there an api in wscons for that?  Or something simpler?
> Any hints or directions to go would be appreciated.
>
> Thanks.
>
>