From ff0110f609148e9ea9c0ac0af4f6b564f72ce279 Mon Sep 17 00:00:00 2001 From: Matheus Date: Sat, 7 Jan 2023 18:28:06 -0300 Subject: [PATCH] jinx: xf86-input-mouse port --- .../xf86-input-mouse/jinx-working-patch.patch | 146 ++++++++++++++++++ recipes/xf86-input-mouse | 24 +++ source-recipes/xf86-input-mouse | 9 ++ 3 files changed, 179 insertions(+) create mode 100644 patches/xf86-input-mouse/jinx-working-patch.patch create mode 100644 recipes/xf86-input-mouse create mode 100644 source-recipes/xf86-input-mouse diff --git a/patches/xf86-input-mouse/jinx-working-patch.patch b/patches/xf86-input-mouse/jinx-working-patch.patch new file mode 100644 index 00000000..246601c6 --- /dev/null +++ b/patches/xf86-input-mouse/jinx-working-patch.patch @@ -0,0 +1,146 @@ +diff --git xf86-input-mouse-clean/configure.ac xf86-input-mouse-workdir/configure.ac +index 6c453cd..e27bdcb 100644 +--- xf86-input-mouse-clean/configure.ac ++++ xf86-input-mouse-workdir/configure.ac +@@ -84,6 +84,9 @@ case $host_os in + gnu*) + OS_MOUSE_NAME=hurd + ;; ++ astral*) ++ OS_MOUSE_NAME=astral ++ ;; + esac + AC_SUBST([OS_MOUSE_NAME]) + +diff --git xf86-input-mouse-workdir/src/astral_mouse.c xf86-input-mouse-workdir/src/astral_mouse.c +new file mode 100644 +index 0000000..49644ac +--- /dev/null ++++ xf86-input-mouse-workdir/src/astral_mouse.c +@@ -0,0 +1,126 @@ ++#ifdef HAVE_XORG_CONFIG_H ++#include ++#endif ++ ++#include ++#include ++#include ++#include "inputstr.h" ++#include "scrnintstr.h" ++#include "mipointer.h" ++ ++#include "xf86.h" ++#include "xf86Xinput.h" ++#include "mouse.h" ++#include "xf86_OSlib.h" ++#include "xisb.h" ++ ++#include ++#include ++#include ++ ++#include ++ ++ ++#define MOUSE_FLAG_RB 1 ++#define MOUSE_FLAG_MB 2 ++#define MOUSE_FLAG_LB 4 ++#define MOUSE_FLAG_B4 8 ++#define MOUSE_FLAG_B5 16 ++ ++ ++typedef struct { ++ int flags; ++ int x,y,z; ++} mousepacket_t; ++ ++static void astralReadInput(InputInfoPtr pInfo){ ++ MouseDevPtr mouse = pInfo->private; ++ mousepacket_t packet; ++ ++ while(read(pInfo->fd, &packet, sizeof(packet)) == sizeof(packet)){ ++ int b = mouse->lastButtons; ++ b &= ~0x7; ++ b |= (packet.flags & MOUSE_FLAG_RB) ? 1 : 0; ++ b |= (packet.flags & MOUSE_FLAG_MB) ? 2 : 0; ++ b |= (packet.flags & MOUSE_FLAG_LB) ? 4 : 0; ++ ++ mouse->PostEvent(pInfo, b, packet.x, -packet.y, packet.z, 0); ++ } ++ ++} ++ ++static Bool astralPreInit(InputInfoPtr pInfo, const char* proto, int flag){ ++ ++ MouseDevPtr mouse; ++ ++ mouse = pInfo->private; ++ ++ mouse->protocol = proto; ++ ++ xf86ProcessCommonOptions(pInfo, pInfo->options); ++ ++ pInfo->fd = xf86OpenSerial(pInfo->options); ++ if(pInfo->fd == -1){ ++ xf86Msg(X_ERROR, "%s: cannot open mouse device!\n", pInfo->name); ++ return FALSE; ++ } ++ ++ mouse->CommonOptions(pInfo); ++ pInfo->read_input = astralReadInput; ++ return true; ++ ++ ++} ++ ++#define DEVPATH "/dev/mouse" ++ ++static const char* getdevice(InputInfoPtr pInfo, const char* proto, int flag){ ++ ++ struct stat st; ++ ++ if(stat(DEVPATH, &st) == -1) ++ return NULL; ++ ++ pInfo->options = xf86AddNewOption(pInfo->options, "Device", DEVPATH); ++ ++ return DEVPATH; ++ ++} ++ ++static int interfacesupport(){ ++ return MSE_PS2; ++} ++ ++static const char* names[] = { ++ "AstralMouseDev", NULL ++}; ++ ++static const char** protonames(){ ++ return names; ++} ++ ++static const char* defaultproto(){ ++ return "AstralMouseDev"; ++} ++ ++static Bool isdefault(const char *protocol){ ++ return strcmp(protocol, defaultproto()) == 0; ++} ++ ++OSMouseInfoPtr OSMouseInit(int flag){ ++ OSMouseInfoPtr p; ++ ++ p = calloc(sizeof(OSMouseInfoRec), 1); ++ ++ if (!p) ++ return NULL; ++ p->SupportedInterfaces = interfacesupport; ++ p->BuiltinNames = protonames; ++ p->FindDevice = getdevice; ++ p->DefaultProtocol = defaultproto; ++ p->CheckProtocol = isdefault; ++ p->PreInit = astralPreInit; ++ return p; ++} ++ diff --git a/recipes/xf86-input-mouse b/recipes/xf86-input-mouse new file mode 100644 index 00000000..5fcb8776 --- /dev/null +++ b/recipes/xf86-input-mouse @@ -0,0 +1,24 @@ +name=xf86-input-mouse +revision=1 +from_source=xf86-input-mouse +imagedeps="gcc" +hostdeps="gcc-cross binutils-cross pkgconfig automake autoconf util-macros libtool" +deps="mlibc xorg-server" + +configure() { + + SYSROOT=${sysroot_dir} ${source_dir}/configure --prefix=${prefix} --host=x86_64-astral --disable-static + +} + +build() { + + make -j${parallelism} + +} + +install() { + + make DESTDIR=${dest_dir} install + +} diff --git a/source-recipes/xf86-input-mouse b/source-recipes/xf86-input-mouse new file mode 100644 index 00000000..16183d1b --- /dev/null +++ b/source-recipes/xf86-input-mouse @@ -0,0 +1,9 @@ +name=xf86-input-mouse +version=1.9.4 +source_method=tarball +tarball_url="https://xorg.freedesktop.org/archive/individual/driver/xf86-input-mouse-${version}.tar.gz" +tarball_sha512=31c23fa6fe7f77707b6eeb61e8d928b0fe8ffb49c3a5ddda36e36d48d20618c438580c573c5d9e40bc32d28612dd60886b3fff983aafd90b20a198b14c228587 +hostdeps="autoconf automake libtool pkgconfig util-macros" +regenerate() { + autoreconf -fvi +}