Bug 129906 - [maintainer-update] x11-drivers/input-wacom port maintenance
Summary: [maintainer-update] x11-drivers/input-wacom port maintenance
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Martin Wilke
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-24 12:40 UTC by kamikaze
Modified: 2009-01-17 23:00 UTC (History)
0 users

See Also:


Attachments
file.diff (8.81 KB, patch)
2008-12-24 12:40 UTC, kamikaze
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description kamikaze 2008-12-24 12:40:02 UTC
There have been some improvements to the port. However Bartosz says he will need some time before he catches up with the latest linux-wacom version, so I have decided to introduce these improvements separately.

Note that the version number is not changed, since the improvements are not useful to those who already have their wacom driver up and running.

Also note that files/pkg-message.in is obsolete and should be removed.
Comment 1 Edwin Groothuis freebsd_committer 2008-12-24 12:40:22 UTC
Class Changed
From-To: sw-bug->maintainer-update

Fix category (submitter is maintainer) (via the GNATS Auto Assign Tool)
Comment 2 Martin Wilke freebsd_committer 2008-12-24 16:18:05 UTC
Responsible Changed
From-To: freebsd-ports-bugs->miwi

I'll take it.
Comment 3 kamikaze 2008-12-27 16:50:31 UTC
Please hold it. Bartosz has suddenly come up with a new
version and I want to test and submit it as soon as
possible.

Regards
Comment 4 kamikaze 2009-01-05 20:01:34 UTC
OK, I have successfully tested the new version with an Intuos3 A5.
Here's the patch. Note that files/pkg-message.in and
files/patch-linuxwacom-run_configure should be deleted.

Regards



diff -Pur ports/x11-drivers/input-wacom.orig/Makefile ports/x11-drivers/input-wacom/Makefile
--- ports/x11-drivers/input-wacom.orig/Makefile	2008-11-21 03:12:05.000000000 +0100
+++ ports/x11-drivers/input-wacom/Makefile	2008-12-26 12:09:02.000000000 +0100
@@ -30,18 +30,19 @@
 WRKSRC=		${WRKDIR}
 
 PLIST_SUB+=	KMODDIR=${KMODDIR} \
-		XINPUTMODDIR=${XINPUTMODDIR}
+		XINPUTMODDIR=${XINPUTMODDIR} \
+		PORTTYPE=${PORTTYPE}
 SUB_LIST:=	${PLIST_SUB}
-SUB_FILES+=	pkg-message
-PKGMESSAGE=	${WRKDIR}/pkg-message
+SUB_FILES+=	pkg-message-${PORTTYPE}
+PKGMESSAGE=	${WRKDIR}/pkg-message-${PORTTYPE}
 
 XORG_CAT=	driver
 USE_XORG=	xi
 
 LINUXWACOM=	linuxwacom-${WACOM_VERSION}
 BSDWACOM=	bsdwacom-${KLD_VERSION}
-WACOM_VERSION=	0.8.1-3
-KLD_VERSION=	38
+WACOM_VERSION=	0.8.2
+KLD_VERSION=	40
 
 OPTIONS=	UWACOMKLD "Install USB kernel module" On
 
@@ -49,14 +50,16 @@
 
 .if defined(WITH_UWACOMKLD)
 PLIST_SUB+=	UWACOMKLD="uwacom.ko"
+PORTTYPE=	usb
 .else
 PLIST_SUB+=	UWACOMKLD="@noinst UWACOMKLD uwacom.ko"
+PORTTYPE=	serial
 .endif
 
 do-configure:
 	@cd ${WRKDIR}/linuxwacom \
 		&& ${LN} -s ${DISTDIR}/${DIST_SUBDIR}/${LINUXWACOM}.tar.bz2 \
-		&& ${SETENV} PREFIX=${PREFIX} ./run_configure
+		&& ${SETENV} ${MAKE_ENV} ./run_configure
 
 do-build:
 .if defined(WITH_UWACOMKLD)
@@ -73,7 +76,7 @@
 .endif
 	@${MKDIR} ${PREFIX}/${XINPUTMODDIR} ${PREFIX}/${MAN4DIR}
 	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util/ \
-		&& ${GMAKE} install
+		&& ${SETENV} ${MAKE_ENV} ${GMAKE} install
 	@${INSTALL} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/xdrv/wacom_drv.so \
 		${PREFIX}/${XINPUTMODDIR}/
 	@${INSTALL_MAN} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/wacom.4x.gz \
@@ -84,11 +87,12 @@
 	@${TOUCH} ${PLIST}
 	@${RM} ${PLIST}
 	@cd ${WRKDIR}/linuxwacom \
-		&& ${SETENV} PREFIX=${WRKDIR}/plist ./run_configure
+		&& ${SETENV} ${MAKE_ENV} PREFIX=${WRKDIR}/plist ./run_configure
 	@${MKDIR} ${WRKDIR}/plist
-	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util && ${GMAKE} install
+	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util \
+		&& ${SETENV} ${MAKE_ENV} ${GMAKE} install
 	@cd ${WRKDIR}/linuxwacom \
-		&& ${SETENV} PREFIX=${PREFIX} ./run_configure
+		&& ${SETENV} ${MAKE_ENV} ./run_configure
 	@${FIND} ${WRKDIR}/plist/ -not -type d \
 		| ${SED} "s|${WRKDIR}/plist/||1" \
 		>> ${PLIST}
