Announcement

Collapse
No announcement yet.

Configure Calcomp DrawingBoard III digitizing board as XInput device [solved]

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Configure Calcomp DrawingBoard III digitizing board as XInput device [solved]

    Howdy folks:

    I am having difficulty configuring Kubuntu 8.10 to recognize my Calcomp DrawingBoard III digitizing board as an XInput device and I need some help. I am using the Linux calcomp driver written for this hardware (package xserver-xorg-input-calcomp) and presumably the version compiled for the latest kernel: I installed it from konsole with

    sudo apt-get install xserver-xorg-input-calcomp

    Before getting into too many details, I have thusfar traced the
    issue to a timeout error during loading of the driver that appears in /var/log/Xorg.0.log:

    Snipped from /var/log/Xorg.0.log:
    .
    .
    .
    (II) Calcomp SetupProc called
    (**) Option "Device" "/dev/ttyS0"
    (II) CALCOMP driver: Serial device opened
    (**) Option "MinX" "00000"
    (**) Option "MaxX" "36000"
    (**) Option "MinY" "00000"
    (**) Option "MaxY" "24000"
    (II) options read MaxX=36000, MaxY=24000
    (WW) Timeout while reading Calcomp tablet. No tablet connected
    (EE) Unable to query/initialize CALCOMP hardware.
    (EE) Calcomp setup failed, unloading tablet driver
    (II) UnloadModule: "calcomp"
    (EE) PreInit returned NULL for "DrawingBoard"
    .
    .
    .

    UPDATE 03/12/2009: Since posting this query, I've made progress on documenting the problem: Upon starting X, when the calcomp driver loads, it initializes bits in the digitizing board's two internal hardware configuration banks, but when it does so, it sets an invalid parity option. As discussed below (see also Detail #4 later), there are three hardware configuration bits that define the parity options in the board's internal configuration "Bank B", keys (or bits) 4,5,6:

    Parity
    Option:

    None 100
    Mark 011
    Even 010
    Odd 000

    When the calcomp driver loads up, it sets the Bank B, bits 4,5,6 to 111. According to Page 14 of the Calcomp DrawingBoard III help manual (http://www.gtcocalcomp.com/files/dbiii.pdf), this is not a valid parity option.

    Is the calcomp driver broken?



    I've searched online for more than a week to find a solution. My only find was a deadthread with no reported solution:

    http://lists.debian.org/debian-x/2006/04/msg00329.html


    Here are some relevant details:

    Detail #1) xorg.conf: As noted in the Kubuntu Forum Announcement "Review the Register"
    (http://kubuntuforums.net/forums/inde...opic=3098947.0),

    /etc/X11/xorg.conf was eliminated in the latest version of X.org. I created an xorg.conf
    from scratch and, as indicated in /var/log/Xorg.0.log, it was recognized and read-in when I
    restarted X.

    The salient "calcomp" sections of my xorg.conf file are:

    Section "ServerLayout"
    Identifier "Default Layout"
    Screen 0 "Default Screen" 0 0
    InputDevice "Mouse0" "CorePointer"
    InputDevice "DrawingBoard" "CorePointer"
    InputDevice "Keyboard0" "CoreKeyboard"
    EndSection

    Section "ServerFlags"
    Option "AllowMouseOpenFail" "true"
    EndSection

    Section "InputDevice"
    Identifier "DrawingBoard"
    Driver "calcomp"
    Option "Device" "/dev/ttyS0"
    Option "Cursor" "Puck"
    Option "AlwaysCore" "on"
    Option "MinX" "00000"
    Option "MinY" "00000"
    Option "MaxX" "36000"
    Option "MaxY" "24000"
    Option "Mode" "Absolute"
    Option "DeviceName" "TABLET"
    Endsection



    Detail #2) I can confirm that the digitizing tablet hardware can talk to serial port /dev/ttyS0.

    Firstly, the digitizing board "beeps" and the board's internal configuration modes appear to be
    automatically altered by the initializing calcomp driver whenever I restart X.

    Secondly, if I "cat /dev/ttyS0" on konsole and then move the digitizer puck around on the board
    and push buttons on the puck, on the konsole I get a series of ascii strings in response that
    change accordingly with new positions and new buttons clicks.

    Thirdly, I have used the digitizing board before in a manually-set communication mode that sends
    position coordinates and button clicks to my home-brewed FORTRAN programs. I have confirmed, again with "cat /dev/ttyS0", that sensible signals are being sent when I use this manual configuration.

    Detail #3) I have not previously attempted to use this hardware and the calcomp driver as an XInput
    device on any earlier release of Kubuntu or any other flavor of Linux.

    I am testing this stuff out on an old piece of computer hardware (Dell OptiPlex GXa) before moving it
    to and interupting one of my active work machines.


    Detail #4) [Added 03/12/2009] The digitizing board hardware can be configured via two 18 value (on/off) banks of programmable hardware bits. They can be manually set with the cursor, or they can be programmed from software. I was able to manually examine the configuration bits set by the calcomp driver on initialization. Upon starting X, the driver loads the following configuration bit values into to two banks:

    Bank A: 010101111101011111
    Bank B: 001111000000000001

    I looked these up in the Calcomp help manual.

    Bank A values are completely valid. They correspond to

    operating mode: point
    increment mode: 1
    prompt mode: off
    data rate: 125 pps
    resolution: 1000 lpi
    format: GTCO DP5 Hi Res
    data/stop bits: on


    At least one set of the Bank B values is invalid

    baud rate: 9600
    parity: INVALID VALUE (111 -- see above)
    corded frequency: low
    Summagraphics MM or CalComp 2000 commands: use commands
    ESC for 9X00 commands: do not use ESC
    Send data out of proximity: no data out of proximity
    pressure pen data: off
    pen height data: off
    pen tilt data: off
    pen tilt correction: off
    changing tablet to mouse mode: no mouse
    setting proximity high
    CTS line enable on

    -------------------------------------------------------------------------------------

    Can anyone offer a solution or at least some insight?
    Does the calcomp driver need to be fixed?

    I'm not a Linux expert...

    Do I need to manually set something up in /etc/hal and/or /etc/init.d or anywhere other than /etc/X11/xorg.conf? If so, please point me in the right direction!

    Many thanks,
    paulhelf

    #2
    Re: Configure Calcomp DrawingBoard III digitizing board as XInput device

    Howdy again, folks:

    Having not heard a peep from anyone in three weeks, I have continued on my own floundering adventure to progess on this issue, albeit slowly. I might have the problem almost licked, but I think I still would benefit from guidance with the next steps for successfully setting the DrawingBoard III to the active pointing device.

    What I need help with will be clear at the end of this report.

    ----------------------------------------------

    Here are the latest details, successes and failures:

    1) I temporarily moved the digitizing board to an identical PC running Kubuntu 8.04 and confirmed that
    the timeout issue is the same. I also had serendipitously over time installed a bunch of
    libraries that are needed for compiling the calcomp driver from scratch in Kubuntu 8.04. These libraries are not currently on my Kubuntu 8.10 test machine...I started putting them there and got stuck on "xorg-server" (apt-get couldn't find the package).

    2) I downloaded

    http://xorg.freedesktop.org/archive/...p-1.1.0.tar.gz

    and

    http://xorg.freedesktop.org/archive/...p-1.1.2.tar.gz

    and unpacked them separately. I was having trouble setting up xorg-server libraries needed to
    compile version 1.1.2, but I was able to compile version 1.1.0 after transferring a bug fix (see
    http://bugs.gentoo.org/204639) in version 1.1.2 to the 1.1.0 version of xf86Calcomp.c.

    3) Not only am I not a LINUX expert, I don't know how to program in C, either (...I'm mostly an
    end-user without funds to pay a professional programmer for help)....so I took my best guess that
    the main issue truly was a timeout problem and I searched through xf86Calcomp.c for something
    interesting to mangle.

    On line 787 of xf86-input-calcomp/src/xf86Calcomp.c is

    int retries = 5;

    which I changed to

    int retries = 100;

    I successfully recompiled and copied

    xf86-input-calcomp/src/.libs/calcomp_drv.so

    to

    /usr/lib/xorg/modules/input/calcomp_drv.so


    4) I restarted X with new and wonderful results:

    a) Now, /var/log/Xorg.0.log reports some good news:

    ---- snip-snip --------------
    ,
    .
    .
    (II) Calcomp SetupProc called
    (**) Option "Device" "/dev/ttyS0"
    (II) CALCOMP driver: Serial device opened
    (**) Option "MinX" "00000"
    (**) Option "MaxX" "36000"
    (**) Option "MinY" "00000"
    (**) Option "MaxY" "24000"
    (II) options read MaxX=36000, MaxY=24000
    (II) Calcomp firmware ID : 70130C 09/18/91 16906-3
    (II) Product ID : CalComp 3300
    (II) Tablet size : 36000 x 7616
    (II) Calcomp tablet queried OK
    (**) Option "DeviceName" "TABLET"
    (**) Calcomp device name is TABLET
    (II) Calcomp base setup finished
    .
    .
    .
    (II) evaluating device (TABLET)
    (II) XINPUT: Adding extended input device "TABLET" (type: TABLET)


    -------------------------------

    5) More news (good and bad):

    "xinput --list TABLET" gives

    "TABLET" id=3 [XExtensionPointer]
    Num_buttons is 1
    Num_axes is 3
    Mode is Absolute
    Motion_buffer is 0
    Axis 0 :
    Min_value is 0
    Max_value is 36000
    Resolution is 39400
    Axis 1 :
    Min_value is 0
    Max_value is 7616
    Resolution is 39400
    Axis 2 :
    Min_value is 0
    Max_value is 32
    Resolution is 32


    ----------------------------------
    The good news is that xinput seems to at least see the device.
    The bad news is that some of the attributes are wrong (for example,
    on Axis 1, the Max_value should be 24000, not 7616 and the Num_buttons should
    probably be 16 for the 16-button puck, not 1. I'm hopeful that these discrepancies can be easily corrected.


    6) Bad news: "xinput set-pointer TABLET" fails:

    X Error of failed request: BadDevice, invalid or uninitialized input device
    Major opcode of failed request: 146 (XInputExtension)
    Minor opcode of failed request: 12 (X_ChangePointerDevice)
    Serial number of failed request: 12
    Current serial number in output stream: 12

    ---------------------------------------------------------------

    OK... I'll continue to hammer at this, but I'm on the XInput and xorg.conf learning curve
    and I'd be grateful for any advice that might expedite my progress so that I don't spend another
    three weeks just trying to get to the point where I can start using the hardware.

    What I need help with is

    1) Overcoming the "X Error" reported in item (6) so that I can successfully use "xinput set-pointer TABLET".

    2) Configuring the correct hardware attributes (probably via some combination of xorg.conf,
    xinput, and manual keys on the DrawingBoard III hardware configuration banks)


    Thanks for your ear,
    Paul H.

    Comment


      #3
      Re: Configure Calcomp DrawingBoard III digitizing board as XInput device

      Howdy yet again,

      It seems from the output of "xinput list TABLET" (see my previous reply to this thread) that the driver
      is reading or manipulating some bits from the device OK, but not others.

      I was able to "hardwire" the driver to report

      a) that there are 16 buttons on the mouse (not 1 button)
      b) that the AXIS 1 maximum dimension on the digitizing board is 24000 (not 7616)
      c) that the board resolution is 1000 lpi (not 39400) in both AXIS 0 and AXIS 1

      Unfortunately, these configuration data should not have to be hardwired into the driver. The driver really should be fixed by a proper programmer to determine and correctly report these from initilization data read from and/or written to the digitizing hardware itself and xorg.conf input options.

      Additional Details:

      DETAIL 1) NUMBER OF BUTTONS reported: Since the number of buttons is NOT a driver option
      (like for the "mouse" driver), I didn't see an obvious way to set them [myself] except to continue to
      mangle the calcomp driver. (If I knew how to write C programs, I'd add an xorg.conf option so the user
      can set the number of buttons.)


      On line 297 of xf86Calcomp.c, I changed
      if (InitButtonClassDeviceStruct (dev, 1, map) == FALSE)

      to

      if (InitButtonClassDeviceStruct (dev, 16, map) == FALSE)

      DETAIL 2) RESOLUTION reported: I changed lines 319 to 326 from

      InitValuatorAxisStruct (dev, 0, priv->min_x, priv->max_x,
      39400,
      0 /* min_res */ ,
      12000 /* max_res */ );
      InitValuatorAxisStruct (dev, 1, priv->min_y, priv->max_y,
      39400,
      0 /* min_res */ ,
      39400 /* max_res */ );


      to

      InitValuatorAxisStruct (dev, 0, priv->min_x, priv->max_x,
      1000,
      0 /* min_res */ ,
      1000 /* max_res */ );
      InitValuatorAxisStruct (dev, 1, priv->min_y, priv->max_y,
      1000,
      0 /* min_res */ ,
      1000 /* max_res */ );


      DETAIL 3) AXIS 1 BOARD LIMIT: I changed line 608 from

      priv->max_y = (int)buffer[5] + ((int)buffer[4] << 7);
      to

      /* priv->max_y = (int)buffer[5] + ((int)buffer[4] << 7); */
      priv->max_y = 24000;



      DETAIL 4) After restarting X, "xinput list TABLET" now gives:

      "TABLET" id=3 [XExtensionPointer]
      Num_buttons is 16
      Num_axes is 3
      Mode is Absolute
      Motion_buffer is 0
      Axis 0 :
      Min_value is 0
      Max_value is 36000
      Resolution is 1000
      Axis 1 :
      Min_value is 0
      Max_value is 24000
      Resolution is 1000
      Axis 2 :
      Min_value is 0
      Max_value is 32
      Resolution is 32



      DETAIL 5) Further testing of the driver output with "xinput query-state TABLET"

      a) When I place the 16-button puck at an arbitrary position on the digitizing board,
      the driver correctly reports the position (in the "valuator" variables). For example

      2 classes :
      ButtonClass
      button[1]=up
      button[2]=up
      button[3]=up
      button[4]=up
      button[5]=up
      button[6]=up
      button[7]=up
      button[8]=up
      button[9]=up
      button[10]=up
      button[11]=up
      button[12]=up
      button[13]=up
      button[14]=up
      button[15]=up
      button[16]=up
      ValuatorClass Mode=Absolute Proximity=In
      valuator[0]=30473
      valuator[1]=21813
      valuator[2]=0


      b) Holding button "0" down on the puck produces the following change in the output
      of "xinput query-state TABLET":

      button[1]=down

      c) Holding any of buttons "4", "8", or "C" down on the puck produces the same change in the output
      from "xinput query-state TABLET":

      button[8]=down

      d) Holding any of the other buttons down on the puck produces *no* change in the output from
      "xinput query-state TABLET".



      DETAIL 6: "xinput set-pointer TABLET" still produces

      X Error of failed request: BadDevice, invalid or uninitialized input device
      Major opcode of failed request: 146 (XInputExtension)
      Minor opcode of failed request: 12 (X_ChangePointerDevice)
      Serial number of failed request: 12
      Current serial number in output stream: 12


      Helpful suggestions would be welcome....

      Thanks,
      Paul H.

      Comment


        #4
        Re: Configure Calcomp DrawingBoard III digitizing board as XInput device

        More success....

        1) In spite of my only being an old FORTRAN user and not knowing C language, I managed to figure out the correct change in xf86Calcomp.c to fix the erroneously computed max_y values in Axis 1 (see "Detail 3" of my previous self-reply) -- that is, a fix that doesn't require hardwiring the max_y limit to 24000 for my hardware:

        Instead of the "hardwire" change to xf86Calcomp.c from the aforementioned "Detail 3", change line 608 from

        priv->max_y = (int)buffer[5] + ((int)buffer[4] << 7);
        to

        priv->max_y = (int)buffer[5] + ((int)buffer[4] << 7)
        + (((int)buffer[3]&0x03)<<14);


        [shadow=red,left]This is a real bug fix. The continuation of line 608 is evidently missing from xf86Calcomp.c for aeons in the master source release (xf86-input-calcomp-master) from X.org, version 1.1.2, as well as version 1.1.0. I tested the change above and it correctly reports the y_max size of 24000 on my Calcomp 34360 DrawingBoard III without my having to hardwire the number in the driver.

        2) Although "xinput set-pointer TABLET" still fails, I was able use

        xsetpointer +c TABLET

        to get the digitizing board to move the on-screen cursor and correctly respond when "button[1]" on the puck is pushed down. The on-screen dimensions were properly scaled to the digitizing board dimensions so that when I placed the puck in each active corner of the digitizing board, the cursor would move to the correct corner of the display.


        3) I was able to use

        xinput set-button-map "TABLET" 1 2 4 3 5 6 7 8 9 10 11 12 13 14 15 16

        to get all of the cursor buttons to respond with xinput query-state TABLET

        ---------------------------------------------

        This gets me nearly all the way to having a functional X-interface to my digitizing board. I haven't put it through its paces yet (I suspect that there may be some mouse attribute issues that will need to be solved -- for example, I noticed that I can't click and drag a window on the screen the way that I can with a regular three-button-mouse.). If I get this thing to work the way I want it to in Kubuntu 8.04, then the next step will be to see if I can get it working in Kubuntu 8.10.


        If anyone out there is finding this thread useful, please reply.

        I was sniffing around on the XFree86/X.org web sites and it appears that this calcomp driver isn't currently maintained (see http://cgit.freedesktop.org/xorg/dri...alcomp/commit/). I think the reasons that it isn't maintained are that it never worked right to begin with, the maintainers who inherited it didn't have the hardware to test it, and people like me who really could have used it were forced to find workarounds rather than struggling through doing it the right way.

        If the only thing stopping maintainers from fixing this driver is that they don't have hardware on which to test it, I would be happy to test the driver fixes on my board. At present, I don't have a pressure pen (stylus) with my unit, but I do have 16-button pucks (wired and wireless).

        If the case can be made that people need this driver, then perhaps we can persuade the Xorg maintainer guy to resurrect the driver and make it more user-friendly. If I were a C-programmer, I'd offer to maintain it myself...at least as long as I have a Calcomp DrawingBoard III on which to use it.

        Cheers,
        Paul H.


        Comment


          #5
          Re: Configure Calcomp DrawingBoard III digitizing board as XInput device

          Howdy:

          OK...I've moved back to Kubuntu 8.10 and I succeeded at compiling and installing my hacked version of the source code (xf86Calcomp.c) from

          http://cgit.freedesktop.org/xorg/dri...-master.tar.gz

          I'll attach my source file (xf86Calcomp.c.txt) below. I needed to install some libraries to get ./configure to work (notably, pkg-config, x11proto-input-dev, xserver-xorg-dev). As previously noted, "xinput set-pointer TABLET" still fails, but the following works fine:

          xsetpointer +c TABLET
          xinput set-button-map "TABLET" 1 2 4 3 5 6 7 8 9 10 11 12 13 14 15 16


          I've done some simple testing with GIMP and ENGAUGE. I'm hoping it will be fine for GRASS and QGIS.

          About the only thing I need to figure out now is how to get "button [1]" to click-and-drag the way the 3-button mouse does. It isn't a big deal, though, because the 3-button mouse is working at the same time.

          ----

          I filed a bug report (Bug 20871) on http://bugs.freedesktop.org. Since this driver is currently unmaintained, I'm not sure we'll see any action soon. Hopefully, my thread here on the Kubuntu forum will be a useful alternative for any of you who want to use your Calcomp DrawingBoard II or III as an XInput device.

          For anyone interested in cleaning this driver up, it really should have an input option (i.e. via xorg.conf or the corresponding HAL fdi file) to specify the number of buttons on the puck (if "Puck" is selected as an option for the "Cursor" input option). At some point I'll put together an fdi file to bypass the presumably obsolete xorg.conf way of doing things.

          Cheers and good luck!
          Paul Helfenstein
          Attached Files

          Comment

          Working...
          X