ports/129906: [maintainer-update] x11-drivers/input-wacom port maintenance

Dominic Fandrey kamikaze at bsdforen.de
Wed Dec 24 12:40:03 UTC 2008


>Number:         129906
>Category:       ports
>Synopsis:       [maintainer-update] x11-drivers/input-wacom port maintenance
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Dec 24 12:40:02 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Dominic Fandrey
>Release:        
>Organization:
private
>Environment:
FreeBSD mobileKamikaze.norad 7.1-PRERELEASE FreeBSD 7.1-PRERELEASE #0: Fri Dec 19 12:46:43 CET 2008     root at mobileKamikaze.norad:/usr/obj/HP6510b/amd64/usr/src/sys/HP6510b  amd64

>Description:
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.
>How-To-Repeat:

>Fix:
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 11:46:46.000000000 +0100
+++ ports/x11-drivers/input-wacom/Makefile	2008-11-24 09:03:30.000000000 +0100
@@ -30,10 +30,11 @@
 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
@@ -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/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-24 09:21: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-18 15:07:44.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-21 11:46:46.000000000 +0100
+++ ports/x11-drivers/input-wacom/files/wacom.in	2008-11-24 08:57:11.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/pkg-descr ports/x11-drivers/input-wacom/pkg-descr
--- ports/x11-drivers/input-wacom.orig/pkg-descr	2008-11-21 11:46:46.000000000 +0100
+++ ports/x11-drivers/input-wacom/pkg-descr	2008-11-25 12:30:24.000000000 +0100
@@ -1,4 +1,4 @@
-This package contains the X.Org linuxwacom driver, a Wacom kernel module
+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 at chillt.de> and


>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list