Adding wacom tablet support to sdl

Hello,

I’m interested in having support for wacom pen tablets directly built into
SDL. I did a couple of searches, and it appears that this issue popped up a
couple of times in the past, but nothing happened at the end.

I’m completely new to SDL development, but I’d be willing to start working
in this project (whishful thinking perhaps). I’d also like to know if
someone has done something related to this problem (to avoid reinventing the
wheel twice), and, from the experts, to get some estimation on the
difficulty of the project and general recommendations as to where to start
looking in the code.

Many thanks in advance.

In article <43e577b10610041600k4695a581o9402029fafd905a0 at mail.gmail.com>,
acbreton at gmail.com says…

I’m interested in having support for wacom pen tablets directly built into
SDL. I did a couple of searches, and it appears that this issue popped up a
couple of times in the past, but nothing happened at the end.

Interesting. My kid has a Wacom tablet, and I never though that it could be
useful for doing SDL-fun-stuff.

I found the Wacom Developers FAQ quite informative…

http://www.wacomeng.com/devsupport/ibmpc/wacomwindevfaq.html

Some interesting points to note from the FAQ…

There is very little you must do to support virtually all Wacom’s tablet
models … Once you have added Wintab support for one tablet, your program
should work with virtually any Wacom tablets.

Except for a few features, your code should also work without change with
other tablet manufacturer’s tablets too, if they use Wintab.

Wintab is the industry standard for acquiring data from a graphics tablet on
Intel machines and has been the standard for a number of years.

***—> Unfortunately, there is no cross-platform graphics tablet API.

So, it appears that tablet support (in general, not just Wacom) is a
cake-walk for Win32 platforms, as there is a standard API. Other platforms
may be challenging or perhaps impossible, as it depends on how much low-level
information Wacom (or other tablet makers) provide. Also, once you leave the
Win32 platform, you’ll probably have to consider writing device drivers to
support a tablet, unless such a driver has already been written for the
target platform.

Doug.

Actually, under X11 the API for acquiring tablet information is also
quite standard, just like under Windows. Ditto for OS X (at least for
Cocoa).

The Linux Wacom drivers are a bitch to get to work (I own a Wacom
Graphire2 tablet that is sitting on my desk as I am typing this), but
once they do, apps simply have to fetch the right information from
Xinput.

Both GTK+ and Qt already have built-in tablet APIs that do the right
thing depending on the platform. Adding tablet support to SDL should
be fairly easy, seeing Qt already does it under Windows, OS X and X11.On 10/5/06, Doug wrote:

So, it appears that tablet support (in general, not just Wacom) is a
cake-walk for Win32 platforms, as there is a standard API. Other platforms
may be challenging or perhaps impossible, as it depends on how much low-level
information Wacom (or other tablet makers) provide. Also, once you leave the
Win32 platform, you’ll probably have to consider writing device drivers to
support a tablet, unless such a driver has already been written for the
target platform.

  • SR

It’s very easy to support tablets (in general) in Linux using the evdev
interface. Unfortunately just supporting evdev isn’t enough, since Xorg
might lock evdev, depending on version and configuration. So, you need
to support the X driver as well. I haven’t looked into that yet, but
it’s been on my todo list for a while. (A long while, to be honest, but
I’ll do it one of these days …).

I’ve no idea how to support tablets on a Mac, but I’d be surprised if
there wasn’t some API available.

Anyway, I too am very interested in cross-platform tablet support,
preferably for SDL, but otherwise too. I’d be willing to help out with
at least the Linux side of things.

~ GerryOn Fri, 06 Oct 2006 02:06:19 +0200, Doug wrote:

So, it appears that tablet support (in general, not just Wacom) is a
cake-walk for Win32 platforms, as there is a standard API. Other
platforms […]

Anyway, I too am very interested in cross-platform tablet support,
preferably for SDL, but otherwise too. I’d be willing to help out with
at least the Linux side of things.

My understanding is that this is all planned for 1.3, when we start
focusing on multiple input devices. If it doesn’t go into SDL 1.3, it’ll
go into ManyMouse (which is still pretty much spinning until x.org gets
the next-gen XInput extension worked out).

–ryan.

Hi,

Many thanks for all the info. I already have some test programs to acces the
tablet from windows and linux… not entirely functional but a good starting
point anyways. The next step would be to learn how to include this into
sdl… but it seems that sdl 1.3 will be the answer (which is great, of
course)!

Can anyone confirm that tablet support will be incorporated into 1.3? Is
there any code to play with on svn?

Ryan C. Gordon wrote:

Anyway, I too am very interested in cross-platform tablet support,
preferably for SDL, but otherwise too. I’d be willing to help out with
at least the Linux side of things.

My understanding is that this is all planned for 1.3, when we start
focusing on multiple input devices. If it doesn’t go into SDL 1.3, it’ll
go into ManyMouse (which is still pretty much spinning until x.org gets
the next-gen XInput extension worked out).

–ryan._______________________________________________
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

This thread piqued my curiosity. About 20 years ago I had to interface a
wacom tablet to a Sun workstation. At that time wacom was perfectly open
with the interface specification. The manual had details of the byte
stream the device emitted and the command codes needed to command the
device. When I started the project I thought I would have to write a
device driver, but it turned out all I needed was a little code that
used the existing serial driver. A project that was scheduled to take
over a month took only a couple of days. :slight_smile:

So, I have a couple of questions. Is wacom not providing interface
information now days? How is the device connected, USB, serial port,
mouse port,… what? Just curiosity. I really liked the wacom tablets.
High precision, good repeatability, easy to program for.

	Bob PendletonOn Thu, 2006-10-05 at 17:06 -0700, Doug wrote:

In article <43e577b10610041600k4695a581o9402029fafd905a0 at mail.gmail.com>,
acbreton at gmail.com says…

I’m interested in having support for wacom pen tablets directly built into
SDL. I did a couple of searches, and it appears that this issue popped up a
couple of times in the past, but nothing happened at the end.

Interesting. My kid has a Wacom tablet, and I never though that it could be
useful for doing SDL-fun-stuff.

I found the Wacom Developers FAQ quite informative…

http://www.wacomeng.com/devsupport/ibmpc/wacomwindevfaq.html

Some interesting points to note from the FAQ…

There is very little you must do to support virtually all Wacom’s tablet
models … Once you have added Wintab support for one tablet, your program
should work with virtually any Wacom tablets.

Except for a few features, your code should also work without change with
other tablet manufacturer’s tablets too, if they use Wintab.

Wintab is the industry standard for acquiring data from a graphics tablet on
Intel machines and has been the standard for a number of years.

***—> Unfortunately, there is no cross-platform graphics tablet API.

So, it appears that tablet support (in general, not just Wacom) is a
cake-walk for Win32 platforms, as there is a standard API. Other platforms
may be challenging or perhaps impossible, as it depends on how much low-level
information Wacom (or other tablet makers) provide. Also, once you leave the
Win32 platform, you’ll probably have to consider writing device drivers to
support a tablet, unless such a driver has already been written for the
target platform.

Doug.


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


±-------------------------------------+

So, I have a couple of questions. Is wacom not providing interface
information now days? How is the device connected, USB, serial port,
mouse port,… what? Just curiosity. I really liked the wacom tablets.
High precision, good repeatability, easy to program for.

They either use the standard USB HID protocol, or there’s a custom Linux
driver for it…my cheap consumer-level Wacom tablet works fine on Linux
as an evdev mouse device (has for years), and others have reported
success with all the tilt and pressure stuff with The Gimp using XInput.

X11 itself doesn’t expose the tablet-specific functionality (tilt, etc)
outside the XInput extension, and XInput doesn’t support hotplugging
(x.org is extending XInput to handle that, though:

http://xorg.freedesktop.org/wiki/XInputHotplug

–ryan.

I have recently finished doing this for an app I am working on…
It is reasonably easy if not that straight forward…

There is a header file called SDL_syswm.h

This has functions necessary to access events from the underlying
windowing system… Which means you have to use xlib to initiliase
the tablet and get the input…

http://www.bolthole.com/solaris/drivers/xopen.c
is the only example I can find in the wild.

There are several things you must then do

  1. enable WM events that SDL does not understand code should look like this…

SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if (( SDL_GetWMInfo(&info) == -1))
{printf(“could not get WM Info: %s.\n”, SDL_GetError()); use_tablet = 0;}

SDL_EventState(SDL_SYSWMEVENT,SDL_ENABLE);

  1. you can now receive wacom events via the SDL_SYSWMEVENT event

remember to use the lock and unlock functions while initialising the Tablet.

Hope that is enough to get you started feel free to ask further questions

So has anyone looked into actually adding drawing tablet (i.e., Wacom)
support to libSDL at this point? For X11 or otherwise?

Currently, Tux Paint works great with Wacom pad, Tablet PC running WinXP,
etc. It’s just that there’s no pressure support (since it’s only acting
as a regular mouse), and no erase support (since it’s only acting as a
mouse).

Thanks :slight_smile:

-bill!

(Keeping the rest for context, since it’s been ~4 months)On Sat, Nov 04, 2006 at 12:15:26PM +1100, Danni Coy wrote:

I have recently finished doing this for an app I am working on…
It is reasonably easy if not that straight forward…

There is a header file called SDL_syswm.h

This has functions necessary to access events from the underlying
windowing system… Which means you have to use xlib to initiliase
the tablet and get the input…

http://www.bolthole.com/solaris/drivers/xopen.c
is the only example I can find in the wild.

There are several things you must then do

  1. enable WM events that SDL does not understand code should look like this…

SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if (( SDL_GetWMInfo(&info) == -1))
{printf(“could not get WM Info: %s.\n”, SDL_GetError()); use_tablet = 0;}

SDL_EventState(SDL_SYSWMEVENT,SDL_ENABLE);

  1. you can now receive wacom events via the SDL_SYSWMEVENT event

remember to use the lock and unlock functions while initialising the Tablet.

Hope that is enough to get you started feel free to ask further questions


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl


-bill!
bill at newbreedsoftware.com
http://www.newbreedsoftware.com/