From owner-freebsd-ports-bugs@FreeBSD.ORG Thu Aug 8 06:10:00 2013 Return-Path: Delivered-To: freebsd-ports-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9CEA2EED for ; Thu, 8 Aug 2013 06:10:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7C614281E for ; Thu, 8 Aug 2013 06:10:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r786A0wp083381 for ; Thu, 8 Aug 2013 06:10:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r786A00x083380; Thu, 8 Aug 2013 06:10:00 GMT (envelope-from gnats) Resent-Date: Thu, 8 Aug 2013 06:10:00 GMT Resent-Message-Id: <201308080610.r786A00x083380@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Anton Afanasyev Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C4D91D8A for ; Thu, 8 Aug 2013 06:04:54 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from oldred.freebsd.org (oldred.freebsd.org [8.8.178.121]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A4BEE2802 for ; Thu, 8 Aug 2013 06:04:54 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id r7864sCo046334 for ; Thu, 8 Aug 2013 06:04:54 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id r7864sZA046329; Thu, 8 Aug 2013 06:04:54 GMT (envelope-from nobody) Message-Id: <201308080604.r7864sZA046329@oldred.freebsd.org> Date: Thu, 8 Aug 2013 06:04:54 GMT From: Anton Afanasyev To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/181133: [patch] enabled support of wacom tablets connected via a serial port X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Aug 2013 06:10:00 -0000 >Number: 181133 >Category: ports >Synopsis: [patch] enabled support of wacom tablets connected via a serial port >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Thu Aug 08 06:10:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Anton Afanasyev >Release: FreeBSD 9.2-BETA2 r253720 amd64 >Organization: >Environment: FreeBSD MACIHNENAMEHERE 9.2-BETA2 FreeBSD 9.2-BETA2 #0 r253720: Sat Jul 27 16:50:40 PDT 2013 root@worldmaker:/usr/obj/usr/src/sys/KERNNAMEHERE amd64 >Description: The current version of the port did not include support for serial (ISDV4) tablets, such as the ones built into Thinkpad x200 and the like. The original code does support them, so after removing several linuxisms they work on FreeBSd too. Additionally, the isdv4-serial-debugger application is now built and installed into the system (again, it was disabled in the current version of the port because of linuxisms). NOTE: This patch can easily be applied on top of ports/175876 once that is committed. Also note that I haven't tried updating to a newer version of xf86-input-wacom (0.22.1 at the time of writing) since there are quite a few makefile changes, and I am not well-versed in makefiles. >How-To-Repeat: Try building the current version of the port and find that X server does not detect a serial wacom table (provided you have one). Then do: $ cd ports/x11-drivers/input-wacom $ svn patch --strip 1 /path/to/input-wacom-serial.diff And then the tablet should be detected by X. >Fix: Patch attached with submission follows: Index: files/patch-src-Makefile.in =================================================================== --- files/patch-src-Makefile.in (revision 324375) +++ files/patch-src-Makefile.in (working copy) @@ -1,40 +0,0 @@ ---- src/Makefile.in.orig -+++ src/Makefile.in -@@ -97,7 +97,7 @@ am__base_list = \ - am__installdirs = "$(DESTDIR)$(@DRIVER_NAME@_drv_ladir)" - LTLIBRARIES = $(@DRIVER_NAME@_drv_la_LTLIBRARIES) - @DRIVER_NAME@_drv_la_LIBADD = --am__objects_1 = xf86Wacom.lo wcmCommon.lo wcmConfig.lo wcmISDV4.lo \ -+am__objects_1 = xf86Wacom.lo wcmCommon.lo wcmConfig.lo \ - wcmFilter.lo wcmUSB.lo wcmXCommand.lo wcmValidateDevice.lo \ - wcmTouchFilter.lo - am_@DRIVER_NAME@_drv_la_OBJECTS = $(am__objects_1) -@@ -291,7 +291,6 @@ DRIVER_SOURCES = \ - $(top_srcdir)/src/xf86Wacom.h \ - $(top_srcdir)/src/wcmCommon.c \ - $(top_srcdir)/src/wcmConfig.c \ -- $(top_srcdir)/src/wcmISDV4.c \ - $(top_srcdir)/src/wcmFilter.c \ - $(top_srcdir)/src/wcmFilter.h \ - $(top_srcdir)/src/xf86WacomDefs.h \ -@@ -383,7 +382,6 @@ distclean-compile: - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcmCommon.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcmConfig.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcmFilter.Plo@am__quote@ --@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcmISDV4.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcmTouchFilter.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcmUSB.Plo@am__quote@ - @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wcmValidateDevice.Plo@am__quote@ -@@ -467,12 +465,7 @@ wcmConfig.lo: $(top_srcdir)/src/wcmConfi - @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ - @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o wcmConfig.lo `test -f '$(top_srcdir)/src/wcmConfig.c' || echo '$(srcdir)/'`$(top_srcdir)/src/wcmConfig.c - --wcmISDV4.lo: $(top_srcdir)/src/wcmISDV4.c --@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wcmISDV4.lo -MD -MP -MF $(DEPDIR)/wcmISDV4.Tpo -c -o wcmISDV4.lo `test -f '$(top_srcdir)/src/wcmISDV4.c' || echo '$(srcdir)/'`$(top_srcdir)/src/wcmISDV4.c --@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/wcmISDV4.Tpo $(DEPDIR)/wcmISDV4.Plo --@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$(top_srcdir)/src/wcmISDV4.c' object='wcmISDV4.lo' libtool=yes @AMDEPBACKSLASH@ - @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ --@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o wcmISDV4.lo `test -f '$(top_srcdir)/src/wcmISDV4.c' || echo '$(srcdir)/'`$(top_srcdir)/src/wcmISDV4.c - - wcmFilter.lo: $(top_srcdir)/src/wcmFilter.c - @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT wcmFilter.lo -MD -MP -MF $(DEPDIR)/wcmFilter.Tpo -c -o wcmFilter.lo `test -f '$(top_srcdir)/src/wcmFilter.c' || echo '$(srcdir)/'`$(top_srcdir)/src/wcmFilter.c Index: files/patch-src-wcmConfig.c =================================================================== --- files/patch-src-wcmConfig.c (revision 324375) +++ files/patch-src-wcmConfig.c (working copy) @@ -1,16 +0,0 @@ ---- src/wcmConfig.c.orig -+++ src/wcmConfig.c -@@ -373,9 +373,12 @@ wcmDetectDeviceClass(const InputInfoPtr - return TRUE; - - /* Bluetooth is also considered as USB */ -+#if 0 - if (gWacomISDV4Device.Detect(pInfo)) - common->wcmDevCls = &gWacomISDV4Device; -- else if (gWacomUSBDevice.Detect(pInfo)) -+ else -+#endif -+ if (gWacomUSBDevice.Detect(pInfo)) - common->wcmDevCls = &gWacomUSBDevice; - else - xf86Msg(X_ERROR, "%s: cannot identify device class.\n", pInfo->name); Index: files/patch-src-wcmISDV4.c =================================================================== --- files/patch-src-wcmISDV4.c (revision 0) +++ files/patch-src-wcmISDV4.c (working copy) @@ -0,0 +1,123 @@ +--- src/wcmISDV4.c.orig 2013-08-07 16:41:16.844274271 -0700 ++++ src/wcmISDV4.c 2013-08-07 19:38:52.321272814 -0700 +@@ -24,11 +24,10 @@ + #include "xf86Wacom.h" + #include + #include "wcmFilter.h" +-#include + #include "isdv4.h" ++#include + #include + #include +-#include + + #define RESET_RELATIVE(ds) do { (ds).relwheel = 0; } while (0) + +@@ -192,11 +191,11 @@ + + static Bool isdv4Detect(InputInfoPtr pInfo) + { +- struct serial_struct ser; ++ struct termios termAttr; + int rc; + +- rc = ioctl(pInfo->fd, TIOCGSERIAL, &ser); +- if (rc == -1) ++ rc = tcgetattr( pInfo->fd, &termAttr ); ++ if( rc != 0 ) + return FALSE; + + return TRUE; +@@ -935,67 +934,6 @@ + }; + + /** +- * Query the model number from the sysfs /sys/.../device/id file and return +- * the matching model and the ID for the model we found. +- * +- * @param pInfo Used for debugging purposes only. +- * @param fd File descriptor to the serial device. +- * @param[out] id On success, returns the numeric ID for this device +- * according to the model-specific matching pattern. +- * +- * @return The model description for the matching device or NULL if no +- * matching one could be found. +- */ +-static ISDV4ModelDesc* +-model_from_sysfs(const InputInfoPtr pInfo, int fd, int *id) +-{ +- WacomDevicePtr priv = pInfo->private; +- ISDV4ModelDesc* model = NULL; +- struct udev *udev = NULL; +- struct udev_device *device = NULL; +- struct stat st; +- char *sysfs_path = NULL; +- FILE *file = NULL; +- +- fstat(fd, &st); +- +- udev = udev_new(); +- device = udev_device_new_from_devnum(udev, 'c', st.st_rdev); +- +- if (!device) +- goto out; +- +- if (asprintf(&sysfs_path, "%s/device/id", +- udev_device_get_syspath(device)) == -1) +- goto out; +- +- DBG(8, priv, "sysfs path: %s\n", sysfs_path); +- +- file = fopen(sysfs_path, "r"); +- if (!file) +- goto out; +- +- model = isdv4_models; +- +- while(model->pattern && fscanf(file, model->pattern, id) <= 0) +- model++; +- +- if (!model->pattern) +- model = NULL; +- +- DBG(8, priv, "sysfs check found %s:%d\n", +- (model) ? model->pattern : "", *id); +- +-out: +- udev_device_unref(device); +- udev_unref(udev); +- if (file) +- fclose(file); +- free(sysfs_path); +- return model; +-} +- +-/** + * Query the device's fd for the key bits and the tablet ID. Returns the ID + * on success. If the model vendor is unknown, we assume a penabled device + * (0x90). If the model vendor is known but the model itself is unknown, the +@@ -1010,22 +948,18 @@ + { + int id = 0; + int tablet_id = 0x90; +- struct serial_struct tmp; ++ struct termios tmp; + WacomDevicePtr priv = (WacomDevicePtr)pInfo->private; + WacomCommonPtr common = priv->common; + ISDV4ModelDesc *model = isdv4_models; + +- if (ioctl(pInfo->fd, TIOCGSERIAL, &tmp) < 0) ++ if( tcgetattr( pInfo->fd, &tmp ) != 0 ) + return 0; + + /* check device name for ID first */ + while (model->pattern && sscanf(pInfo->name, model->pattern, &id) < 1) + model++; + +- /* grab id from sysfs/.../device/id */ +- if (!model->pattern) +- model = model_from_sysfs(pInfo, pInfo->fd, &id); +- + memset(common->wcmKeys, 0, sizeof(common->wcmKeys)); + + /* default to penabled */ Index: files/patch-tools-Makefile.in =================================================================== --- files/patch-tools-Makefile.in (revision 324375) +++ files/patch-tools-Makefile.in (working copy) @@ -1,11 +0,0 @@ ---- tools/Makefile.in.orig -+++ tools/Makefile.in -@@ -54,6 +54,6 @@ PRE_UNINSTALL = : - POST_UNINSTALL = : - build_triplet = @build@ - host_triplet = @host@ --bin_PROGRAMS = xsetwacom$(EXEEXT) isdv4-serial-debugger$(EXEEXT) -+bin_PROGRAMS = xsetwacom$(EXEEXT) - @UNITTESTS_TRUE@check_PROGRAMS = xsetwacom-test$(EXEEXT) - subdir = tools - DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in Index: files/patch-tools-isdv4-serial-debugger.c =================================================================== --- files/patch-tools-isdv4-serial-debugger.c (revision 0) +++ files/patch-tools-isdv4-serial-debugger.c (working copy) @@ -0,0 +1,33 @@ +--- tools/isdv4-serial-debugger.c.orig 2013-08-07 16:41:16.826271564 -0700 ++++ tools/isdv4-serial-debugger.c 2013-08-07 20:39:14.513272146 -0700 +@@ -25,7 +25,6 @@ + + #include + #include +-#include + #include + #include + #include +@@ -71,7 +70,6 @@ + static int open_device(char *path) + { + int fd, rc; +- struct serial_struct ser; + struct termios t; + + TRACE("Opening device '%s'.\n", path); +@@ -80,14 +78,6 @@ + if (fd < 1) + perror("Failed to open device file."); + +- if (ioctl(fd, TIOCGSERIAL, &ser) == -1) +- { +- fprintf(stderr, "Not a serial device?"); +- close(fd); +- fd = -1; +- goto out; +- } +- + rc = tcgetattr(fd, &t); + if (rc == -1) + { Index: pkg-plist =================================================================== --- pkg-plist (revision 324375) +++ pkg-plist (working copy) @@ -1,5 +1,6 @@ bin/xsetwacom %%XINPUTMODDIR%%/wacom_drv.so +%%XINPUTMODDIR%%/isdv4-serial-debugger @dirrmtry %%XINPUTMODDIR%% @cwd %%KMODDIR%% %%UWACOMKLD%% >Release-Note: >Audit-Trail: >Unformatted: