Page 1 of 5 123 ... LastLast
Results 1 to 10 of 1415

Thread: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

Hybrid View

  1. #1
    Join Date
    Jul 2007
    Beans
    864
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    *****Tutorial For USB Tablet PC*****
    This is NOT for Serial Tablet PCs. The default configuration on Jaunty should work just fine for serial tablets. This tutorial may mess up your machine.

    *****************************************
    IS THIS FOR ME?
    *****************************************
    If you:
    1. Have to plug your Tablet into your computer,
    2. Have the Bamboo, Graphire(any number), Intuos(any number EXCEPT 4), or Cintiq(any version)
    3. Have a serial tablet, then
    THIS TUTORIAL IS NOT FOR YOU! It will not work, and will only mess things up for you. You have been warned!

    Intuos4 people, please use only the part about compiling the kernel module. ONLY do part 1.
    (Thanks Favux)

    This tutorial borrows Favux's tutorial on the first page - which borrows from several others. Look at the bottom of this post to see more contributions.
    Note: Rec's Script is no longer necessary. I'm not sure whether an xserver update fixed this, or the new fdi file. (I think it was the fdi file.)
    Also, devices work after suspend and hibernate consistently (and xsetwacom and wacomcpl work as well.)
    If you are seeing this tutorial again, replace your current fdi file with the new one below.


    IF YOU ARE ON KARMIC, READ THIS SECTION!
    Due to Karmic not containing a certain file, you need to run this command:
    Code:
    sudo wget -O /lib/modules/`uname -r`/build/drivers/hid/hid-ids.h http://kernel.ubuntu.com/git-repos/ubuntu/linux-2.6/drivers/hid/hid-ids.h
    This downloads the file we need from ubuntu's servers and puts it in the correct place. You should only need to run this once after every Kernel update. However, running it more than that will not hurt anything. If you receive compile errors on Karmic, run the command again before posting for help.
    Now with this done,
    SKIP TO SECTION 2 - ONLY IF YOU ARE ON KARMIC
    Unless of course you want to compile the newest release. This is no longer necessary with Karmic.



    Section 1: Download source code, compile, and install linuxwacom kernel driver/module.
    Okay so the first step is to install the packages:

    Code:
    sudo apt-get install wacom-tools xserver-xorg-input-wacom
    Now we need to compile the kernel module from the newest linux wacom release (0.8.4-3)
    First we have to get all the tools we need:
    1) First download the source code tar onto the desktop. In a terminal type:

    Code:
    cd ./Desktop
    
    wget http://prdownloads.sourceforge.net/linuxwacom/linuxwacom-0.8.4-3.tar.bz2
    2) Next install the needed libraries, packages and updates using the following apt-get commands.
    Code:
    sudo apt-get update
    
    sudo apt-get install build-essential libx11-dev libxi-dev x11proto-input-dev xserver-xorg-dev tk8.4-dev tcl8.4-dev libncurses5-dev
    
    sudo apt-get upgrade

    3) Now the kernel headers for your kernel are needed. To determine your kernel version:

    Code:
    uname -r
    If you have the generic kernel:

    Code:
    sudo apt-get install linux-headers-generic
    If you have the rt kernel:

    Code:
    sudo apt-get install linux-headers-rt
    (Remember if you update to a newer kernel, then the module won't work on restart because the module is compiled for a specific kernel. You will have to recompile the module for the newer kernel.)

    4) Okay now unpack the source code tar and go into the unpacked source code directory.
    Code:
    tar xjvf linuxwacom-0.8.4-3.tar.bz2
    
    cd linuxwacom-0.8.4-3
    5) Then we compile the module.

    Code:
    ./configure --enable-wacom 
    
    make

    *****We DO NOT run "sudo make install" since we only want the module.*****

    6) Next we copy the module to the appropriate directory:

    Code:
    sudo cp ./src/2.6.28/wacom.ko /lib/modules/`uname -r`/kernel/drivers/input/tablet/wacom.ko
    Section 2: Creating the Fdi File
    First as a reference I will include a default fdi File:
    Code:
    <?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
    
    <deviceinfo version="0.2">
      <device>
        <match key="input.originating_device" contains="if0">
    	<match key="info.product" contains="Wacom">
    		<merge key="input.x11_driver" type="string">wacom</merge>
    		<merge key="input.x11_options.Type" type="string">stylus</merge>
    		<merge key="info.product" type="string">stylus</merge>
    		<append key="info.callouts.add" type="strlist">hal-setup-wacom</append>
              	<append key="wacom.types" type="strlist">eraser</append>
    	</match>
        </match>
      </device>
      <device>
        <match key="input.originating_device" contains="if1">
    	<match key="info.product" contains="Wacom">
    		<merge key="input.x11_driver" type="string">wacom</merge>
    		<merge key="input.x11_options.Type" type="string">touch</merge>
    		<merge key="info.product" type="string">touch</merge>
    	</match>
        </match>
      </device>
      <device>
    	<match key="input.x11_options.Type" contains="eraser">
    	  <merge key="info.product" type="string">eraser</merge>
    	</match>
      </device>
    </deviceinfo>
    Start with this as a reference.
    Code:
    sudo gedit /usr/share/hal/fdi/policy/20thirdparty/10-wacom.fdi
    If you are on Karmic, use: (delete the contents)
    Code:
    sudo gedit /usr/share/hal/fdi/policy/20thirdparty/10-linuxwacom.fdi
    Copy and paste the above contents then save.

    This fdi file should work for any usb tablet pc. If you find that it does not work for you, please post the output of lshal and the model of your laptop.



    Section 3: Configuring the Fdi File
    At this point You should be able to reboot and everything should work.
    With the current fdi file you will be able to calibrate both touch and the stylus. It is almost exactly the same as editing the xorg.conf, but has a bit of a different format.
    Where an xorg.conf option would look like:
    Code:
    Option	"OptionName"	"OptionValue"
    such as:
    Code:
    Option	"BottomY"	"3951"
    Now we add the line to the fdi file such as:

    Code:
    <merge key="input.x11_options.OptionName" type="string">OptionValue</merge>
    such as:
    Code:
    <merge key="input.x11_options.BottomY" type="string">16466</merge>
    You can view my fdi file below as an example. All options in the xorg.conf should work in the fdi file using this method.
    Code:
    <?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
    
    <deviceinfo version="0.2">
      <device>
        <match key="input.originating_device" contains="if0">
    	<match key="info.product" contains="Wacom">
    		<merge key="input.x11_driver" type="string">wacom</merge>
    		<merge key="input.x11_options.Type" type="string">stylus</merge>
    		<merge key="info.product" type="string">stylus</merge>
    		<append key="info.callouts.add" type="strlist">hal-setup-wacom</append>
              	<append key="wacom.types" type="strlist">eraser</append>
    		<merge key="input.x11_options.BottomY" type="string">16466</merge>
    		<merge key="input.x11_options.BottomX" type="string">26271</merge>
    		<merge key="input.x11_options.TopY" type="string">183</merge>
    		<merge key="input.x11_options.TopX" type="string">397</merge>
    	</match>
        </match>
      </device>
      <device>
        <match key="input.originating_device" contains="if1">
    	<match key="info.product" contains="Wacom">
    		<merge key="input.x11_driver" type="string">wacom</merge>
    		<merge key="input.x11_options.Type" type="string">touch</merge>
    		<merge key="info.product" type="string">touch</merge>
    		<merge key="input.x11_options.BottomY" type="string">3909</merge>
    		<merge key="input.x11_options.BottomX" type="string">3947</merge>
    		<merge key="input.x11_options.TopY" type="string">185</merge>
    		<merge key="input.x11_options.TopX" type="string">186</merge>
    	</match>
        </match>
      </device>
      <device>
    	<match key="input.x11_options.Type" contains="eraser">
    	  <merge key="info.product" type="string">eraser</merge>
    	</match>
      </device>
    </deviceinfo>
    Section 4: Wacomcpl and settings

    After you have rebooted, you should be able to run the command wacomcpl. This will bring up a dialog that will allow you to configure your tablet, calibrate it and change which buttons do which. After you exit wacomcpl, your settings are saved to a file in your home folder named .xinitrc.
    For your settings to stay the same everytime you login and suspend/hibernate, we will need to create a session for it.
    This involves compiling a settings daemon. (From Cyberfish.)

    Open up a fresh terminal and run the following commands:
    Code:
    gedit monitor_wacom.c
    and copy and paste in the following code then save and exit.

    Code:
    #include <stdio.h>
    #include <stdlib.h>
    #include <string.h>
    #include <unistd.h>
    #include <time.h>
    #include <assert.h>
    
    void log_msg(const char *msg) {
    
    	FILE *log_file = fopen(".monitor_wacom.log", "a");
    
    	if (log_file) {
    		time_t time_g;
    		time(&time_g);
    		char date_str[100];
    		strcpy(date_str, asctime(localtime(&time_g)));
    		date_str[strlen(date_str) - 1] = '\0'; /* get rid of the \n */
    		fprintf(log_file, "%s : %s\n", date_str, msg);
    	}
    
    	fclose(log_file);
    }
    
    void run_script(const char *filename) { /* only run xsetwacom lines */
    	FILE *script_file = fopen(filename, "r");
    	
    	if (!script_file) {
    		log_msg("Failed to open script (double check your entry in Startup Applications). Terminating.");
    		exit(1);
    	}
    
    	char buf[1024];
    	char l_buf[1024];
    	int count = 0;
    	while ((fgets(buf, 1023, script_file))) {
    		if (strstr(buf, "xsetwacom")) {
    			int r = system(buf);
    			if (r != 0) {
    				sprintf(buf, "xsetwacom returned error on line - %s", buf);
    				log_msg(l_buf);
    			}
    			++count;
    		}
    	}
    
    	sprintf(l_buf, "Script ran. %d matching lines executed.", count);
    
    	log_msg(l_buf);
    }
    
    int main(int argc, char **argv) {
    
    	char script_name[1024];
    
    	if (argc != 2) {
    		log_msg("Script not specified, using .xinitrc");
    		strcpy(script_name, ".xinitrc");
    	} else {
    		strcpy(script_name, argv[1]);
    	}
    	
    	run_script(script_name);
    
    	FILE* in = popen("dbus-monitor --session type='signal',interface='org.gnome.ScreenSaver',member='ActiveChanged'", "r");
    	
    	if (!in) {
    		log_msg("Cannot spawn dbus-monitor process. Terminating.");
    		return 1;
    	}
    
    	while (1) {
    		char buf[1024];
    		assert(fgets(buf, 1023, in));
    		
    		if (buf[0] == 's' /* early exit optimization */ && strstr(buf, "ActiveChanged") != NULL) {
    			assert(fgets(buf, 1023, in));
    			if (strstr(buf, "false") != NULL) {
    				/* resumed */
    				log_msg("Exit from screensaver detected. Running script.");
    				run_script(script_name);
    			} else {
    				/* put to sleep */
    			}
    		} 
    	}
    }
    Back at the terminal run:
    Code:
    gcc -O2 monitor_wacom.c -o .monitor_wacom
    This will create a binary daemon in your home directory. The only thing left to do is add it to sessions.


    Now go to System->Preferences->Startup Applications
    (If you are still on Intrepid - which if you are this tutorial may not work - it is System->Preferences->Sessions)
    and create a new entry named whatever you want.
    the command should be:
    Code:
    /home/yourusername/.monitor_wacom /home/yourusername/.xinitrc
    Where you replace yourusername with your user name. (Duh )



    And that should be it. Everything for me is working great. If you have any problems, post here and You will probably receive help quite soon.
    Have a great day!

    Thanks:
    Favux for his diligent hard working in creating the first tutorial, and helping us all in research.
    Rec for his wonderful script and other work.
    Timo for his work in getting the packages built and patching and all that wonderful stuff.
    Cyberfish for his help in getting the fdi file right, and his settings daemon.
    Ping at the Linuxwacom project.
    Anyone else who I have failed to mention who deserves credit.

    Kory
    Edits:
    4/18/09 - Fixed my present fdi file with better values for calibration.
    5/4/09 - Redid tutorial with more information, updated to 0.8.3-3, removed rec's script, updated fdi file, and added settings daemon.
    5/26/09 - Updated tutorial with Cyberfish's Second Daemon (finally), removing the xinitrc part. Updated to 0.8.3-4 and added large warning .
    6/27/09 - Updated to 0.8.3-5
    7/11/09 - Updated to 0.8.3-6
    7/31/09 - Updated to 0.8.4
    9/17/09 - Updated to 0.8.4-2 - Thanks Favux!
    10/8/09 - Updated to 0.8.4-3 - Added Karmic Section
    10/11/09 - Updated Karmic Instructions. Added compile error fix.
    Last edited by gali98; October 11th, 2009 at 06:06 AM.

  2. #2
    Join Date
    Apr 2008
    Beans
    52

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    Hello gali98

    Worked for me as well! I have a TX2113cl which is a version of the TX2000 so I just used your fdi entries. Great job! My xrandr script is not working correctly for some reason but I can live with that.

  3. #3
    Join Date
    Apr 2008
    Beans
    14

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    gali98,

    if i have already installed wacom the old way in jaunty, will i have to take the input devices out of my xorg before installing with your guide?

    And you only do this if your file doesnt work correct?
    It should work on the tx2500 also, but just in case we will go over how to fix it if it doesn't.
    Run the following commands in a fresh terminal:

    Code:
    cd Desktop
    lshal>lshal
    gedit lshal &
    That will open up a text editor with a lot of info. Go back to the terminal and run:

    Code:
    ls -l /dev/input
    Find which event points to the wacom file. Now go back to the text editor and hit ctrl+f for search and search that even (e.g. search "event?" where ? is the number.)
    That should put you in a device set. Within that device set, find "input.originating_device." and copy it's value. Now go back to the fdi file, and replace my value for the first device with what you just copied.
    Repeat this procedure for the "wacom-touch" file and use that string for the touch device in the fdi file.
    Wow! What a mouthful! I just suggest trying my file first znd if it doesn't work THEN try all that above.
    is there anything else i need to do before attempting your method on a tx2500? should the libhal1-dev be installed?

  4. #4
    Join Date
    Nov 2008
    Beans
    9,635
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    Hi gali98 and M42 and farmercyst,

    For fun I tried to see how much I could get working in Intrepid. I duplicated the set-up using rec's script and the linuxwacom 0.8.3-1 I had already installed. I placed gali98's .fdi file in /usr/share/hal/fdi/policy/20thirdparty/. I commented out Wacom in xorg.conf and rebooted. I have stylus but not eraser and I have touch. This is in wacomcpl and gimp. They can be calibrated. Gimp has stylus pressure. However the wacom devices don't rotate with the standard scripts.

    For the script I used wacom-names post #93 above. I also linked it as rec recommended:
    Code:
    sudo update-rc.d wacom-names start 27 2 3 4 5 .
    I decided to experiment with the .fdi file. I took my two usb id_test 1.fdi's and consolidated them into one like gali98 did. Then I substituted the "linux.sysfs_path" = with the "input.originating_device" contains=. Same problem. Stylus and touch seem fine. No eraser. Both in wacomcpl and Gimp. I am not seeing duplicate entries in wacomcpl. And no rotation implying the xsetwacom commands in the xrander rotation script or Tom Jaeger's wacomrotate daemon aren't being seen.

    I'm wondering what this is due to. Rec's script? It uses "--key input.x11_options.Type" after all. With Type=stylus, eraser, touch, cursor, pad? Which may be all wacomcpl needs, not the xsetwacom commands? Hmmm...

    The call out not working correctly? Guess I could try 0.8.3-2. Most likely I need some of the stuff Timo packaged with 0.8.2-2.

    Using rec's Wacom input names in xinput script I got:
    Code:
    product 'stylus' is type 'stylus'
    before I changed the original wacom.fdi in Intrepid. Or maybe the stylus line appeared twice. With the new wacom.fdi's I am seeing:
    Code:
    product 'touch' is type 'touch'
    product 'stylus' is type 'stylus'
    Looking at Xinput:
    Code:
    xinput list
    shows stylus and touch but not eraser. The results were the same with xinput query-state "stylus" or xinput list-props "touch". I get "unable to find device eraser".
    Attached Files Attached Files
    Last edited by Favux; April 20th, 2009 at 04:24 AM.

  5. #5
    Join Date
    Apr 2008
    Beans
    52

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    Hello Favux,

    I have touch and stylus with pressure and eraser working in Xjournal. I haven't tried Gimp. I attached my fdi file for info. I also xrandr web site at X.org and they seem to refer to version 1.2. When I checked out the version on my machine it is 1.3. Any possibilities our problem could be in the version difference?
    Attached Files Attached Files

  6. #6
    Join Date
    Nov 2008
    Beans
    9,635
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    Hi M42,

    That could be. But I think more likely the problem with rotation is rec's script. My understanding may be wrong. But since it applies before Xserver, by design, it may not allow xsetwacom commands on the "fly". Which is why we can't get rotation. Or actually should I say it doesn't fix that part of the problem with Timo's patched linuxwacom 0.8.2-2?

    Anyway I reactivated Wacom in xorg.conf. Now I have eraser but also a duplicate stylus and touch in wacomcpl. And pressure doesn't work in Gimp. And rotation doesn't work. Wacom tools don't rotate with the screen again implying xsetwacom commands not working. Next step is to remove rec's script.

    I think the eraser problem is more likely the fault of Intrepid or linuxwacom 0.8.3-1. I could try 0.8.3-2. Thanks for the .fdi. Removing rec's script fixed the duplicate stylus and touch entries in wacomcpl. But rotation still doesn't work. Next step is to remove the last change, the new 10-wacom.fdi file.

    Oops, removing the .fdi still didn't fix rotation. The script isn't in any of the run levels or init.d.
    Last edited by Favux; April 20th, 2009 at 04:25 AM.

  7. #7
    Join Date
    Apr 2008
    Beans
    52

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    Hello Favux,

    I'm not sure what is happening. Maybe when Jaunty is released some of these problems will go away. If I think of something I'll post. Good luck.

  8. #8
    Join Date
    Nov 2008
    Beans
    9,635
    Distro
    Ubuntu 12.04 Precise Pangolin

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    Thanks M42.

    Well this is pretty ridiculous. What's happened with rotation is that CW has become CCW and vice versa. So if you change your rotation script appropriately everything is fine!!! If you don't then when you rotate right or left the cursor moves 180 degrees inverted to your stylus.

    I don't think this was happening with rec's script and .fdi file. I think the cursor would move at a right angle to the stylus motion. Which is what you would expect with xsetwacom commands not having any effect. But at this point I can't swear to it. I think this happened after I removed rec's script. But as to why it happened I don't yet know.

    So I've learned rec's script actually takes you pretty far in Intrepid. You almost get things working. The important part is that with a custom .fdi and the script you can get stylus and touch, which is what was intended for Intrepid all along.

    Interesting quote from Matthew Garrett's blog 3-6-09:
    After a bit of back and forth with Peter, we came up with a straightforward way of dealing with the fact that the Wacom driver needs a logical input device per input type[1], but the X server only generates an input device per hal device. The simplest solution turned out to be a hal callout that generates additional hal devices on demand, which also means we can add information to the fdi files to only add the appropriate device types. Ought to land in rawhide in the near future, at which point tablets should be basically working out of the box. Except that xsetwacom gets device name -> type mapping by attempting to parse xorg.conf. Pass the suicide.
    http://www.advogato.org/person/mjg59...html?start=198 Apparently the problem was known at least a month before we encountered it. I think this is the same person who maintains the HP-WMI module. Which lookes like it might control the swivel hinge and two lower bezel buttons. But it turns out he has a TX2500. So...
    Last edited by Favux; April 21st, 2009 at 10:31 PM.

  9. #9
    Join Date
    Apr 2009
    Location
    Delhi, India
    Beans
    11
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Smile Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    Hello Favux, Gali98, everyone else,

    I have set up the tablet on a tx2000 on Jaunty following your tutorial. However, wacomcpl never recognized any of the devices (stylus/eraser etc.) Nor did xsetwacom.

    To get the eraser to map its Button1 to "2" (this is needed for Xournal to realize that the eraser is for erasing), here is what I did:

    I edited Gali98's /etc/init.d/wacomtohal
    and at the bottom, I added the following line:

    Code:
    hal-set-property --udi /org/freedesktop/Hal/devices/usb_device_56a_93_noserial_if0_logicaldev_input_subdev --key input.x11_options.Button1 --string "2"
    And this gets everything to work after a reboot.

    Shouri

  10. #10
    Join Date
    Apr 2008
    Beans
    74

    Re: HOW TO: Install a LinuxWacom Kernel Driver for Tablet PC's

    Hopefully this fdi will do -
    Code:
    <?xml version="1.0" encoding="UTF-8"?> <!-- -*- SGML -*- -->
    
    <deviceinfo version="0.2">
      <device>
        <match key="input.originating_device" contains="if0">
    	<match key="info.product" contains="Wacom">
    	  <merge key="input.x11_driver" type="string">wacom</merge>
    	  <merge key="input.x11_options.Type" type="string">stylus</merge>
    	  <merge key="info.product" type="string">stylus</merge>
              <append key="info.callouts.add" type="strlist">hal-setup-wacom</append>
              <append key="wacom.types" type="strlist">eraser</append>
    	</match>
        </match>
      </device>
      <device>
        <match key="input.originating_device" contains="if1">
    	<match key="info.product" contains="Wacom">
    	  <merge key="input.x11_driver" type="string">wacom</merge>
    	  <merge key="input.x11_options.Type" type="string">touch</merge>
    	  <merge key="info.product" type="string">touch</merge>
              <append key="info.callouts.add" type="strlist">hal-setup-wacom</append>
    	</match>
        </match>
      </device>
      <device>
    	<match key="input.x11_options.Type" contains="eraser">
    		<merge key="info.product" type="string">eraser</merge>
    	</match>
      </device>
    </deviceinfo>

Page 1 of 5 123 ... LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •