{"id":321,"date":"2011-01-09T12:12:12","date_gmt":"2011-01-09T11:12:12","guid":{"rendered":"http:\/\/braindump.kargulus.de\/?p=321"},"modified":"2016-10-12T20:43:56","modified_gmt":"2016-10-12T18:43:56","slug":"using-the-wacom-intuos4-tablet-with-linux-part-1","status":"publish","type":"post","link":"https:\/\/braindump.kargulus.de\/?p=321","title":{"rendered":"Using The Wacom Intuos4 Tablet With Linux (Part 1)"},"content":{"rendered":"<p><a title=\"Wacom\" href=\"http:\/\/www.wacom.com\" target=\"_blank\">Wacom<\/a> is a company which produces high quality pen tablets and touchscreens. The tablets are a number one choice for Linux users since they are well supported. The <a title=\"Linux Wacom Project\" href=\"http:\/\/linuxwacom.sourceforge.net\/\" target=\"_blank\">Linux Wacom project<\/a> provides an high quality driver and\u00a0 the userland tool <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">xsetwacom<\/code>\u00a0to change the settings of the tablet such as button keys or pressure sensitivity.<\/p>\n<p><!--more-->After reading some reviews, I decided to buy an Intuos4 M tablet for image manipulation with the GIMP. One of the reasons to choose this tablet was that it has eight buttons to which arbitrary key strokes are assignable. Each button has a little LED display besides it, which can be used to display the button assignment as a text or an icon.<\/p>\n<p>After connecting the tablet to my computer (running Debian), I was able to configure the buttons with <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">xsetwacom<\/code>. However, there was no possibility to set the LED displays. The consultation of the xsetwacom documentation was fruitless. So I searched the developer&#8217;s mailing list and found a post which contained a piece of code to access the LED displays. Unfortunately, the code did not work for me, but it provided some useful information on accessing the tablet. The self-imposed challenge was to develop a little C++ application to set to LED displays.<\/p>\n<p>The main features of the application are:<\/p>\n<ul>\n<li>The application uses libusb to communicate with the tablet.<\/li>\n<li>Images are converted to an appropriate format using the Magick library. This is, you can download a png\/jpg image directly to the tablet, if the image has the appropriate size.<\/li>\n<li>The application contains an icon library. These icons can be used directly for configuration the tablet display. A bunch of common icons are included in order to use without generating appropriate images.<\/li>\n<\/ul>\n<p>The remaining part of this post is a little howto covering the setup and usage of the application.<\/p>\n<h2>Building the application from source<\/h2>\n<ol>\n<li>In order to compile the source code, the development packages of libusb and Magick++ libraries must be present on the system. Furthermore,\u00a0 g++ and make.are mandatory. Under Debian Squeeze, the respective packages can be installed with the following command:\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">sudo apt-get install g++ make libusb-1.0-0-dev libmagick++-dev<div class=\"fusion-fullwidth fullwidth-box fusion-builder-row-1 hundred-percent-fullwidth non-hundred-percent-height-scrolling\" style=\"--awb-border-radius-top-left:0px;--awb-border-radius-top-right:0px;--awb-border-radius-bottom-right:0px;--awb-border-radius-bottom-left:0px;--awb-overflow:visible;--awb-flex-wrap:wrap;\" ><div class=\"fusion-builder-row fusion-row\"><div class=\"fusion-layout-column fusion_builder_column fusion-builder-column-0 fusion_builder_column_1_1 1_1 fusion-one-full fusion-column-first fusion-column-last fusion-column-no-min-height\" style=\"--awb-bg-size:cover;--awb-margin-bottom:0px;\"><div class=\"fusion-column-wrapper fusion-flex-column-wrapper-legacy\">[<\/pre>\n<\/li>\n<li>Download the <a title=\"Using The Wacom Intuos4 Tablet With Linux\" href=\"https:\/\/braindump.kargulus.de\/?p=432\" target=\"_self\">source code<\/a>, open a terminal window and extract the archive with the following command:.\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">tar xzf wacom-intuos4-led.tar.gz<\/pre>\n<\/li>\n<li>Change into the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">Intuos4-LED\/src<\/code>\u00a0folder:\n<pre class=\"EnlighterJSRAW\">cd Intuos4-LED\/src<\/pre>\n<\/li>\n<li>Invoke make to start the compilation:[cc lang=&#8221;text&#8221;]make[\/cc]\nIf the compilation is successful, then the folder contains two executables named <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">intuos4-led-check<\/code>\u00a0and <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">intuos4-led-config<\/code>. The first one can be used to check whether the tablet works, The second one is the application to configure the tablet&#8217;s LED displays.<\/li>\n<\/ol>\n<h2>Test whether the tablet works<\/h2>\n<p>Execute the following command and watch the LED displays of the tablet:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sudo .\/intuos4-led-check<\/pre>\n<p>The LED displays should pass a little sequence of images and end up with a\u00a0 button labelling from &#8220;Button 1&#8221; to &#8220;Button 8&#8221;.<\/p>\n<h2>Setting the LEDs of the tablet<\/h2>\n<p><strong>Note:<\/strong> The application cannot communicate with the tablet via the generic USB interface if the wacom driver module is loaded into the kernel. Hence, the module must be unloaded before setting the LEDs and reloaded afterwards. Concretely, the setup passes the following steps:<\/p>\n<ol>\n<li>Unload the wacom module:\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sudo rmmod wacom<\/pre>\n<\/li>\n<li>Configure the LEDs with\u00a0<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">intuos4-led-config<\/code><\/li>\n<li>Reload the wacom module:\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sudo modprobe wacom<\/pre>\n<\/li>\n<li>Configure the tablet with\u00a0<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">xsetwacom<\/code><\/li>\n<\/ol>\n<p>There are two ways to assign an image to an particular LED:<\/p>\n<ul>\n<li>Use a predefined image icon<\/li>\n<li>Use a png\/jpg image with a size of 64 \u00d7 32 pixels<\/li>\n<\/ul>\n<p>To determine the names of the predefined icons, execute<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\">.\/intuos4-led-config --list<\/pre>\n<p>To assign the icon &#8220;Tux&#8221; to the display besides button 2, execute<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sudo .\/intuos4-led-config --icon Tux --button 2<\/pre>\n<p>Per default, the setup is done for a right-handed tablet orientation, i.e. with the buttons located on the left side. The perform a left-handed setup (buttons on the right side), the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">--lefthanded<\/code>\u00a0switch can be used.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sudo .\/intuos4-led-config --lefthanded--icon Tux --button 2<\/pre>\n<p>The image <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">icon-debian.png<\/code>\u00a0is assigned to the display of button 3 with the following command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">sudo .\/intuos4-led-config --image icon-debian.png --button 3<\/pre>\n<p>The folder <em>icons<\/em> contains example images including the image\u00a0<code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">icon-debian.png<\/code>.<\/p>\n<h2>Generation of text icons<\/h2>\n<p>Using ImageMagick it is quite simple to create new text icons using the script <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">text-icon.sh<\/code>:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"true\">#! \/bin\/bash\r\n\r\nTEXTFONT=\/usr\/share\/fonts\/truetype\/msttcorefonts\/Arial.ttf\r\n\r\nconvert -background black -fill white -size 64x32 -pointsize 14\r\n-gravity center\u00a0 -font $TEXTFONT\r\nlabel:\"$1\" icon-$2.png<\/pre>\n<p>The script is located in the icons folder of the source distribution. In order to work, the MSTTCorefonts package must be installed. By calling<\/p>\n<pre class=\"EnlighterJSRAW\">.\/text-icon.sh Copy copy<\/pre>\n<p style=\"text-align: left;\">the icon <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">icon-copy.png<\/code>\u00a0with the text &#8220;Copy&#8221; is generated. The result is a png image of size 64&#215;32 pixels:<\/p>\n<p style=\"text-align: center;\"><img decoding=\"async\" class=\"aligncenter wp-image-369 size-full\" title=\"icon-copy.png\" src=\"https:\/\/braindump.kargulus.de\/wp-content\/uploads\/icon-copy.png\" alt=\"\" width=\"64\" height=\"32\" \/><\/p>\n<p style=\"text-align: left;\">Instead of Arial, you can use any (installed) truetype font by altering the <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">TEXTFONT<\/code>\u00a0variable in the above script.<\/p>\n<h2>A shell script for automated tablet configuration<\/h2>\n<p>The following script is an example for the automated setup of the tablet. Feel free to adapt for your needs.<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"shell\" data-enlighter-linenumbers=\"true\">#! \/bin\/bash\r\n\r\n# Device name of the tablet retrieved from xsetwacom\r\nDEVICE=\"Wacom Intuos4 6x9 pad\"\r\n# Path to the tablet config application\r\nLEDCMD=.\/intuos4-led-config\r\n\r\nsudo modprobe -r wacom\r\nsudo $LEDCMD --button 1 --icon Undo\r\nsudo $LEDCMD --button 2 --icon Redo\r\nsudo $LEDCMD --button 3 --icon ZoomIn\r\nsudo $LEDCMD --button 4 --icon ZoomOut\r\nsudo $LEDCMD --button 5 --icon Save\r\nsudo $LEDCMD --button 6 --icon Alt\r\nsudo $LEDCMD --button 7 --icon Ctrl\r\nsudo $LEDCMD --button 8 --icon ArrowUp\r\nsudo modprobe wacom\r\n\r\nsleep 1\r\n\r\nxsetwacom --set \"$DEVICE\" Button 2 \"key ctrl y\"\r\nxsetwacom --set \"$DEVICE\" Button 3 \"key ctrl z\"\r\nxsetwacom --set \"$DEVICE\" Button 8 \"key plus\"\r\nxsetwacom --set \"$DEVICE\" Button 9 \"key minus\"\r\nxsetwacom --set \"$DEVICE\" Button 10\u00a0 \"key ctrl s\"\r\nxsetwacom --set \"$DEVICE\" Button 11 \"key alt\"\r\nxsetwacom --set \"$DEVICE\" Button 12 \"key ctrl\"\r\nxsetwacom --set \"$DEVICE\" Button 13 \"key shift\"<\/pre>\n<p><strong>Note:<\/strong> The script was tested with <code class=\"EnlighterJSRAW\" data-enlighter-language=\"null\">xsetwacom<\/code>\u00a0version 0.11.0. If you use a different version, please check the xsetwacom man page for the correct syntax.<div class=\"fusion-clearfix\"><\/div><\/div><\/div><\/div><\/div><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wacom is a company which produces high quality pen tablets and touchscreens. The tablets are a number one choice for Linux users since they are well supported. The Linux Wacom project provides an high quality driver and\u00a0 the userland tool xsetwacom\u00a0to change the settings of the tablet such as button keys or pressure sensitivity.<\/p>\n","protected":false},"author":2,"featured_media":335,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[8],"tags":[3],"class_list":["post-321","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-howto","tag-linux"],"_links":{"self":[{"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=\/wp\/v2\/posts\/321","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=321"}],"version-history":[{"count":77,"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions"}],"predecessor-version":[{"id":4063,"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=\/wp\/v2\/posts\/321\/revisions\/4063"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=\/wp\/v2\/media\/335"}],"wp:attachment":[{"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=321"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=321"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/braindump.kargulus.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=321"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}