diff -Pur ports/x11-drivers/input-wacom.orig/distinfo ports/x11-drivers/input-wacom/distinfo
--- ports/x11-drivers/input-wacom.orig/distinfo	2008-11-18 15:07:40.000000000 +0100
+++ ports/x11-drivers/input-wacom/distinfo	2009-01-04 20:05:34.000000000 +0100
@@ -1,6 +1,6 @@
-MD5 (xorg/driver/bsdwacom-38.tbz) = fae10723e12b5bfc5daea411639f0ed4
-SHA256 (xorg/driver/bsdwacom-38.tbz) = 0d9027b5d781cd520ebe41287b388973465e8d62109c5d3f52d68f12ede03507
-SIZE (xorg/driver/bsdwacom-38.tbz) = 19993
-MD5 (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = d09b212946e321cc503adf84e243ca99
-SHA256 (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = cf1ac159d87666d16e2e3bfad81ede93e088b3bf64bb6d2d469adceb2a4c9dee
-SIZE (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = 1209228
+MD5 (xorg/driver/bsdwacom-40.tbz) = 022a5225cca8bbf3af1014d32d5c12de
+SHA256 (xorg/driver/bsdwacom-40.tbz) = 42c37d321768ff29fef10eb088a87a83c94753a1b4ae5f92fd453781039a5df9
+SIZE (xorg/driver/bsdwacom-40.tbz) = 19305
+MD5 (xorg/driver/linuxwacom-0.8.2.tar.bz2) = cb0647197556c3ab9079b37966a5adc1
+SHA256 (xorg/driver/linuxwacom-0.8.2.tar.bz2) = 5f3096d7194940ca583be8b63b59bb75001d01f1a4a75c1807c8f01cf697dfb5
+SIZE (xorg/driver/linuxwacom-0.8.2.tar.bz2) = 1092825
Only in ports/x11-drivers/input-wacom.orig/files: patch-linuxwacom-run_configure
diff -Pur ports/x11-drivers/input-wacom.orig/files/pkg-message-serial.in ports/x11-drivers/input-wacom/files/pkg-message-serial.in
--- ports/x11-drivers/input-wacom.orig/files/pkg-message-serial.in	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/files/pkg-message-serial.in	2008-11-25 09:59:31.000000000 +0100
@@ -0,0 +1,12 @@
+To setup the wacom driver for X run the following commands as the root user:
+# %%PREFIX%%/etc/rc.d/wacom onesetup
+
+Now open your xorg.conf file and check weather the correct serial device
+was chosen. If you are using a USB to serial converter you might have
+to change it to cuaUX.
+
+You can clean up the Xorg configuration by running the following command
+before deinstalling:
+# %%PREFIX%%/etc/rc.d/wacom onecleanup
+
+Now (re)plug in your tablet and restart X.
diff -Pur ports/x11-drivers/input-wacom.orig/files/pkg-message-usb.in ports/x11-drivers/input-wacom/files/pkg-message-usb.in
--- ports/x11-drivers/input-wacom.orig/files/pkg-message-usb.in	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/files/pkg-message-usb.in	2008-11-25 09:59:31.000000000 +0100
@@ -0,0 +1,16 @@
+To setup the wacom driver for X and start the kernel module upon boot
+run the following commands as the root user:
+
+# echo 'wacom_enable="YES"' >> /etc/rc.conf
+# %%PREFIX%%/etc/rc.d/wacom setup
+
+You can unload the driver and clean up the Xorg configuration by
+running the following lines before deinstalling:
+# %%PREFIX%%/etc/rc.d/wacom cleanup
+# %%PREFIX%%/etc/rc.d/wacom stop
+
+To activate the driver without rebooting run:
+
+# %%PREFIX%%/etc/rc.d/wacom start
+
+Now (re)plug in your tablet and restart X.
Only in ports/x11-drivers/input-wacom.orig/files: pkg-message.in
diff -Pur ports/x11-drivers/input-wacom.orig/files/wacom.in ports/x11-drivers/input-wacom/files/wacom.in
--- ports/x11-drivers/input-wacom.orig/files/wacom.in	2008-11-18 15:07:44.000000000 +0100
+++ ports/x11-drivers/input-wacom/files/wacom.in	2008-11-25 09:59:31.000000000 +0100
@@ -92,6 +92,34 @@
 }
 
 #
+# Returns the line numbers of lines matching the extended regular
+# expression $2 in the file $1.
+#
+# @param $1
+#	The file to get the line numbers from.
+# @param $2
+#	An extend regular expression.
+# @stdout
+#	The line numbers of lines matching $2.
+#
+get_all() {
+	local entry result IFS
+	IFS='
+'
+
+	result="$(/usr/bin/grep -Ein "$2" "$1")"
+
+	# No match.
+	if [ -z "$result" ]; then
+		return 1
+	fi
+
+	for entry in $result; {
+		echo "${entry%%:*}"
+	}
+}
+
+#
 # Returns the line number of the line before line number $2 that matches the
 # extended regular expression $3 in the file $1.
 #
@@ -171,44 +199,50 @@
 
 #
 # Inserts a line at the end of a section of an Xorg configuration file.
-# Only works on the first matching section.
+# The insertion is done on all matching sections!
 #
 section_insert_line() {
-	local file section insert begin end length
+	local file section insert sections begin end length
 	file="$1"
 	section="$2"
 	insert="$3"
 
 	# Find the beginning of the section.
-	begin="$(get_first "$file" \
+	# Start with the last section to avoid moving sections around
+	# before something is inserted into them.
+	sections="$(get_all "$file" \
 		"^[[:space:]]*Section[[:space:]]+\"$section\"" \
+		| /usr/bin/sort -nr
 	)"
 
-	if [ -z "$begin" ]; then
+	if [ -z "$sections" ]; then
 		echo "Identifying section $section has failed." 1>&2
 		return 1
 	fi
 
-	# Find the end of the section.
-	end="$(get_behind "$file" "$begin" "^[[:space:]]*EndSection")"
+	for begin in $sections; {
 
-	if [ -z "$end" ]; then
-		echo "The section $section is not closed." 1>&2
-		return 2
-	fi
+		# Find the end of the section.
+		end="$(get_behind "$file" "$begin" "^[[:space:]]*EndSection")"
 
-	# Determine the length of the configuration file.
-	length="$(/usr/bin/wc -l "$file")"
-	length=${length% *}
+		if [ -z "$end" ]; then
+			echo "The section $section($begin) is not closed." 1>&2
+			return 2
+		fi
 
-	# Insert the line.
-	/bin/cp "$file" "$file.$$"
+		# Determine the length of the configuration file.
+		length="$(/usr/bin/wc -l "$file")"
+		length=${length% *}
+
+		# Insert the line.
+		/bin/cp "$file" "$file.$$"
 
-	/usr/bin/head -n$(($end - 1)) "$file.$$" > "$file"
-	echo "$insert" >> "$file"
-	/usr/bin/tail -n$(($length - $end + 1)) "$file.$$" >> "$file"
+		/usr/bin/head -n$(($end - 1)) "$file.$$" > "$file"
+		echo "$insert" >> "$file"
+		/usr/bin/tail -n$(($length - $end + 1)) "$file.$$" >> "$file"
 	
-	/bin/rm "$file.$$"
+		/bin/rm "$file.$$"
+	}
 }
 
 #
@@ -225,7 +259,7 @@
 	echo "Setting up configuration in $config."
 
 	# Add all the necessary sections.
-	for ident in stylus eraser cursor pad touch; {
+	for ident in $(eval "echo \${${name}_types}"); {
 		if /usr/bin/grep -Eqi "^[[:space:]]*Identifier[[:space:]]+\"$ident\"" "$config"; then
 			echo "Skipping $ident, because it already exists in $config."
 			continue
@@ -236,10 +270,17 @@
 		echo "Section \"InputDevice\"
 	Driver		\"wacom\"
 	Identifier	\"$ident\"
-	Option		\"Device\"	\"/dev/event0\"
-	Option		\"Type\"	\"$ident\"
-	Option		\"USB\"		\"on\"
-EndSection
+	Option		\"Type\"	\"$ident\"" >> "$config"
+
+	if [ "$(eval "echo \${${name}_porttype}")" = "usb" ]; then
+		echo "	Option		\"Device\"	\"/dev/event0\"
+	Option		\"USB\"		\"on\"" >> "$config"
+	else
+		echo "	Option		\"Device\"	\"/dev/ttyd0\"
+	Option		\"ForceDevice\"	\"ISDV4\"" >> "$config"
+	fi
+
+	echo "EndSection
 " >> "$config"
 
 		section_insert_line "$config" "ServerLayout" "	InputDevice	\"$ident\"	\"SendCoreEvents\""
@@ -318,13 +359,14 @@
 
 	echo "Cleaning up ServerLayout section."
 
-	for ident in stylus eraser cursor pad touch; {
+	for ident in $(eval "echo \${${name}_types}"); {
+		while true; do
 		driver="$(get_first "$config" \
 			"[[:space:]]*InputDevice[[:space:]]+\"$ident\"" \
 		)"
 
 		# There is no line matching this driver.
-		test -z "$driver" && continue
+		test -z "$driver" && break 
 
 		# Determine the length of the configuration file.
 		length="$(/usr/bin/wc -l "$config")"
@@ -337,6 +379,7 @@
 		/usr/bin/tail -n$(($length - $driver)) "$config.$$" >> "$config"
 	
 		/bin/rm "$config.$$"
+		done
 	}
 }
 
@@ -360,6 +403,8 @@
 
 load_rc_config $name
 
-: ${wacom_enable="NO"}
+eval ": \${${name}_enable=\"NO\"}"
+eval ": \${${name}_types=\"stylus eraser cursor pad touch\"}"
+eval ": \${${name}_porttype=\"%%PORTTYPE%%\"}"
 
 run_rc_command "$1"
diff -Pur ports/x11-drivers/input-wacom.orig/input-wacom/Makefile ports/x11-drivers/input-wacom/input-wacom/Makefile
--- ports/x11-drivers/input-wacom.orig/input-wacom/Makefile	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/input-wacom/Makefile	2008-11-25 12:30:32.000000000 +0100
@@ -0,0 +1,111 @@
+# New ports collection makefile for:	input-wacom
+# Date Created:				24 Oct 2008
+# Whom:					Dominic Fandrey <kamikaze@bsdforen.de>
+#
+# $FreeBSD: ports/x11-drivers/input-wacom/Makefile,v 1.2 2008/11/21 02:12:05 pgj Exp $
+#
+
+PORTNAME=	input-wacom
+PORTVERSION=	${WACOM_VERSION:C/-/./g}.${KLD_VERSION}
+CATEGORIES=	x11-drivers kld
+MASTER_SITES=	http://www.chillt.de/bsdwacom/ \
+		${MASTER_SITE_SOURCEFORGE}
+MASTER_SITE_SUBDIR=	linuxwacom
+DISTFILES=	${BSDWACOM}.tbz \
+		${LINUXWACOM}.tar.bz2
+EXTRACT_ONLY=	${BSDWACOM}.tbz
+
+MAINTAINER=	kamikaze@bsdforen.de
+COMMENT=	X.Org Wacom tablet driver and kernel module
+
+MAN4=		wacom.4x
+MANCOMPRESSED=	yes
+
+USE_GMAKE=	yes
+USE_RC_SUBR=	wacom
+
+KMODDIR?=	/boot/modules
+XINPUTMODDIR=	lib/xorg/modules/input
+MAN4DIR=	man/man4
+WRKSRC=		${WRKDIR}
+
+PLIST_SUB+=	KMODDIR=${KMODDIR} \
+		XINPUTMODDIR=${XINPUTMODDIR} \
+		PORTTYPE=${PORTTYPE}
+SUB_LIST:=	${PLIST_SUB}
+SUB_FILES+=	pkg-message-${PORTTYPE}
+PKGMESSAGE=	${WRKDIR}/pkg-message-${PORTTYPE}
+
+XORG_CAT=	driver
+USE_XORG=	xi
+
+LINUXWACOM=	linuxwacom-${WACOM_VERSION}
+BSDWACOM=	bsdwacom-${KLD_VERSION}
+WACOM_VERSION=	0.8.1-3
+KLD_VERSION=	38
+
+OPTIONS=	UWACOMKLD "Install USB kernel module" On
+
+.include <bsd.port.pre.mk>
+
+.if defined(WITH_UWACOMKLD)
+PLIST_SUB+=	UWACOMKLD="uwacom.ko"
+PORTTYPE=	usb
+.else
+PLIST_SUB+=	UWACOMKLD="@noinst UWACOMKLD uwacom.ko"
+PORTTYPE=	serial
+.endif
+
+do-configure:
+	@cd ${WRKDIR}/linuxwacom \
+		&& ${LN} -s ${DISTDIR}/${DIST_SUBDIR}/${LINUXWACOM}.tar.bz2 \
+		&& ${SETENV} ${MAKE_ENV} ./run_configure
+
+do-build:
+.if defined(WITH_UWACOMKLD)
+	@cd ${WRKDIR}/uwacom \
+		&& ${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_ARGS}
+.endif
+	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM} \
+		&& ${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_ARGS}
+
+do-install:
+.if defined(WITH_UWACOMKLD)
+	@${MKDIR} ${KMODDIR}
+	@${INSTALL_KLD} ${WRKDIR}/uwacom/uwacom.ko ${KMODDIR}/
+.endif
+	@${MKDIR} ${PREFIX}/${XINPUTMODDIR} ${PREFIX}/${MAN4DIR}
+	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util/ \
+		&& ${SETENV} ${MAKE_ENV} ${GMAKE} install
+	@${INSTALL} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/xdrv/wacom_drv.so \
+		${PREFIX}/${XINPUTMODDIR}/
+	@${INSTALL_MAN} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/wacom.4x.gz \
+		${PREFIX}/${MAN4DIR}/
+
+plist: clean configure
+	@${ECHO} "===>  Rebuilding PLIST."
+	@${TOUCH} ${PLIST}
+	@${RM} ${PLIST}
+	@cd ${WRKDIR}/linuxwacom \
+		&& ${SETENV} ${MAKE_ENV} PREFIX=${WRKDIR}/plist ./run_configure
+	@${MKDIR} ${WRKDIR}/plist
+	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util \
+		&& ${SETENV} ${MAKE_ENV} ${GMAKE} install
+	@cd ${WRKDIR}/linuxwacom \
+		&& ${SETENV} ${MAKE_ENV} ./run_configure
+	@${FIND} ${WRKDIR}/plist/ -not -type d \
+		| ${SED} "s|${WRKDIR}/plist/||1" \
+		>> ${PLIST}
+	@${FIND} -d ${WRKDIR}/plist/ -mindepth 2 -type d \
+		| ${SED} "s|${WRKDIR}/plist/|@dirrm |1" \
+		>> ${PLIST}
+	@${ECHO} "%%XINPUTMODDIR%%/wacom_drv.so" >> ${PLIST}
+	@${ECHO} "@dirrmtry %%XINPUTMODDIR%%" >> ${PLIST}
+	@${ECHO} "@cwd %%KMODDIR%%" >> ${PLIST}
+	@${ECHO} "%%UWACOMKLD%%" >> ${PLIST}
+
+post-install:
+	@${ECHO} "===>  Displaying pkg-message."
+	@${CAT} ${PKGMESSAGE}
+
+.include <bsd.port.post.mk>
diff -Pur ports/x11-drivers/input-wacom.orig/input-wacom/distinfo ports/x11-drivers/input-wacom/input-wacom/distinfo
--- ports/x11-drivers/input-wacom.orig/input-wacom/distinfo	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/input-wacom/distinfo	2008-11-25 12:30:32.000000000 +0100
@@ -0,0 +1,6 @@
+MD5 (xorg/driver/bsdwacom-38.tbz) = fae10723e12b5bfc5daea411639f0ed4
+SHA256 (xorg/driver/bsdwacom-38.tbz) = 0d9027b5d781cd520ebe41287b388973465e8d62109c5d3f52d68f12ede03507
+SIZE (xorg/driver/bsdwacom-38.tbz) = 19993
+MD5 (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = d09b212946e321cc503adf84e243ca99
+SHA256 (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = cf1ac159d87666d16e2e3bfad81ede93e088b3bf64bb6d2d469adceb2a4c9dee
+SIZE (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = 1209228
diff -Pur ports/x11-drivers/input-wacom.orig/input-wacom/files/patch-linuxwacom-run_configure ports/x11-drivers/input-wacom/input-wacom/files/patch-linuxwacom-run_configure
--- ports/x11-drivers/input-wacom.orig/input-wacom/files/patch-linuxwacom-run_configure	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/input-wacom/files/patch-linuxwacom-run_configure	2008-11-25 12:30:32.000000000 +0100
@@ -0,0 +1,8 @@
+--- linuxwacom/run_configure.orig	2008-11-18 22:53:45.000000000 +0100
++++ linuxwacom/run_configure	2008-11-18 22:56:25.000000000 +0100
+@@ -13,4 +13,4 @@
+ cp files/input.h linuxwacom-0.8.1-3/src/xdrv/linux
+ cd linuxwacom-0.8.1-3
+ patch < ../files/patch_configure
+-./configure --with-linux=yes --with-tcl=/usr/local/include/tcl8.4 --with-tk=/usr/local/include/tk8.4 CFLAGS="-I/usr/local/include"
++./configure --with-linux=yes --with-tcl=/usr/local/include/tcl8.4 --with-tk=/usr/local/include/tk8.4 CFLAGS="-I/usr/local/include" --prefix=${PREFIX} --enable-dlloader
diff -Pur ports/x11-drivers/input-wacom.orig/input-wacom/files/pkg-message-serial.in ports/x11-drivers/input-wacom/input-wacom/files/pkg-message-serial.in
--- ports/x11-drivers/input-wacom.orig/input-wacom/files/pkg-message-serial.in	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/input-wacom/files/pkg-message-serial.in	2008-11-25 12:30:32.000000000 +0100
@@ -0,0 +1,12 @@
+To setup the wacom driver for X run the following commands as the root user:
+# %%PREFIX%%/etc/rc.d/wacom onesetup
+
+Now open your xorg.conf file and check weather the correct serial device
+was chosen. If you are using a USB to serial converter you might have
+to change it to cuaUX.
+
+You can clean up the Xorg configuration by running the following command
+before deinstalling:
+# %%PREFIX%%/etc/rc.d/wacom onecleanup
+
+Now (re)plug in your tablet and restart X.
diff -Pur ports/x11-drivers/input-wacom.orig/input-wacom/files/pkg-message-usb.in ports/x11-drivers/input-wacom/input-wacom/files/pkg-message-usb.in
--- ports/x11-drivers/input-wacom.orig/input-wacom/files/pkg-message-usb.in	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/input-wacom/files/pkg-message-usb.in	2008-11-25 12:30:32.000000000 +0100
@@ -0,0 +1,16 @@
+To setup the wacom driver for X and start the kernel module upon boot
+run the following commands as the root user:
+
+# echo 'wacom_enable="YES"' >> /etc/rc.conf
+# %%PREFIX%%/etc/rc.d/wacom setup
+
+You can unload the driver and clean up the Xorg configuration by
+running the following lines before deinstalling:
+# %%PREFIX%%/etc/rc.d/wacom cleanup
+# %%PREFIX%%/etc/rc.d/wacom stop
+
+To activate the driver without rebooting run:
+
+# %%PREFIX%%/etc/rc.d/wacom start
+
+Now (re)plug in your tablet and restart X.
diff -Pur ports/x11-drivers/input-wacom.orig/input-wacom/files/wacom.in ports/x11-drivers/input-wacom/input-wacom/files/wacom.in
--- ports/x11-drivers/input-wacom.orig/input-wacom/files/wacom.in	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/input-wacom/files/wacom.in	2008-11-25 12:30:32.000000000 +0100
@@ -0,0 +1,410 @@
+#!/bin/sh 
+
+# PROVIDE: wacom
+# REQUIRE: FILESYSTEMS
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# wacom_enable (bool):   Set to NO by default.
+#               Set it to YES to enable wacom.
+#
+# This script additionally offers setup and cleanup to configure Xorg
+# for use of the driver or remove the configuration settings.
+# The input devices are only added to the first ServerLayout section
+# and also only removed once.
+#
+
+. %%RC_SUBR%%
+
+name="wacom"
+rcvar=${name}_enable
+
+extra_commands="setup cleanup"
+setup_cmd=do_setup
+start_cmd=do_start
+stop_cmd=do_stop
+cleanup_cmd=do_cleanup
+
+#
+# Outputs the location of the Xorg configuration file.
+# Returns 1 if no file could be found.
+#
+get_xorg_conf() {
+	local config_locations config
+
+	# Possible Xorg configuration file locations, taken from the
+	# xorg.conf(5) manual page.
+	config_locations="
+/etc/X11/$XORGCONFIG
+%%PREFIX%%/etc/X11/$XORGCONFIG
+/etc/X11/xorg.conf-4
+/etc/X11/xorg.conf
+/etc/xorg.conf
+%%PREFIX%%/etc/X11/xorg.conf.$HOST
+%%PREFIX%%/etc/X11/xorg.conf-4
+%%PREFIX%%/etc/X11/xorg.conf
+%%PREFIX%%/lib/X11/xorg.conf.$HOST
+%%PREFIX%%/lib/X11/xorg.conf-4
+%%PREFIX%%/lib/X11/xorg.conf
+NONE
+"
+
+	# Find the first matching config file.
+	for config in $config_locations; {
+		test -f "$config" && break
+	}
+
+	if [ "$config" = "NONE" ]; then
+		echo "No Xorg configuration has been found." 1>&2
+		return 1
+	fi
+
+	echo "$config"
+	return 0
+}
+
+#
+# Returns the line number of the first line matching the extended regular
+# expression $2 in the file $1.
+#
+# @param $1
+#	The file to get the line number from.
+# @param $2
+#	An extend regular expression.
+# @stdout
+#	The line number of the first line matching $2.
+#
+get_first() {
+	local result IFS
+	IFS='
+'
+	result="$(/usr/bin/grep -Ein "$2" "$1")"
+	result="${result%%:*}"
+
+	# No match.
+	if [ -z "$result" ]; then
+		return 1
+	fi
+
+	echo "$result"
+	return 0
+}
+
+#
+# Returns the line numbers of lines matching the extended regular
+# expression $2 in the file $1.
+#
+# @param $1
+#	The file to get the line numbers from.
+# @param $2
+#	An extend regular expression.
+# @stdout
+#	The line numbers of lines matching $2.
+#
+get_all() {
+	local entry result IFS
+	IFS='
+'
+
+	result="$(/usr/bin/grep -Ein "$2" "$1")"
+
+	# No match.
+	if [ -z "$result" ]; then
+		return 1
+	fi
+
+	for entry in $result; {
+		echo "${entry%%:*}"
+	}
+}
+
+#
+# Returns the line number of the line before line number $2 that matches the
+# extended regular expression $3 in the file $1.
+#
+# @param $1
+#	The file to get the line number from.
+# @param $2
+#	The line before which the expression should match.
+# @param $3
+#	An extend regular expression.
+# @stdout
+#	The line number of the first line before line $2 matching $3.
+#
+get_before() {
+	local result IFS line length
+	IFS='
+'
+
+	# The length is necessary to make sure the check is run once
+	# again for the last match.
+	length="$(/usr/bin/wc -l "$1")"
+	length=${length% *}
+
+	result=-1
+	for line in $(/usr/bin/grep -Ein "$3" "$1") $(($length + 1)); {
+		line="${line%%:*}"
+
+		# We have passed the line to look for.
+		if [ $line -ge $2 ]; then
+
+			# No match before this line.
+			if [ $result -lt 0 ]; then
+				return 1
+			fi
+
+			echo "$result"
+			return 0
+		fi
+
+		result=$line
+	}
+
+	# No result.
+	return 1
+}
+
+#
+# Returns the line number of the line behind line number $2 that matches the
+# extended regular expression $3 in the file $1.
+#
+# @param $1
+#	The file to get the line number from.
+# @param $2
+#	The line behind which the expression should match.
+# @param $3
+#	An extend regular expression.
+# @stdout
+#	The line number of the first line behind line $2 matching $3.
+#
+get_behind() {
+	local IFS line
+	IFS='
+'
+
+	for line in $(/usr/bin/grep -Ein "$3" "$1"); {
+		line="${line%%:*}"
+
+		# We have passed the line to look for.
+		if [ $line -gt $2 ]; then
+			echo "$line"
+			return 0
+		fi
+	}
+
+	# No result.
+	return 1
+}
+
+#
+# Inserts a line at the end of a section of an Xorg configuration file.
+# The insertion is done on all matching sections!
+#
+section_insert_line() {
+	local file section insert sections begin end length
+	file="$1"
+	section="$2"
+	insert="$3"
+
+	# Find the beginning of the section.
+	# Start with the last section to avoid moving sections around
+	# before something is inserted into them.
+	sections="$(get_all "$file" \
+		"^[[:space:]]*Section[[:space:]]+\"$section\"" \
+		| /usr/bin/sort -nr
+	)"
+
+	if [ -z "$sections" ]; then
+		echo "Identifying section $section has failed." 1>&2
+		return 1
+	fi
+
+	for begin in $sections; {
+
+		# Find the end of the section.
+		end="$(get_behind "$file" "$begin" "^[[:space:]]*EndSection")"
+
+		if [ -z "$end" ]; then
+			echo "The section $section($begin) is not closed." 1>&2
+			return 2
+		fi
+
+		# Determine the length of the configuration file.
+		length="$(/usr/bin/wc -l "$file")"
+		length=${length% *}
+
+		# Insert the line.
+		/bin/cp "$file" "$file.$$"
+
+		/usr/bin/head -n$(($end - 1)) "$file.$$" > "$file"
+		echo "$insert" >> "$file"
+		/usr/bin/tail -n$(($length - $end + 1)) "$file.$$" >> "$file"
+	
+		/bin/rm "$file.$$"
+	}
+}
+
+#
+# Adds the necessary lines to the Xorg configuration.
+#
+do_setup() {
+	local config ident status
+
+	# Get the Xorg configuration file.
+	config="$(get_xorg_conf)"
+	status=$?
+	test $status -ne 0 && return $status
+
+	echo "Setting up configuration in $config."
+
+	# Add all the necessary sections.
+	for ident in $(eval "echo \${${name}_types}"); {
+		if /usr/bin/grep -Eqi "^[[:space:]]*Identifier[[:space:]]+\"$ident\"" "$config"; then
+			echo "Skipping $ident, because it already exists in $config."
+			continue
+		fi
+
+		echo "Inserting $ident."
+
+		echo "Section \"InputDevice\"
+	Driver		\"wacom\"
+	Identifier	\"$ident\"
+	Option		\"Type\"	\"$ident\"" >> "$config"
+
+	if [ "$(eval "echo \${${name}_porttype}")" = "usb" ]; then
+		echo "	Option		\"Device\"	\"/dev/event0\"
+	Option		\"USB\"		\"on\"" >> "$config"
+	else
+		echo "	Option		\"Device\"	\"/dev/ttyd0\"
+	Option		\"ForceDevice\"	\"ISDV4\"" >> "$config"
+	fi
+
+	echo "EndSection
+" >> "$config"
+
+		section_insert_line "$config" "ServerLayout" "	InputDevice	\"$ident\"	\"SendCoreEvents\""
+	}
+
+}
+
+#
+# Removes all wacom stuff from the Xorg configuration file. Beware,
+# this also affects handwritten content.
+#
+do_cleanup() {
+	local config status driver i begin last_begin end length ident IFS
+
+	# Get the Xorg configuration file.
+	config="$(get_xorg_conf)"
+	status=$?
+	test $status -ne 0 && return $status
+
+	echo "Removing wacom entries from $config."
+
+	IFS='
+'
+	while true; do
+		# Find a wacom section.
+		driver="$(get_first "$config" \
+			"^[[:space:]]*Driver[[:space:]]+\"wacom\"" \
+		)"
+
+		# Not a numeric, no more wacom sections left.
+		test -z "$driver" && break
+
+		# Find the beginning of the section.
+		begin="$(get_before "$config" "$driver" \
+			"^[[:space:]]*Section[[:space:]]+\"InputDevice\"" \
+		)"
+
+		if [ -z "$begin" ]; then
+			echo "Beginning of wacom driver section" \
+				"could not be found!" 1>&2
+			return 1
+		fi
+
+		# Find the end of the section.
+		end="$(get_behind "$config" "$driver" \
+			"^[[:space:]]*EndSection" \
+		)"
+
+		if [ -z "$end" ]; then
+			echo "The Wacom driver section is" \
+				"not closed properly." 1>&2
+			return 2
+		fi
+
+		# Determine the length of the configuration file.
+		length="$(/usr/bin/wc -l "$config")"
+		length=${length% *}
+
+		# Adjust the end by trailing newlines.
+		while [ $end -lt $length -a \
+			-z "$(/usr/bin/tail -n$(($length - $end)) "$config" \
+			| /usr/bin/head -n1)" ]; do
+			end=$(($end + 1))
+		done
+
+		# Remove the section.
+		/bin/cp "$config" "$config.$$"
+
+		/usr/bin/head -n$(($begin - 1)) "$config.$$" > "$config"
+		/usr/bin/tail -n$(($length - $end)) "$config.$$" >> "$config"
+	
+		/bin/rm "$config.$$"
+	done
+	IFS='	 
+'
+
+	echo "Cleaning up ServerLayout section."
+
+	for ident in $(eval "echo \${${name}_types}"); {
+		while true; do
+		driver="$(get_first "$config" \
+			"[[:space:]]*InputDevice[[:space:]]+\"$ident\"" \
+		)"
+
+		# There is no line matching this driver.
+		test -z "$driver" && break 
+
+		# Determine the length of the configuration file.
+		length="$(/usr/bin/wc -l "$config")"
+		length=${length% *}
+
+		# Remove the section.
+		/bin/cp "$config" "$config.$$"
+
+		/usr/bin/head -n$(($driver - 1)) "$config.$$" > "$config"
+		/usr/bin/tail -n$(($length - $driver)) "$config.$$" >> "$config"
+	
+		/bin/rm "$config.$$"
+		done
+	}
+}
+
+do_start() {
+	if /sbin/kldstat | /usr/bin/grep -q uwacom; then
+		echo "${name} is already running."
+		return 0
+	fi
+	echo "Starting ${name}."
+	/sbin/kldload %%KMODDIR%%/uwacom.ko
+}
+
+do_stop() {
+	if ! /sbin/kldstat | /usr/bin/grep -q uwacom; then
+		echo "${name} is not running."
+		return 0
+	fi
+	echo "Stopping ${name}."
+	/sbin/kldunload %%KMODDIR%%/uwacom.ko
+}
+
+load_rc_config $name
+
+eval ": \${${name}_enable=\"NO\"}"
+eval ": \${${name}_types=\"stylus eraser cursor pad touch\"}"
+eval ": \${${name}_porttype=\"%%PORTTYPE%%\"}"
+
+run_rc_command "$1"
diff -Pur ports/x11-drivers/input-wacom.orig/input-wacom/pkg-descr ports/x11-drivers/input-wacom/input-wacom/pkg-descr
--- ports/x11-drivers/input-wacom.orig/input-wacom/pkg-descr	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/input-wacom/pkg-descr	2008-11-25 12:30:32.000000000 +0100
@@ -0,0 +1,17 @@
+This package contains the X.Org linuxwacom driver, a USB Wacom kernel module
+and a script to configure Xorg.
+
+The kernel module is provided by Bartosz Fabianowski <freebsd@chillt.de> and
+supports the following devices:
+	Graphire*, Graphire2*, Graphire3, Graphire4
+	Bamboo, Bamboo One*, Bamboo Fun
+	Intuos3, Cintiq 21UX
+	Volito*, Volito2*
+	PenStation2*, PenPartner2*
+
+* not tested
+
+WWW: http://linuxwacom.sourceforge.net/
+
+- Kamikaze
+kamikaze@bsdforen.de
diff -Pur ports/x11-drivers/input-wacom.orig/input-wacom/pkg-plist ports/x11-drivers/input-wacom/input-wacom/pkg-plist
--- ports/x11-drivers/input-wacom.orig/input-wacom/pkg-plist	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/input-wacom/pkg-plist	2008-11-25 12:30:32.000000000 +0100
@@ -0,0 +1,13 @@
+lib/libwacomcfg.so.0
+lib/libwacomcfg.so
+lib/libwacomcfg.la
+lib/libwacomcfg.a
+bin/wacdump
+bin/xidump
+bin/xsetwacom
+include/wacomcfg/wacomcfg.h
+@dirrm include/wacomcfg
+%%XINPUTMODDIR%%/wacom_drv.so
+@dirrmtry %%XINPUTMODDIR%%
+@cwd %%KMODDIR%%
+%%UWACOMKLD%%
Comment 5 kamikaze 2009-01-16 05:48:03 UTC
I should double check my patches.
The whole thing is ridiculous. Here's the correct one:

diff -Pur ports/x11-drivers/input-wacom.orig/Makefile ports/x11-drivers/input-wacom/Makefile
--- ports/x11-drivers/input-wacom.orig/Makefile	2008-11-21 03:12:05.000000000 +0100
+++ ports/x11-drivers/input-wacom/Makefile	2008-12-26 12:09:02.000000000 +0100
@@ -30,18 +30,19 @@
 WRKSRC=		${WRKDIR}
 
 PLIST_SUB+=	KMODDIR=${KMODDIR} \
-		XINPUTMODDIR=${XINPUTMODDIR}
+		XINPUTMODDIR=${XINPUTMODDIR} \
+		PORTTYPE=${PORTTYPE}
 SUB_LIST:=	${PLIST_SUB}
-SUB_FILES+=	pkg-message
-PKGMESSAGE=	${WRKDIR}/pkg-message
+SUB_FILES+=	pkg-message-${PORTTYPE}
+PKGMESSAGE=	${WRKDIR}/pkg-message-${PORTTYPE}
 
 XORG_CAT=	driver
 USE_XORG=	xi
 
 LINUXWACOM=	linuxwacom-${WACOM_VERSION}
 BSDWACOM=	bsdwacom-${KLD_VERSION}
-WACOM_VERSION=	0.8.1-3
-KLD_VERSION=	38
+WACOM_VERSION=	0.8.2
+KLD_VERSION=	40
 
 OPTIONS=	UWACOMKLD "Install USB kernel module" On
 
