The Linux Wacom Project
SourceForge.net Logo

Linux Wacom Project HOWTO

13.6 - Building wacom driver On PowerMac






The following documentation for building wacom driver on PowerMac [silver] was written by Joseph E. Sacco. If you have any problems or questions, go ahead and post them to the list, or send email to me directly. I'll forward your email on to Joseph.



Copyright (C) 2004 Joseph E. Sacco

System:

<< Hardware >>
* PowerMac [silver] with dual 533 MHz G4 [7410] CPU's, 1GB RAM,
  (3) 73 GB SCSI drives
* Contour UniMouse [USB, optical, three button]
* Wacom Intuos Tablet [USB]: GD-1218-U
        * 4-d mouse
        * pen
        * air brush

<< Software >>
* Yellow Dog Linux 3.0.1 [Redhat variant for PPC]
* kernel: 2.4.25-ben1
* linuxwacom-0.6.1

* XFree86-4.3.0-2.1e
* atk-1.6.0-1
* freetype-2.1.3-4
* gcc-3.3
* gtk+-2.4.0
* glib2-2.4.0
* ncurses-5.2-28
* pango-1.4.0

============================================================

I have a Wacom Intuos tablet "working" [after a fashion] on a PPC
running Yellow Dog Linux 3.0.1.

<< What works >>
* input devices:
    * cursor movement
    * button clicks
    * wheel rotation [as seen from wacdump]
    * pressure [as seen from wacdump & gimp]
    * tilt [as seen from wacdump]

* applications:
    * wacdump
    * xidump
    * xev
    * xinput-1.2
    * gimp-1.25 & gimp-2.0
    * dia-0.9.2

< What does *not* work >>
* input devices:
        * Mode "Relative" for pen & air brush [should it???]

* applications:
    * xsetwacom
    * wacomcpl [because of xsetwacom]

There are some issues I would like to report.
----------------------------------------------------------------------------------------------------------------------------------------

* Makefiles
The makefiles are set up for Intel architecture. Some options are not
applicable for PPC's.

[ from ./src/2.4.22/Makefile.in ]
KCFLAGS = -Wall $(DEBUG_FLAGS) -D__KERNEL__ \
                -DMODULE -DEXPORT_SYMTAB $(MODS) \
                -Wstrict-prototypes -Wno-trigraphs -O2 \
                -fno-strict-aliasing \
                -fno-common -fomit-frame-pointer -pipe \
     ===>    -mpreferred-stack-boundary=2 \         
     ===>     -march=$(ARCHITECTURE)

The last two options are not applicable to a PPC.

A more appropriate set of flags, taken from building the 2.4.25 kernel
modules, might be:

KCFLAGS = -Wall $(DEBUG_FLAGS) -D__KERNEL__  \
                -Wstrict-prototypes -Wno-trigraphs -O2 \
                -fno-strict-aliasing -fno-common -fomit-frame-pointer \
                -fsigned-char -msoft-float -pipe -ffixed-r2 \
                -Wno-uninitialized -mmultiple -mstring \
                -DMODULE -DMODVERSIONS -iwithprefix

[ from ./src/Makefile.in ]
$(XF86OBJS): xf86Wacom.c Makefile
  ==>  gcc -O2 $(DEPFLAGS) -march=i386 -mcpu=$(ARCHITECTURE) -pipe -ansi \    
                -pedantic -Wall -Wpointer-arith $(NO_MERGE_CONSTANTS) \
                -I. -I$(XF86_DIR)/programs/Xserver/hw/xfree86/common \
                -I$(XF86_DIR)/programs/Xserver/hw/xfree86/loader \
                -I$(XF86_DIR)/programs/Xserver/hw/xfree86/os-support \
                -I$(XF86_DIR)/programs/Xserver/include \
                -I$(XF86_DIR)/programs/Xserver/mi \
                -I$(XF86_DIR)/exports/include/X11 \
                -I$(XF86_DIR)/include/extensions \
                -I$(XF86_DIR) \
                -I$(XF86_DIR)/exports/include \
