Bug 343545

Summary: Wacom Airbrush Wheel support
Product: [Applications] krita Reporter: arturg <var.spool.mail700>
Component: Tablets (tablet issues are only very rarely bugs in Krita!)Assignee: Dmitry Kazakov <dimula73>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73, halla
Priority: NOR    
Version: git master (please specify the git hash!)   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
URL: https://forum.kde.org/viewtopic.php?f=139&t=102364&sid=6252610ee0f451ff638cb4723c18eb86
Latest Commit: Version Fixed In:
Sentry Crash Report:
Attachments: diff file for kis_tablet_support_x11.cpp
Patch for updating Tangential Pressure in Hover Mode
krita tablet debuger log
patched log

Description arturg 2015-01-29 22:20:33 UTC
it seems the Airbrush isnt recognised and the wheel is mapped to the rotation sensor instead of the tangential pressure sensor.

Reproducible: Always
Comment 1 arturg 2015-01-29 22:30:47 UTC
Created attachment 90801 [details]
diff file for kis_tablet_support_x11.cpp

the if block on line 633 doesnt seem to get executed
and even if i make it run you get the behaivior explained in the above link.
you cant just assign the rotation value to the tangentialPressure value
as the tangential pressure curve expects a range from 0.0 - 1.0 and not a range from 0 - 360.
added a workaround and converted it  to a 0.0 - 1.0 range.
Comment 2 arturg 2015-01-30 21:45:57 UTC
about the airbrush detection, it might not be a problem with krita directly the kde tablet settings gui and a qt tablet example i tried didnt recognise it eighter.
the gnome Wacom Tablet settings gui and gimp recognise it.
Comment 3 arturg 2015-02-01 09:09:55 UTC
Created attachment 90849 [details]
Patch for updating Tangential Pressure in Hover Mode
Comment 4 Dmitry Kazakov 2015-02-01 12:40:36 UTC
Hi, varspoolmail!

Should we apply and use both patches, right?
Comment 5 arturg 2015-02-01 17:25:09 UTC
yes works fine for me so far
Comment 6 Dmitry Kazakov 2015-02-02 16:19:44 UTC
Ok, I found out how to recognize this Airbrush. Will make a patch tomorrow.
Comment 7 Dmitry Kazakov 2015-02-03 10:20:09 UTC
Git commit 142b953c4d0f6b197435cfdcf424f88796e57c4c by Dmitry Kazakov.
Committed on 03/02/2015 at 10:18.
Pushed by dkazakov into branch 'calligra/2.9'.

This patch should probably fix Wacom Airbrush devices

This patch adds recognition of the device type on Linux, and tries to
fix the tangential pressure parameter.

If you happen to have an Airbrush device, please do test whether
tangential pressure starts working correctly.

Most probable bug: the range of the tangential pressure might be
wrong, since I don't know in which limits it is linked in the driver.
If you see any problems with it, please generate an event log file
for moving the button in all directions slowly. Here is a manual how
to do that:

https://answers.launchpad.net/krita-ru/+faq/2495

Thanks arturg for providing initial patches!
CCMAIL:kimageshop@kde.org

M  +61   -9    krita/ui/input/wintab/kis_tablet_support_x11.cpp
M  +1    -1    krita/ui/tool/kis_painting_information_builder.cpp

http://commits.kde.org/calligra/142b953c4d0f6b197435cfdcf424f88796e57c4c
Comment 8 Dmitry Kazakov 2015-02-03 13:01:23 UTC
Git commit b6fc8a7ff9d9941ad811710f8139bb51b0d1edf6 by Dmitry Kazakov.
Committed on 03/02/2015 at 13:00.
Pushed by dkazakov into branch 'calligra/2.9'.

Fix recognizing Bamboo stylus

I'm wondering whether these magic values were ever documented by anyone...

M  +29   -22   krita/ui/input/wintab/kis_tablet_support_x11.cpp

http://commits.kde.org/calligra/b6fc8a7ff9d9941ad811710f8139bb51b0d1edf6
Comment 9 arturg 2015-02-04 09:53:40 UTC
Created attachment 90907 [details]
krita tablet debuger log

the Airbrush detection works but the normalization doesnt i tried that before i submited my patch, it results in the same behavior as explained in the forum post but now on the tp value.
check the attached log
Rotation: -900 899

im rotating the wheel from the neutral position 0.5 to the max position 0.5 begining on
line: 1608 neutral position: 0.5
line: 2204 midwheel position: 0.0
line: 2732 maxwheel position: 0.5

then the reverse on
line: 3474 maxwheel postion: 0.5
line: 4335 midwheel position: 0.0
line: 5099 neutralwheel position: 0.5
Comment 10 arturg 2015-02-04 10:30:10 UTC
Created attachment 90908 [details]
patched log

replacing it with the following produces the attached log

if (deviceType == QTabletEvent::RotationStylus) {
        rotation = std::fmod(qreal(tablet->savedAxesData.rotation() - tablet->minRotation) /
                            (tablet->maxRotation - tablet->minRotation) + 0.5, 1.0) * 360;

    } else if (deviceType == QTabletEvent::Airbrush) {
        tangentialPressure = std::fmod(qreal(tablet->savedAxesData.rotation() - tablet->minRotation) /
                                      (tablet->maxRotation - tablet->minRotation) , 2.0);
    } else {
        rotation = 0;
    }

while doing the same rotating from neutral to max position and then  the reverse
Comment 11 Dmitry Kazakov 2015-02-06 06:48:53 UTC
Git commit d2d88be988483c7db437bee072458ba0c73ed9db by Dmitry Kazakov.
Committed on 06/02/2015 at 06:47.
Pushed by dkazakov into branch 'calligra/2.9'.

Fix the formula for calculation of tangential pressure for airbrush stylus

Thanks arturg for provided patch!

(I changed the patch a bit. The rotation is *not* zero'ed for all
 non-RotationStylus devices, because our stylus type recognition code
 is not mature enough, or, more precisely, Wacom device ids are not
 documented enough)

M  +6    -6    krita/ui/input/wintab/kis_tablet_support_x11.cpp

http://commits.kde.org/calligra/d2d88be988483c7db437bee072458ba0c73ed9db
Comment 12 Dmitry Kazakov 2015-02-06 06:50:53 UTC
Hi, var.spool.mail700!

Could you please test updated version? I applied your patch almost exactly, with exception that we don't reset rotation to zero for other stylus types, since the stylus type recognition code is a bit weak, since device ids are not documented enough.
Comment 13 arturg 2015-02-06 12:14:03 UTC
works fine for me thanks.
Comment 14 Halla Rempt 2015-02-06 15:18:56 UTC
Git commit 75c0e838fafb76e3f3b1ffe6435af9e93c9f19e7 by Boudewijn Rempt, on behalf of Dmitry Kazakov.
Committed on 06/02/2015 at 06:47.
Pushed by rempt into branch 'master'.

Fix the formula for calculation of tangential pressure for airbrush stylus

Thanks arturg for provided patch!

(I changed the patch a bit. The rotation is *not* zero'ed for all
 non-RotationStylus devices, because our stylus type recognition code
 is not mature enough, or, more precisely, Wacom device ids are not
 documented enough)

M  +6    -6    krita/ui/input/wintab/kis_tablet_support_x11.cpp

http://commits.kde.org/calligra/75c0e838fafb76e3f3b1ffe6435af9e93c9f19e7