Graphics tablet
Rick Murray (539) 13840 posts |
I bought myself a graphics tablet – a Braun Tavla 5 (rebadged UC-Logic WP5540U (Genuis Mousepen)). Connected to RISC OS, it appears to behave as a mouse until something else opens the USB port (at which point RISC OS stops paying attention – this may be useful to override the default behaviour). The protocol seems quite simple. There are between six and eight bytes returned per event. Events come in as necessary, and when in use could be around 35-45 per second; the box suggests up to 125pps. The first byte is &09. Note that if a lot of rapid work is being done, it is possible that DeviceFS may receive and buffer multiple requests and return them together, so this can be used to synchronise. The second byte appears to be the button press, with &00 being nothing, &01 being Select (tip), &02 being Adjust (lower pen barrel button) and &04 being Menu (upper pen barrel button). It is possible to have a barrel button (either) and tip at the same time, but it doesn’t appear possible to have all three active at once. I don’t know if the protocol doesn’t permit this – it seems possible to active both barrel buttons at once but the result is &00, however interestingly if I activate both barrel buttons and press the tip, the result is &02 – so this may be a hardware bug? The third and fourth bytes give the horizontal position from left to right. The third byte is the minor position (changes a lot), and the fourth byte is the major position. Extreme left is &00 &00 and extreme right is &E3 &7F (which means the span is 0-32739, or a little over 2000 per centimetre (!)). The fifth and sixth bytes are the vertical position from TOP to bottom. As before, the fifth is the minor and the sixth is the major. Extreme TOP is &00 &00 (note, top left is 0,0) and extreme bottom is &E9 &7F (span 0-32745, or 2700 per centimetre). [in reality, it is unlikely that the array would be different in each dimension, plus it is unlikely to have such a high resolution – the box implies 2000 points per inch] The seventh and eighth bytes, if they are present (they usually are) is for the pen pressure. The seventh byte is the minor pressure, and it is quite a bit more sensitive than drawing programs on the PC would imply. The eighth byte is the major pressure. Pressure is only reported if the barrel buttons are not being pressed. No pressure is &00 &00 and maximum pressure is &FF &03 (span 0-1023). My normal writing would seem to be around &5F. The following program will dump the raw data:
I don’t think it would be too hard to cobble together a program to fake the mouse pointer position, however I am not sure how to pass on the pressure level to RISC OS. It seems some programs (ArtWorks? PhotoDesk?) can work with pressure sensitive tablets, however I have no details on how this mechanism works. Unfortunately RISC OS’s mouse handling (in or out of the Wimp) has never been expanded beyond “pointer and buttons” (witness the hacks re. scroll wheel). Why do what RISC OS can already do? Well, for a start RISC OS uses the entire size of the digitiser surface. The delineated inner area is smaller (the box says 5" by 4") which goes from &077F,&0D35 (upper left) to &737E,&75CE (lower right) with sixteen marked out “hotspots” around the edge, although obviously the exact position will depend upon which version of the tablet this is (the Braun one is laid out slightly differently to the UC-Logic original). At any rate, it might be nice to map hotspots to keypresses, like “Undo”. ;-) |
Raik (463) 2061 posts |
I’m in holiday. But at home I have the old tripad software for a Robotron (Summergrafics bitpad one) tablet. Driver, macro recorder and so on. Not sure but I think the source is inside… |
Raik (463) 2061 posts |
First steps with the old hard- and software on ARMX6. The driver module works only with Aemulor. Other problem is my board. I have a early Revision of the board with a wiring bug. I hope I find the time to fix.
|
Rick Murray (539) 13840 posts |
Raik – does the driver have anything (stronghelp file?) to describe its API? It would be most logical to create a driver for my tablet (and maybe others?) using an API already known to RISC OS. |
Raik (463) 2061 posts |
I mean yes (txt and Impression and paper) but only in German. Edit: Take a look at your heyrick1973 mailbox. |
Andrew Rawnsley (492) 1445 posts |
Makes me wonder if I still have the stuff for our “PadDriver” stuff which did a range of non-pressure tablets. I think it was a sumagraphics thing too, but covered quite a few different tablets. I recall that it had special code in to handle some decidedly odd things that various RISC OS apps (eg. Artworks) did with co-ordinates. If there’s interest, let me know. I’m not sure what happened to the author though (he did Copernicus and a few other things). |
Rick Murray (539) 13840 posts |
Possibly interested. I seem to recall some software (Photodesk?) works with a tablet driver (Eesox?). I’d like to find out if the API for that is known/documented. A Google search didn’t turn up anything.
While this could be problematic for me (don’t have ArtWorks), I can imagine there could be issues with a device that is capable of hopping around the workspace with no movement from here to there. |
Raik (463) 2061 posts |
With my A5000/Risc PC I use the tripad with CAD and Photodesk and the Mouse is aviable at the same time. |
Chris Evans (457) 1614 posts |
I think we may have the sources to the PaintPal driver |
Raik (463) 2061 posts |
On step forward… Thanks to Willi Theiss. |
Chris Evans (457) 1614 posts |
Raik & Rick: Any progress? n.b. I do have the 32bit sources to: |
Rick Murray (539) 13840 posts |
I’ve done nothing with this. Can you send me any sources you have, please. I think it’ll be fairly simple to fake mouse position, but what’s the API for passing pen pressure to an app? |
Chris Evans (457) 1614 posts |
I’ll have to remind myself what rights I have to the sources. |
Rick Murray (539) 13840 posts |
Another issue is the lack of anything to test with – PhotoDesk does not natively support pressure, it needs something added. The only other software I’m aware of that might support pressure is ArtWorks, and I don’t have that. It’s a shame there is no public API document for such things. Though, to be honest, I think PointerV (or however one wishes to implement it) needs a huge overhaul to account for the various “pointer” options that are not a simple three-button mouse… |
Raik (463) 2061 posts |
All this things are not a problem with the tripad driver. With my A5000 I use it with WorraCAD, a earlier Version Photodesk. It has a “three-button-support” and it allowed to use both (mouse and tablet) at the same time. |
Michael Emerton (483) 136 posts |
This sounds a great idea, even if it is for my own selfish requirements :@) If it were accessible from outside the WIMP, then I’d love to put something like pressure sensitivity into my app…soft or hard detection to chose scrolling speed? Also ability to use scroll wheel outside the WIMP would be good…still can’t work out why there is no non-WIMP interface for that after all these years of wheel mice. |
Rick Murray (539) 13840 posts |
Nobody ever devised a new API. We can’t use OS_Mouse as adding extra registers would break older apps. The ROLtd method was a bit of a bodge (magic values for extra info) but the ROOL method is worse. ;-) I think we ought to devise a new SWI, OS_PointerPosition before anything else. Must support touch and pressure and multi point and relative/absolute positions… |
Andrew Daniel (376) 76 posts |
And I thought I was the last person on earth using WorraCAD still. |
Sprow (202) 1158 posts |
Also ability to use scroll wheel outside the WIMP would be good…still can’t work out why there is no non-WIMP interface for that after all these years of wheel mice. There was a bounty set up for just such an activity, but looking through the internet archive it looks like it attracted a sum total of zero pounds and zero pence. The overview of tasks involved in the bounty suggests it’s pretty involved – requiring touching the USB driver, kernel, and Wimp. I don’t know what the criteria are for reopening bounties (there’s no precedent), so for now it’s snoozing on the roadmap. |
Rick Murray (539) 13840 posts |
Not quite. That bounty looks like it was simply for “sanely” implementing scrollwheel support. That said, the current manky incarnation more or less works as it is, so long as nobody actually looks at what the code is doing to do that ;-) – so it probably didn’t figure on anybody’s wish list. What I’m suggesting is to relegate PointerV and OS_Mouse to legacy status, and devise something that is capable of dealing better with non-mouse pointing devices. We ought to be able to leave the Mouse_Click poll event intact, as there shouldn’t be any problem trashing a bit more of the block passed to the Wimp. A program cannot predict future poll events, so all 256 bytes of the block may be used to pass additional information which will remain invisible to older programs. Thinking aloud now…
Note that (potentially scroll wheel excepted) there is no requirement for the Wimp to actually do anything with this information. The important part is it being available. Rather like the situation with the multimedia keys on modern keyboards – they can’t be used by programs (such as DigitalCD) because there is no mechanism for getting that information into a task-visible form.
There’s the problem, though. I gave a short program (up towards the top) that will provide you with a co-ordinate, a button press, and a pressure. You could do something similar yourself, but wouldn’t it be better to have a consistent system-wide API for this sort of stuff? |
Rick Murray (539) 13840 posts |
Just threw this together in preference to doing “real” coding. Too tired to concentrate on stuff like that tonight…
|