==>           -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE \
                -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE  -D_GNU_SOURCE \
                -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \
                -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV -DPANORAMIX \
                -DRENDER -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV \
                -DSINGLEDEPTH -DXFreeXDGA -DXvExtension -DXFree86LOADER \
                -DXFree86Server -DXF86VIDMODE -DXvMCExtension \
                -DSMART_SCHEDULE -DBUILDDEBUG -DXResExtension \
                -DX_BYTE_ORDER=X_LITTLE_ENDIAN -DNDEBUG -DFUNCPROTO=15 \
                -DNARROWPROTO -DIN_MODULE -DXFree86Module $(LINUX_INPUT) \
                -o $@ -c $(subst .o,.c,$@)

A more appropriate set of flags, taken from building XFree86-4.3.0, might be:

$(XF86OBJS): xf86Wacom.c Makefile
        gcc -O2 $(DEPFLAGS) -mcpu=$(ARCHITECTURE) -pipe -ansi \
                -pedantic -Wall -Wpointer-arith $(NO_MERGE_CONSTANTS) \
                -I. -I$(XF86_DIR)/programs/Xserver/hw/xfree86/common \
                -I$(XF86_DIR)/programs/Xserver/hw/xfree86/loader \
                -I$(XF86_DIR)/programs/Xserver/hw/xfree86/os-support \
                -I$(XF86_DIR)/programs/Xserver/include \
                -I$(XF86_DIR)/programs/Xserver/mi \
                -I$(XF86_DIR)/exports/include/X11 \
                -I$(XF86_DIR)/include/extensions \
                -I$(XF86_DIR) \
                -I$(XF86_DIR)/exports/include \
                -Dlinux  -D__powerpc__ -D_POSIX_C_SOURCE=199309L \
                -D_POSIX_SOURCE \
                -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE  -D_GNU_SOURCE \
                -DSHAPE -DXINPUT -DXKB -DLBX -DXAPPGROUP -DXCSECURITY \
                -DTOGCUP -DXF86BIGFONT -DDPMSExtension -DPIXPRIV -DPANORAMIX \
                -DRENDER -DGCCUSESGAS -DAVOID_GLYPHBLT -DPIXPRIV \
                -DSINGLEDEPTH -DXFreeXDGA -DXvExtension -DXFree86LOADER \
                -DXFree86Server -DXF86VIDMODE -DXvMCExtension \
                -DSMART_SCHEDULE -DBUILDDEBUG -DXResExtension \
                -DX_BYTE_ORDER=X_BIG_ENDIAN -DNDEBUG -DFUNCPROTO=15 \
                -DNARROWPROTO -DIN_MODULE -DXFree86Module $(LINUX_INPUT) \
                -o $@ -c $(subst .o,.c,$@)

where $(ARCHITECTURE) = powerppc  [ppc will not work]

* Kernel modules
I experimented with different ways of building [and loading] the kernel
modules:
    * evdev.o
    * hid.o
    * mousedev.o
    * wacom.o

I settled on building the modules within the existing framework for building
the Linux kernel rather than using the makefiles provided by linuxwacom-0.6.1.
I did so to insure that I got all the PPC dependency stuff right.

* Hotplug kernel module issues
I had some issues using 'modprobe' to load the wacom kernel module that forced
me to reconfigure and rebuild the 2.4.25-ben1 kernel.

A typical YDL kernel build for a PowerMac statically links most of the input
core support into the kernel:

    [from .config file provided by YDL]
    # Input core support
    #
    CONFIG_INPUT=y
    CONFIG_INPUT_KEYBDEV=y
    CONFIG_INPUT_MOUSEDEV=y
    CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
    CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
    CONFIG_INPUT_JOYDEV=m
    CONFIG_INPUT_EVDEV=y

I had initially built only wacom.o as a loadable module. The other modules
were statically linked into the kernel.

When wacom.o was loaded using:

        $ /sbin/insmod wacom.o

all went well:

[output from /var/log/messages]

Mar 24 10:26:33 plantain kernel: usb.c: registered new driver wacom
Mar 24 10:26:33 plantain kernel: Reporting max 45720, 31680
Mar 24 10:26:33 plantain kernel: wacom.c: Setting tablet report for tabletdata
Mar 24 10:26:33 plantain kernel: input4: Wacom Intuos 12x18 on usb2:3.0
Mar 24 10:26:33 plantain kernel: wacom.c: v1.30-j0.6.1 Vojtech Pavlik