@@ -49,14 +50,16 @@
 
 .if defined(WITH_UWACOMKLD)
 PLIST_SUB+=	UWACOMKLD="uwacom.ko"
+PORTTYPE=	usb
 .else
 PLIST_SUB+=	UWACOMKLD="@noinst UWACOMKLD uwacom.ko"
+PORTTYPE=	serial
 .endif
 
 do-configure:
 	@cd ${WRKDIR}/linuxwacom \
 		&& ${LN} -s ${DISTDIR}/${DIST_SUBDIR}/${LINUXWACOM}.tar.bz2 \
-		&& ${SETENV} PREFIX=${PREFIX} ./run_configure
+		&& ${SETENV} ${MAKE_ENV} ./run_configure
 
 do-build:
 .if defined(WITH_UWACOMKLD)
@@ -73,7 +76,7 @@
 .endif
 	@${MKDIR} ${PREFIX}/${XINPUTMODDIR} ${PREFIX}/${MAN4DIR}
 	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util/ \
-		&& ${GMAKE} install
+		&& ${SETENV} ${MAKE_ENV} ${GMAKE} install
 	@${INSTALL} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/xdrv/wacom_drv.so \
 		${PREFIX}/${XINPUTMODDIR}/
 	@${INSTALL_MAN} ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/wacom.4x.gz \
@@ -84,11 +87,12 @@
 	@${TOUCH} ${PLIST}
 	@${RM} ${PLIST}
 	@cd ${WRKDIR}/linuxwacom \
-		&& ${SETENV} PREFIX=${WRKDIR}/plist ./run_configure
+		&& ${SETENV} ${MAKE_ENV} PREFIX=${WRKDIR}/plist ./run_configure
 	@${MKDIR} ${WRKDIR}/plist
-	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util && ${GMAKE} install
+	@cd ${WRKDIR}/linuxwacom/${LINUXWACOM}/src/util \
+		&& ${SETENV} ${MAKE_ENV} ${GMAKE} install
 	@cd ${WRKDIR}/linuxwacom \
-		&& ${SETENV} PREFIX=${PREFIX} ./run_configure
+		&& ${SETENV} ${MAKE_ENV} ./run_configure
 	@${FIND} ${WRKDIR}/plist/ -not -type d \
 		| ${SED} "s|${WRKDIR}/plist/||1" \
 		>> ${PLIST}
diff -Pur ports/x11-drivers/input-wacom.orig/distinfo ports/x11-drivers/input-wacom/distinfo
--- ports/x11-drivers/input-wacom.orig/distinfo	2008-11-18 15:07:40.000000000 +0100
+++ ports/x11-drivers/input-wacom/distinfo	2009-01-04 20:05:34.000000000 +0100
@@ -1,6 +1,6 @@
-MD5 (xorg/driver/bsdwacom-38.tbz) = fae10723e12b5bfc5daea411639f0ed4
-SHA256 (xorg/driver/bsdwacom-38.tbz) = 0d9027b5d781cd520ebe41287b388973465e8d62109c5d3f52d68f12ede03507
-SIZE (xorg/driver/bsdwacom-38.tbz) = 19993
-MD5 (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = d09b212946e321cc503adf84e243ca99
-SHA256 (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = cf1ac159d87666d16e2e3bfad81ede93e088b3bf64bb6d2d469adceb2a4c9dee
-SIZE (xorg/driver/linuxwacom-0.8.1-3.tar.bz2) = 1209228
+MD5 (xorg/driver/bsdwacom-40.tbz) = 022a5225cca8bbf3af1014d32d5c12de
+SHA256 (xorg/driver/bsdwacom-40.tbz) = 42c37d321768ff29fef10eb088a87a83c94753a1b4ae5f92fd453781039a5df9
+SIZE (xorg/driver/bsdwacom-40.tbz) = 19305
+MD5 (xorg/driver/linuxwacom-0.8.2.tar.bz2) = cb0647197556c3ab9079b37966a5adc1
+SHA256 (xorg/driver/linuxwacom-0.8.2.tar.bz2) = 5f3096d7194940ca583be8b63b59bb75001d01f1a4a75c1807c8f01cf697dfb5
+SIZE (xorg/driver/linuxwacom-0.8.2.tar.bz2) = 1092825
Only in ports/x11-drivers/input-wacom.orig/files: patch-linuxwacom-run_configure
diff -Pur ports/x11-drivers/input-wacom.orig/files/pkg-message-serial.in ports/x11-drivers/input-wacom/files/pkg-message-serial.in
--- ports/x11-drivers/input-wacom.orig/files/pkg-message-serial.in	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/files/pkg-message-serial.in	2008-11-25 09:59:31.000000000 +0100
@@ -0,0 +1,12 @@
+To setup the wacom driver for X run the following commands as the root user:
+# %%PREFIX%%/etc/rc.d/wacom onesetup
+
+Now open your xorg.conf file and check weather the correct serial device
+was chosen. If you are using a USB to serial converter you might have
+to change it to cuaUX.
+
+You can clean up the Xorg configuration by running the following command
+before deinstalling:
+# %%PREFIX%%/etc/rc.d/wacom onecleanup
+
+Now (re)plug in your tablet and restart X.
diff -Pur ports/x11-drivers/input-wacom.orig/files/pkg-message-usb.in ports/x11-drivers/input-wacom/files/pkg-message-usb.in
--- ports/x11-drivers/input-wacom.orig/files/pkg-message-usb.in	1970-01-01 01:00:00.000000000 +0100
+++ ports/x11-drivers/input-wacom/files/pkg-message-usb.in	2008-11-25 09:59:31.000000000 +0100
@@ -0,0 +1,16 @@
+To setup the wacom driver for X and start the kernel module upon boot
+run the following commands as the root user:
+
+# echo 'wacom_enable="YES"' >> /etc/rc.conf
+# %%PREFIX%%/etc/rc.d/wacom setup
+
+You can unload the driver and clean up the Xorg configuration by
+running the following lines before deinstalling:
+# %%PREFIX%%/etc/rc.d/wacom cleanup
+# %%PREFIX%%/etc/rc.d/wacom stop
+
+To activate the driver without rebooting run:
+
+# %%PREFIX%%/etc/rc.d/wacom start
+
+Now (re)plug in your tablet and restart X.
Only in ports/x11-drivers/input-wacom.orig/files: pkg-message.in
diff -Pur ports/x11-drivers/input-wacom.orig/files/wacom.in ports/x11-drivers/input-wacom/files/wacom.in
--- ports/x11-drivers/input-wacom.orig/files/wacom.in	2008-11-18 15:07:44.000000000 +0100
+++ ports/x11-drivers/input-wacom/files/wacom.in	2008-11-25 09:59:31.000000000 +0100
@@ -92,6 +92,34 @@
 }
 
 #
+# Returns the line numbers of lines matching the extended regular
+# expression $2 in the file $1.
+#
+# @param $1
+#	The file to get the line numbers from.
+# @param $2
+#	An extend regular expression.
+# @stdout
+#	The line numbers of lines matching $2.
+#
+get_all() {
+	local entry result IFS
+	IFS='
+'
+
+	result="$(/usr/bin/grep -Ein "$2" "$1")"
+
+	# No match.
+	if [ -z "$result" ]; then
+		return 1
+	fi
+
+	for entry in $result; {
+		echo "${entry%%:*}"
+	}
+}
+
+#
 # Returns the line number of the line before line number $2 that matches the
 # extended regular expression $3 in the file $1.
 #
@@ -171,44 +199,50 @@
 
 #
 # Inserts a line at the end of a section of an Xorg configuration file.
-# Only works on the first matching section.
+# The insertion is done on all matching sections!
 #
 section_insert_line() {
-	local file section insert begin end length
+	local file section insert sections begin end length
 	file="$1"
 	section="$2"
 	insert="$3"
 
 	# Find the beginning of the section.
-	begin="$(get_first "$file" \
+	# Start with the last section to avoid moving sections around
+	# before something is inserted into them.
+	sections="$(get_all "$file" \
 		"^[[:space:]]*Section[[:space:]]+\"$section\"" \
+		| /usr/bin/sort -nr
 	)"
 
-	if [ -z "$begin" ]; then
+	if [ -z "$sections" ]; then
 		echo "Identifying section $section has failed." 1>&2
 		return 1
 	fi
 
-	# Find the end of the section.
-	end="$(get_behind "$file" "$begin" "^[[:space:]]*EndSection")"
+	for begin in $sections; {
 
-	if [ -z "$end" ]; then
-		echo "The section $section is not closed." 1>&2
-		return 2
-	fi
+		# Find the end of the section.
+		end="$(get_behind "$file" "$begin" "^[[:space:]]*EndSection")"
 
-	# Determine the length of the configuration file.
-	length="$(/usr/bin/wc -l "$file")"
-	length=${length% *}
+		if [ -z "$end" ]; then
+			echo "The section $section($begin) is not closed." 1>&2
+			return 2
+		fi
 
-	# Insert the line.
-	/bin/cp "$file" "$file.$$"
+		# Determine the length of the configuration file.
+		length="$(/usr/bin/wc -l "$file")"
+		length=${length% *}
+
+		# Insert the line.
+		/bin/cp "$file" "$file.$$"
 
-	/usr/bin/head -n$(($end - 1)) "$file.$$" > "$file"
-	echo "$insert" >> "$file"
-	/usr/bin/tail -n$(($length - $end + 1)) "$file.$$" >> "$file"
+		/usr/bin/head -n$(($end - 1)) "$file.$$" > "$file"
+		echo "$insert" >> "$file"
+		/usr/bin/tail -n$(($length - $end + 1)) "$file.$$" >> "$file"
 	
-	/bin/rm "$file.$$"
+		/bin/rm "$file.$$"
+	}
 }
 
 #
