Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to rebind keyboard device in vm-display-fbdev (FrameBuffer) #575 #576

Open
wants to merge 7 commits into
base: Cog
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion build.linux32ARMv6/squeak.cog.spur/build.debug/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
set -e
# debug Spur VM with VM profiler and threaded heartbeat
INSTALLDIR=debug/sqcogspurlinuxhtRPi
OPT="-m32 -g3 -O0 -DDEBUGVM=1"
#OPT="-m32 -g3 -O0 -DDEBUGVM=1"
OPT="-g3 -O0 -DDEBUGVM=1 -DDEBUG=1 -DDEBUG_EVENTS -DDEBUG_KEYBOARD_EVENTS -DDEBUG_MOUSE_EVENTS -DMUSL -D_GNU_SOURCE"


if [ $# -ge 1 ]; then
INSTALLDIR="$1"; shift
Expand Down
2 changes: 1 addition & 1 deletion build.linux32ARMv6/squeak.cog.spur/build/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e
# Spur VM with VM profiler and threaded heartbeat
INSTALLDIR=sqcogspurlinuxhtRPi
OPT="-m32 -g -O2 -DNDEBUG -DDEBUGVM=0"
OPT=" -g -O2 -DNDEBUG -DDEBUGVM=0"

if [ $# -ge 1 ]; then
INSTALLDIR="$1"; shift
Expand Down
2 changes: 1 addition & 1 deletion build.linux32ARMv6/squeak.stack.spur/build.debug/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e
# debug Stack Spur VM with VM profiler and threaded heartbeat
INSTALLDIR=debug/sqstkspurlinuxhtRPi
OPT="-m32 -g3 -O0 -DDEBUGVM=1"
OPT="-m32 -g3 -O0 -DDEBUGVM=1 -DDEBUG_EVENTS=1 -DDEBUG_KEYBOARD_EVENTS -DDEBUG_MOUSE_EVENTS "

if [ $# -ge 1 ]; then
INSTALLDIR="$1"; shift
Expand Down
5 changes: 3 additions & 2 deletions build.linux64ARMv8/squeak.cog.spur/build.debug/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -e
INSTALLDIR=debug/sqcogspur64ARMv8linuxht
# armv8.N-a all fail in signalSemaphoreWithIndex for N in 1,2,3,4,5
MACHINE="-march=armv8-a -mtune=cortex-a72"
OPT="-g3 -O0 -DDEBUGVM=1 -DAIO_DEBUG=1"
OPT="-g3 -O0 -DDEBUGVM=1 -DAIO_DEBUG=1 -DDEBUG -DDEBUG_EVENTS -DDEBUG_KEYBOARD_EVENTS -DDEBUG_MOUSE_EVENTS -DMUSL -D_GNU_SOURCE"


if [ $# -ge 1 ]; then
INSTALLDIR="$1"; shift
Expand All @@ -20,7 +21,7 @@ test -f plugins.int || (test -f ../plugins.int && cp -p ../plugins.int . || cp -
test -f plugins.ext || (test -f ../plugins.ext && cp -p ../plugins.ext . || cp -p ../../plugins.ext .)
test -f config.h || ../../../platforms/unix/config/configure \
--with-vmversion=5.0 --with-src=spur64src \
--without-vm-display-fbdev --without-npsqueak \
--without-npsqueak \
CFLAGS="$MACHINE $OPT -DCOGMTVM=0 -DDUAL_MAPPED_CODE_ZONE=1" \
LIBS="-lrt"

Expand Down
3 changes: 2 additions & 1 deletion build.linux64ARMv8/squeak.cog.spur/build/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ set -e
INSTALLDIR=sqcogspur64ARMv8linuxht
# armv8.N-a all fail in signalSemaphoreWithIndex for N in 1,2,3,4,5
MACHINE="-march=armv8-a -mtune=cortex-a72"
OPT="-g -O2 -DNDEBUG -DDEBUGVM=0 -DMUSL -D_GNU_SOURCE -DUSEEVDEV"
OPT="-g -O2 -DNDEBUG -DDEBUGVM=0 -DMUSL -D_GNU_SOURCE"
##OPT="-g -O2 -DNDEBUG -DDEBUGVM=0 -DMUSL -D_GNU_SOURCE -DUSEEVDEV"
##OPT="-g -O3 -DNDEBUG -DDEBUGVM=0"

if [ $# -ge 1 ]; then
Expand Down
2 changes: 1 addition & 1 deletion build.linux64ARMv8/squeak.stack.spur/build.debug/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e
# debug Stack Spur VM with VM profiler and threaded heartbeat
INSTALLDIR=debug/sqstkspur64ARMv8linuxht
OPT="-g3 -O0 -DDEBUG -DDEBUGVM=1 -DDEBUG_EVENTS -DDEBUG_KEYBOARD_EVENTS -DDEBUG_MOUSE_EVENTS -DUSEEVDEV -DMUSL"
OPT="-g3 -O0 -DDEBUG -DDEBUGVM=1 -DDEBUG_EVENTS -DDEBUG_KEYBOARD_EVENTS -DDEBUG_MOUSE_EVENTS -DMUSL"

### OPT="-g3 -O0 -DDEBUGVM=1"

Expand Down
3 changes: 2 additions & 1 deletion build.linux64ARMv8/squeak.stack.spur/build/mvm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
set -e
# Stack Spur VM with VM profiler and threaded heartbeat
INSTALLDIR=sqstkspur64ARMv8linuxht
OPT="-g -O2 -DNDEBUG -DDEBUGVM=0 -DMUSL -D_GNU_SOURCE -DUSEEVDEV"
OPT="-g -O2 -DNDEBUG -DDEBUGVM=0 -DMUSL -D_GNU_SOURCE"
##OPT="-g -O2 -DNDEBUG -DDEBUGVM=0 -DMUSL -D_GNU_SOURCE -DUSEEVDEV"
### OPT="-g -O2 -DNDEBUG -DDEBUGVM=0"

if [ $# -ge 1 ]; then
Expand Down
7 changes: 5 additions & 2 deletions platforms/unix/vm-display-fbdev/sqUnixEvdevKeyMouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -535,9 +535,12 @@ void kb_open(struct kb *kbdSelf, int vtSwitch, int vtLock)
int rc;

assert(kbDev.fd == -1);
kbDev.fd= open(kbDev.kbName= KEYBOARD_DEV_NAME, O_RDONLY|O_NONBLOCK);
if (kbDev.kbName == 0) {
kbDev.kbName= KEYBOARD_DEV_NAME;
}
kbDev.fd= open(kbDev.kbName, O_RDONLY|O_NONBLOCK);
if (kbDev.fd < 0) {
DPRINTF("FAILED TO OPEN: %s\n", KEYBOARD_DEV_NAME);
DPRINTF("FAILED TO OPEN: %s\n", kbDev.kbName);
failPermissions("console");
} else {
DPRINTF("evdev opened Keyboard device %s\n", kbDev.kbName);
Expand Down
47 changes: 25 additions & 22 deletions platforms/unix/vm-display-fbdev/sqUnixFBDev.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,12 @@ static struct kb *kb= 0;
static struct fb *fb= 0;

#include "sqUnixFBDevUtil.c"
#ifdef USEEVDEV
#include "sqUnixEvdevKeycodeMap.c"
#include "sqUnixEvdevKeyMouse.c"
#else
#ifdef NOEVDEV
#include "sqUnixFBDevMouse.c"
#include "sqUnixFBDevKeyboard.c"
#else
#include "sqUnixEvdevKeycodeMap.c"
#include "sqUnixEvdevKeyMouse.c"
#endif
#include "sqUnixFBDevFramebuffer.c"

Expand Down Expand Up @@ -173,7 +173,7 @@ static void openKeyboard(void)
{
kb= kb_new();
kb_open(kb, vtSwitch, vtLock);
#ifndef USEEVDEV
#ifdef NOEVDEV
kb_setCallback(kb, enqueueKeyboardEvent);
#endif
}
Expand All @@ -182,11 +182,11 @@ static void closeKeyboard(void)
{
if (kb)
{
#ifndef USEEVDEV
#ifdef NOEVDEV
kb_setCallback(kb, 0);
#endif
kb_close(kb);
#ifndef USEEVDEV
#ifdef NOEVDEV
kb_delete(kb);
#endif
kb= 0;
Expand All @@ -209,7 +209,7 @@ static void openMouse(void)
{
ms= ms_new();
ms_open(ms, msDev, msProto);
#ifndef USEEVDEV
#ifdef NOEVDEV
ms_setCallback(ms, enqueueMouseEvent);
#endif
}
Expand All @@ -218,11 +218,11 @@ static void closeMouse(void)
{
if (ms)
{
#ifndef USEEVDEV
#ifdef NOEVDEV
ms_setCallback(ms, 0);
#endif
ms_close(ms);
#ifndef USEEVDEV
#ifdef NOEVDEV
ms_delete(ms);
#endif
ms= 0;
Expand All @@ -246,12 +246,12 @@ static sqInt display_ioRelinquishProcessorForMicroseconds(sqInt microSeconds)

static sqInt display_ioProcessEvents(void)
{
#ifdef USEEVDEV
#ifdef NOEVDEV
aioPoll(0);
#else
processLibEvdevMouseEvents();
processLibEvdevKeyEvents(); /* sets modifier bits */
processLibEvdevMouseEvents();
#else
aioPoll(0);
#endif
return 0;
}
Expand Down Expand Up @@ -314,7 +314,7 @@ static void openDisplay(void)
openFramebuffer();
// init mouse after setting graf mode on tty avoids packets being
// snarfed by gpm
#ifndef USEEVDEV
#ifdef NOEVDEV
ms->init(ms);
#endif
}
Expand All @@ -340,7 +340,7 @@ static void display_winInit(void)
#if defined(AT_EXIT)
AT_EXIT(closeDisplay);
#else
# warning: cannot release /dev/fb on exit!
# warning: cannot release /dev/fb0 on exit!
# endif

(void)recordMouseEvent;
Expand All @@ -365,7 +365,7 @@ static void failPermissions(const char *who)
fprintf(stderr, " (you might be able to load one with 'modprobe'; look in\n");
fprintf(stderr, " /lib/modules for something called '<your-card>fb.o'\n");
fprintf(stderr, " - you don't have write permission on some of the following\n");
fprintf(stderr, " /dev/tty*, /dev/fb*, /dev/psaux, /dev/input/mice\n");
fprintf(stderr, " /dev/tty*, /dev/fb*, /dev/input/event?, /dev/input/mouse0\n");
fprintf(stderr, " - you need to run Squeak as root on your machine\n");
exit(1);
}
Expand All @@ -374,12 +374,13 @@ static void failPermissions(const char *who)
static void display_printUsage(void)
{
printf("\nFBDev <option>s:\n");
printf(" -fbdev <dev> use framebuffer device <dev> (default: /dev/fb)\n");
printf(" -kbmap <file> load keymap from <file> (default: use kernel keymap)\n");
printf(" -msdev <dev> use mouse device <dev> (default: /dev/psaux)\n");
printf(" -msproto <protocol> use the given <protocol> for the mouse (default: ps2)\n");
printf(" -vtlock disallow all vt switching (for any reason)\n");
printf(" -vtswitch enable keyboard vt switching (Alt+FNx)\n");
printf(" -fbdev <dev> use framebuffer device <dev> (default: /dev/fb0)\n");
printf(" -kbmap <file> load keymap from <file> \n");
printf(" [Make file by: 'dumpkeys -f -n --keys-only > squeak-kb.map' ]\n");
printf(" -msdev <dev> use mouse device <dev> (default: /dev/input/event1)\n");
printf(" -kbdev <dev> use keyboard device <dev> (default: /dev/input/event0)\n");
/* printf(" -vtlock disallow all vt switching (for any reason)\n");
printf(" -vtswitch enable keyboard vt switching (Alt+FNx)\n"); */
}


Expand All @@ -395,6 +396,7 @@ static void display_parseEnvironment(void)
if ((ev= getenv("SQUEAK_FBDEV"))) fbDev= strdup(ev);
if ((ev= getenv("SQUEAK_KBMAP"))) kmPath= strdup(ev);
if ((ev= getenv("SQUEAK_MSDEV"))) msDev= strdup(ev);
if ((ev= getenv("SQUEAK_KBDEV"))) kbDev.kbName= strdup(ev);
if ((ev= getenv("SQUEAK_MSPROTO"))) msProto= strdup(ev);
if ((ev= getenv("SQUEAK_VTLOCK"))) vtLock= 1;
if ((ev= getenv("SQUEAK_VTSWITCH"))) vtSwitch= 1;
Expand All @@ -414,6 +416,7 @@ static int display_parseArgument(int argc, char **argv)
if (!strcmp(arg, "-fbdev")) fbDev= argv[1];
else if (!strcmp(arg, "-kbmap")) kmPath= argv[1];
else if (!strcmp(arg, "-msdev")) msDev= argv[1];
else if (!strcmp(arg, "-kbdev")) kbDev.kbName= argv[1];
else if (!strcmp(arg, "-msproto")) msProto= argv[1];
else
n= 0; /* not recognised */
Expand Down
2 changes: 1 addition & 1 deletion platforms/unix/vm-display-fbdev/sqUnixFBDevFramebuffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ static int fb_open(_self, struct kb *kb, char *fbDev)
self->fd= open(self->fbName= fbDev, O_RDWR);
else
{
char *fbs[]= { "/dev/fb", "/dev/fb0", "/dev/fb0current", 0 };
char *fbs[]= { "/dev/fb0", "/dev/fb", "/dev/fb0current", 0 };
int i;
for (i= 0; fbs[i]; ++i)
if ((self->fd= open(self->fbName= fbs[i], O_RDWR)) >= 0)
Expand Down