Mar 24 10:26:33 plantain kernel: wacom.c: USB Wacom Graphire and Wacom Intuos
tablet  driver (LINUXWACOM-DEBUG)
Mar 24 10:26:33 plantain kernel: wacom_events

When wacom.o was loaded using:

        $ /sbin/modprobe wacom

the module failed to load:

        $ /sbin/rmmod wacom
        $ /sbin/modprobe wacom
        modprobe: Can't locate module evdev which is needed for wacom

I was perplexed about this failure because "evdev" was statically linked into
the kernel. I puzzled over this for a while and concluded that it had
something to do with how USB hotplug was configured.

I arrived at this conclusion by unplugging the tablet, waiting, and then
plugging it back in. I found that the tablet "worked" but there are complaints
in /var/log/messages:

Mar 24 10:34:51 plantain kernel: usb.c: USB disconnect on device 10:19.0-1
address 3

Mar 24 10:35:53 plantain kernel: hub.c: new USB device 10:19.0-1, assigned
address  4
Mar 24 10:35:53 plantain kernel: Reporting max 45720, 31680
Mar 24 10:35:53 plantain kernel: wacom.c: Setting tablet report for tablet
data
Mar 24 10:35:53 plantain kernel: input4: Wacom Intuos 12x18 on usb2:4.0
Mar 24 10:35:53 plantain kernel: wacom_intuos_irq: tool change 0x094
Mar 24 10:35:56 plantain /etc/hotplug/usb.agent: Setup wacom for USB product
56a/24/101
Mar 24 10:35:56 plantain /etc/hotplug/usb.agent: Setup evdev mousedev for USB
product 56a/24/101
Mar 24 10:35:56 plantain modprobe: modprobe: Can't locate module evdev
Mar 24 10:35:56 plantain modprobe: modprobe: Can't locate module mousedev

I really don't understand how the USB hotplug mechanisms are supposed to be
configured.  Yes... I did look at the scripts in /etc/hotplug. Yes.. I did
attempt a few unsucessful modifications to usb.handmap and usb.distmap. I
pondered over this for a while and then decided on a work-around:

I reconfigured and rebuilt the kernel to dynamically load
   * evdev.o
   * hid.o
   * mousedev.o
   * wacom.o

which "eliminated" the problem.

If someone out there knows what should have been done to allow modprobe to
successfully load wacom when evdev and friends are already statically linked
into the kernel, please send me email.

* XFree86 module: wacom_drv.o
I rebuilt wacom_drv.o using the linuxwacom-0.6.1 makefile and the flags listed
above.  The build was uneventful.

* Mouse1
I do not have a Mouse1 entry in XF86Config. I mention this because there is an
obscure reference in the documentation to potential mouse conflict problems
when running a USB Wacom mouse on a system with a USB mouse. The USB mouse
connected to the system and the Wacom input devices all seem to work. 

On my system:

        /dev/mouse is a link to /dev/input/mice

Mouse0 is configured in XF86Config as:

Section "InputDevice"
        Identifier  "Mouse0"
        Driver      "mouse"
        Option      "ZAxisMapping" "4 5"
        Option      "Protocol" "IMPS/2"
        Option      "Device" "/dev/input/mice"
EndSection

Maybe something nasty is going on that I don't know about. Thoughts???

* xsetwacom
There are problems...

The 'list' command prints stuff:

$ xsetwacom list
eraser           eraser
stylus           stylus
cursor           cursor

The set command fails:

$ xsetwacom -v set stylus FileModel
Set: sending 100 0 (0x0)
Error (5): WacomConfigSetRawParam: Unknown X error
Set: Failed to set stylus value for 'FileModel'

Looking at the code, I see that it is failing in a call to
XChangeDeviceControl() made from WacomConfigSetRawParam(). I also poked
around in this one with GDB. The X-Display gets opened properly. Things look
OK until the request is dispatched, which then returns an unknown X error.

I also tried to use xsetwacom to toggle the cursor mode between relative and
absolute.  Again the command fails with an unkown X error.  Note that the
XFree86 command  'xsetmode' works fine.

-Joseph 







Copyright (C) 2002-2009 - LinuxWacom -Last updated December 9, 2009
This website and its contents are licensed under the GNU GENERAL PUBLIC LICENSE.