summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPengcheng Chen - Sun Microsystems <Pengcheng.Chen@Sun.COM>2010-01-28 16:17:17 +0800
committerJason Gerecke <killertofu@gmail.com>2013-04-02 10:57:52 -0700
commit2e9e0939887e451d79d6274c018a94282851b2c5 (patch)
treef488051738808a50e3d306d2175a1be99eb60243
parentd6a194c80623c5306d60ee3f234863b3b4bacc6d (diff)
downloadxf86-input-wacom-solaris.tar.gz
Add Solaris supportsolaris
Patch obtained from OpenSolaris site for use with snv_130 or newer: http://hub.opensolaris.org/bin/view/Community+Group+device_drivers/wacomtablet Signed-off-by: Pengcheng Chen - Sun Microsystems <Pengcheng.Chen@Sun.COM>
-rw-r--r--README7
-rw-r--r--configure.ac22
-rw-r--r--fdi/Makefile.am2
-rw-r--r--fdi/wacom.fdi9
-rw-r--r--include/solaris-usbwcm.h98
-rw-r--r--src/Makefile.am2
-rw-r--r--src/wcmUSB.c17
-rw-r--r--src/wcmValidateDevice.c31
-rw-r--r--src/xf86Wacom.c9
-rw-r--r--src/xf86Wacom.h4
-rw-r--r--src/xf86WacomDefs.h9
11 files changed, 201 insertions, 9 deletions
diff --git a/README b/README
index aaef526..e007202 100644
--- a/README
+++ b/README
@@ -26,6 +26,13 @@ Adjust the prefix according to your local setup, in most cases, a prefix of
BUILDING FROM TARBALL:
$ ./configure && make
+
+On Solaris (i386):
+ $ ./configure --with-hal-data-dir=/etc/hal && make
+
+On Solaris (amd64):
+ $ ./configure --enable-xserver64 --with-hal-data-dir=/etc/hal && make
+
Adjust the prefix according to your local setup, in most cases, a prefix of
/usr is correct.
diff --git a/configure.ac b/configure.ac
index a2088a1..44cebed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,6 @@
# Copyright 2005 Adam Jackson.
+# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+# Use is subject to license terms.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
@@ -54,19 +56,37 @@ AC_ARG_ENABLE(debug, AS_HELP_STRING([--enable-debug],
[DEBUGGING=$enableval], [DEBUGGING=no])
+AC_ARG_ENABLE(xserver64, AC_HELP_STRING([--enable-xserver64],
+ [Build for 64bit Xserver [[default=usually]]]),
+ [XSERVER64=$enableval ], [XSERVER64=no])
+
AC_ARG_WITH(xorg-module-dir,
AC_HELP_STRING([--with-xorg-module-dir=DIR],
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
[moduledir="$withval"],
[moduledir="$libdir/xorg/modules"])
inputdir=${moduledir}/input
-AC_SUBST(inputdir)
+
+AC_ARG_WITH(hal-data-dir,
+ AC_HELP_STRING([--with-hal-data-dir=DIR],
+ [Default HAL data directory [[default=$datadir/hal]]]),
+ [haldatadir="$withval"],
+ [haldatadir="$datadir/hal"])
+AC_SUBST(haldatadir)
if test "x$DEBUGGING" = xyes; then
AC_DEFINE(DEBUG, 1, [Enable debugging code])
fi
AM_CONDITIONAL(DEBUG, [test "x$DEBUGGING" = xyes])
+# Solaris: 64-bit build
+if test "x$XSERVER64" = xyes; then
+ XDRV_CFLAGS="-m64 -D__amd64__"
+ inputdir=${inputdir}/amd64
+fi
+AC_SUBST(XDRV_CFLAGS)
+AC_SUBST(inputdir)
+
# Checks for extensions
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
diff --git a/fdi/Makefile.am b/fdi/Makefile.am
index cafb94a..1d6d34a 100644
--- a/fdi/Makefile.am
+++ b/fdi/Makefile.am
@@ -1,3 +1,3 @@
EXTRA_DIST = wacom.fdi
-fdidir = $(datadir)/hal/fdi/policy/20thirdparty
+fdidir = $(haldatadir)/fdi/policy/20thirdparty
dist_fdi_DATA = wacom.fdi
diff --git a/fdi/wacom.fdi b/fdi/wacom.fdi
index 5c71563..fc9c3d5 100644
--- a/fdi/wacom.fdi
+++ b/fdi/wacom.fdi
@@ -6,6 +6,15 @@
<match key="info.product" contains_outof="Wacom;WALTOP;WACOM">
<merge key="input.x11_driver" type="string">wacom</merge>
</match>
+ <!-- Solaris -->
+ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="SunOS">
+ <match key="@info.parent:usb.vendor_id" int="0x56a">
+ <merge key="info.product" type="string">Wacom USB Tablet</merge>
+ <merge key="input.x11_driver" type="string">wacom</merge>
+ <remove key="input.x11_options.StreamsModule" type="string"></remove>
+ <remove key="input.x11_options.Protocol" type="string"></remove>
+ </match>
+ </match>
</match>
<match key="info.capabilities" contains="serial">
<match key="@info.parent:pnp.id" contains_outof="WACf;FUJ02e5;FUJ02e7">
diff --git a/include/solaris-usbwcm.h b/include/solaris-usbwcm.h
new file mode 100644
index 0000000..826b5e5
--- /dev/null
+++ b/include/solaris-usbwcm.h
@@ -0,0 +1,98 @@
+/*
+ * Copyright 1999-2002 Vojtech Pavlik
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ */
+#ifndef _SOLARIS_USBWCM_H
+#define _SOLARIS_USBWCM_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define EVIOCGVERSION EVTIOCGVERSION
+#define EVIOCGID EVTIOCGDEVID
+#define EVIOCGBIT EVTIOCGBM
+#define EVIOCGABS EVTIOCGABS
+
+#define input_event event_input
+#define input_id event_dev_id
+#define input_absinfo event_abs_axis
+ #define maximum max
+
+#define EV_KEY EVT_BTN
+#define EV_REL EVT_REL
+#define EV_ABS EVT_ABS
+#define EV_SYN EVT_SYN
+#define EV_MSC EVT_MSC
+#define EV_MAX EVT_MAX
+
+#define KEY_MAX BTN_MAX
+
+#define BTN_0 BTN_MISC_0
+#define BTN_1 BTN_MISC_1
+#define BTN_2 BTN_MISC_2
+#define BTN_3 BTN_MISC_3
+#define BTN_4 BTN_MISC_4
+#define BTN_5 BTN_MISC_5
+#define BTN_6 BTN_MISC_6
+#define BTN_7 BTN_MISC_7
+#define BTN_8 BTN_MISC_8
+#define BTN_9 0x109
+
+#define BTN_FORWARD 0x115
+#define BTN_BACK 0x116
+
+#define BTN_BASE 0x126
+#define BTN_BASE2 0x127
+#define BTN_BASE3 0x128
+#define BTN_BASE4 0x129
+#define BTN_BASE5 0x12a
+#define BTN_BASE6 0x12b
+
+#define BTN_A 0x130
+#define BTN_B 0x131
+#define BTN_C 0x132
+#define BTN_X 0x133
+#define BTN_Y 0x134
+#define BTN_Z 0x135
+#define BTN_TL 0x136
+#define BTN_TR 0x137
+#define BTN_TL2 0x138
+#define BTN_TR2 0x139
+#define BTN_SELECT 0x13a
+
+#define BTN_TOOL_TRIPLETAP 0x14e
+
+#define BTN_STYLUS BTN_STYLUS_1
+#define BTN_STYLUS2 BTN_STYLUS_2
+
+#define BTN_TOOL_RUBBER BTN_TOOL_ERASER
+#define BTN_TOOL_LENS BTN_TOOL_MOUSE
+
+#define BTN_TOOL_PENCIL BTN_TOOL_PEN
+#define BTN_TOOL_BRUSH BTN_TOOL_PEN
+#define BTN_TOOL_AIRBRUSH BTN_TOOL_PEN
+#define BTN_TOOL_FINGER BTN_TOOL_PAD
+#define BTN_TOUCH BTN_TIP
+
+#define ABS_THROTTLE 0x06
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _SOLARIS_USBWCM_H */
diff --git a/src/Makefile.am b/src/Makefile.am
index 461089f..39bf392 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -24,7 +24,7 @@
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
# _ladir passes a dummy rpath to libtool so the thing will actually link
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
-AM_CFLAGS = $(XORG_CFLAGS)
+AM_CFLAGS = $(XORG_CFLAGS) $(XDRV_CFLAGS)
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
diff --git a/src/wcmUSB.c b/src/wcmUSB.c
index 954af06..570d7a3 100644
--- a/src/wcmUSB.c
+++ b/src/wcmUSB.c
@@ -1,6 +1,8 @@
/*
* Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org>
* Copyright 2002-2009 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -375,6 +377,19 @@ static Bool usbDetect(LocalDevicePtr local)
DBG(1, priv, "\n");
#endif
+#ifdef sun
+ /* On Solaris, usbwcm STREAMS module is required */
+ err = ioctl(local->fd, I_FIND, "usbwcm");
+ if (err == 0)
+ err = ioctl(local->fd, I_PUSH, "usbwcm");
+ if (err < 0)
+ {
+ xf86Msg(X_ERROR, "%s: usbDetect: failed to push STREAMS module\n",
+ local->name);
+ return err;
+ }
+#endif /* sun */
+
SYSCALL(err = ioctl(local->fd, EVIOCGVERSION, &version));
if (err < 0)
@@ -513,7 +528,9 @@ Bool usbWcmInit(LocalDevicePtr local, char* id, float *version)
/* fetch vendor, product, and model name */
ioctl(local->fd, EVIOCGID, &sID);
+#ifdef EVIOCGNAME /* this ioctl is not supported on Solairs */
ioctl(local->fd, EVIOCGNAME(sizeof(id)), id);
+#endif
/* retrieve tool type, device type and buttons from the kernel */
if (ioctl(local->fd, EVIOCGBIT(EV_KEY,sizeof(keys)),keys) < 0)
diff --git a/src/wcmValidateDevice.c b/src/wcmValidateDevice.c
index e8f4c2b..1eac0d3 100644
--- a/src/wcmValidateDevice.c
+++ b/src/wcmValidateDevice.c
@@ -1,5 +1,7 @@
/*
* Copyright 2009 by Ping Cheng, Wacom. <pingc@wacom.com>
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -24,10 +26,9 @@
#include "wcmFilter.h"
#include <sys/stat.h>
#include <fcntl.h>
+#ifndef sun
#include <linux/serial.h>
-
-#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
-
+#endif
Bool wcmIsAValidType(const char *type, unsigned long* keys);
int wcmNeedAutoHotplug(LocalDevicePtr local, const char **type,
@@ -147,7 +148,7 @@ ret:
static struct
{
const char* type;
- __u16 tool;
+ uint16_t tool;
} wcmType [] =
{
{ "stylus", BTN_TOOL_PEN },
@@ -185,7 +186,9 @@ int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys)
int fd = -1, id = 0;
char* device, *stopstring;
char* str = strstr(local->name, "WACf");
+#ifndef sun
struct serial_struct tmp;
+#endif
device = xf86SetStrOption(local->options, "Device", NULL);
@@ -201,7 +204,8 @@ int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys)
for (i=0; i<NBITS(KEY_MAX); i++)
keys[i] = 0;
- /* serial ISDV4 devices */
+#ifdef TIOCGSERIAL
+ /* serial ISDV4 devices: not supported on Solaris */
if (ioctl(fd, TIOCGSERIAL, &tmp) == 0)
{
if (str) /* id in name */
@@ -250,8 +254,23 @@ int wcmDeviceTypeKeys(LocalDevicePtr local, unsigned long* keys)
keys[LONG(BTN_TOOL_RUBBER)] &= ~BIT(BTN_TOOL_RUBBER);
}
}
- else /* USB devices */
+ else
+#endif /* TIOCGSERIAL */
+ /* USB devices */
{
+#ifdef sun
+ /* push usbwcm STREAMS module: required on Solaris */
+ ret = ioctl(fd, I_FIND, "usbwcm");
+ if (ret == 0)
+ ret = ioctl(fd, I_PUSH, "usbwcm");
+ if (ret < 0)
+ {
+ xf86Msg(X_ERROR, "%s: failed to push STREAMS module on %s in "
+ "wcmDeviceTypeKeys.\n", local->name, device);
+ return ret;
+ }
+#endif /* sun */
+
/* test if the tool is defined in the kernel */
if (ioctl(fd, EVIOCGBIT(EV_KEY, (sizeof(unsigned long)
* NBITS(KEY_MAX))), keys) < 0)
diff --git a/src/xf86Wacom.c b/src/xf86Wacom.c
index 231325d..47f313a 100644
--- a/src/xf86Wacom.c
+++ b/src/xf86Wacom.c
@@ -1,6 +1,8 @@
/*
* Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org>
* Copyright 2002-2009 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -41,7 +43,9 @@
#include <sys/stat.h>
#include <fcntl.h>
+#ifndef sun
#include <linux/serial.h>
+#endif
#include "xf86Wacom.h"
@@ -961,7 +965,9 @@ static Bool xf86WcmOpen(LocalDevicePtr local)
char id[BUFFER_SIZE];
float version;
int rc;
+#ifndef sun
struct serial_struct ser;
+#endif
DBG(1, priv, "opening device file\n");
@@ -973,6 +979,8 @@ static Bool xf86WcmOpen(LocalDevicePtr local)
return !Success;
}
+#ifdef TIOCGSERIAL
+ /* this ioctl is not supported on Solaris */
rc = ioctl(local->fd, TIOCGSERIAL, &ser);
/* we initialized wcmDeviceClasses to USB
@@ -987,6 +995,7 @@ static Bool xf86WcmOpen(LocalDevicePtr local)
common->wcmTPCButtonDefault = 1;
}
else
+#endif /* TIOCGSERIAL */
{
/* Detect USB device class */
if ((&gWacomUSBDevice)->Detect(local))
diff --git a/src/xf86Wacom.h b/src/xf86Wacom.h
index 351abb1..92aeb5f 100644
--- a/src/xf86Wacom.h
+++ b/src/xf86Wacom.h
@@ -1,6 +1,8 @@
/*
* Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org>
* Copyright 2002-2009 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -29,8 +31,10 @@
* Linux Input Support
****************************************************************************/
+#ifndef sun
#include <asm/types.h>
#include <linux/input.h>
+#endif
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
diff --git a/src/xf86WacomDefs.h b/src/xf86WacomDefs.h
index 34a9375..a3b4bb2 100644
--- a/src/xf86WacomDefs.h
+++ b/src/xf86WacomDefs.h
@@ -1,6 +1,8 @@
/*
* Copyright 1995-2002 by Frederic Lepied, France. <Lepied@XFree86.org>
* Copyright 2002-2009 by Ping Cheng, Wacom Technology. <pingc@wacom.com>
+ * Copyright 2010 Sun Microsystems, Inc. All rights reserved.
+ * Use is subject to license terms.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -23,8 +25,15 @@
/*****************************************************************************
* General Defines
****************************************************************************/
+#ifdef sun /* Solaris */
+#include <sys/stropts.h>
+#include <sys/usb/clients/usbinput/usbwcm/usbwcm.h>
+#include "../include/solaris-usbwcm.h"
+#else
#include <asm/types.h>
#include <linux/input.h>
+#endif
+
#define MAX_USB_EVENTS 32
#define WACOM_VENDOR_ID 0x056a /* vendor ID on the kernel device */