@@ -225,7 +259,7 @@
 	echo "Setting up configuration in $config."
 
 	# Add all the necessary sections.
-	for ident in stylus eraser cursor pad touch; {
+	for ident in $(eval "echo \${${name}_types}"); {
 		if /usr/bin/grep -Eqi "^[[:space:]]*Identifier[[:space:]]+\"$ident\"" "$config"; then
 			echo "Skipping $ident, because it already exists in $config."
 			continue
@@ -236,10 +270,17 @@
 		echo "Section \"InputDevice\"
 	Driver		\"wacom\"
 	Identifier	\"$ident\"
-	Option		\"Device\"	\"/dev/event0\"
-	Option		\"Type\"	\"$ident\"
-	Option		\"USB\"		\"on\"
-EndSection
+	Option		\"Type\"	\"$ident\"" >> "$config"
+
+	if [ "$(eval "echo \${${name}_porttype}")" = "usb" ]; then
+		echo "	Option		\"Device\"	\"/dev/event0\"
+	Option		\"USB\"		\"on\"" >> "$config"
+	else
+		echo "	Option		\"Device\"	\"/dev/ttyd0\"
+	Option		\"ForceDevice\"	\"ISDV4\"" >> "$config"
+	fi
+
+	echo "EndSection
 " >> "$config"
 
 		section_insert_line "$config" "ServerLayout" "	InputDevice	\"$ident\"	\"SendCoreEvents\""
@@ -318,13 +359,14 @@
 
 	echo "Cleaning up ServerLayout section."
 
-	for ident in stylus eraser cursor pad touch; {
+	for ident in $(eval "echo \${${name}_types}"); {
+		while true; do
 		driver="$(get_first "$config" \
 			"[[:space:]]*InputDevice[[:space:]]+\"$ident\"" \
 		)"
 
 		# There is no line matching this driver.
-		test -z "$driver" && continue
+		test -z "$driver" && break 
 
 		# Determine the length of the configuration file.
 		length="$(/usr/bin/wc -l "$config")"
@@ -337,6 +379,7 @@
 		/usr/bin/tail -n$(($length - $driver)) "$config.$$" >> "$config"
 	
 		/bin/rm "$config.$$"
+		done
 	}
 }
 
@@ -360,6 +403,8 @@
 
 load_rc_config $name
 
-: ${wacom_enable="NO"}
+eval ": \${${name}_enable=\"NO\"}"
+eval ": \${${name}_types=\"stylus eraser cursor pad touch\"}"
+eval ": \${${name}_porttype=\"%%PORTTYPE%%\"}"
 
 run_rc_command "$1"
Comment 6 Martin Wilke freebsd_committer 2009-01-17 22:55:37 UTC
State Changed
From-To: open->closed

Committed. Thanks!
Comment 7 dfilter service freebsd_committer 2009-01-17 22:55:37 UTC
miwi        2009-01-17 22:55:27 UTC

  FreeBSD ports repository

  Modified files:
    x11-drivers/input-wacom Makefile 
    x11-drivers/input-wacom/files wacom.in 
  Added files:
    x11-drivers/input-wacom/files pkg-message-serial.in 
                                  pkg-message-usb.in 
  Removed files:
    x11-drivers/input-wacom/files pkg-message.in 
  Log:
  - Update to 0.8.2
  
  PR:             129906
  Submitted by:   Dominic Fandrey <kamikaze@bsdforen.de> (maintainer)
  
  Revision  Changes    Path
  1.3       +12 -8     ports/x11-drivers/input-wacom/Makefile
  1.1       +12 -0     ports/x11-drivers/input-wacom/files/pkg-message-serial.in (new)
  1.1       +16 -0     ports/x11-drivers/input-wacom/files/pkg-message-usb.in (new)
  1.2       +0 -16     ports/x11-drivers/input-wacom/files/pkg-message.in (dead)
  1.2       +72 -27    ports/x11-drivers/input-wacom/files/wacom.in
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"