Skip to content

Commit d5a2627

Browse files
authored
Merge pull request #1 from Kuuuube/backport_deco_xlw
Backport deco xlw
2 parents 3329d69 + 5c237a1 commit d5a2627

File tree

5 files changed

+174
-0
lines changed

5 files changed

+174
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"Name": "XP-Pen Artist Pro 16 (Gen2)",
3+
"Specifications": {
4+
"Digitizer": {
5+
"Width": 344.68,
6+
"Height": 215.42,
7+
"MaxX": 68920,
8+
"MaxY": 43078
9+
},
10+
"Pen": {
11+
"MaxPressure": 16383,
12+
"Buttons": {
13+
"ButtonCount": 2
14+
}
15+
},
16+
"AuxiliaryButtons": null,
17+
"MouseButtons": null,
18+
"Touch": null
19+
},
20+
"DigitizerIdentifiers": [
21+
{
22+
"VendorID": 10429,
23+
"ProductID": 2395,
24+
"InputReportLength": 14,
25+
"OutputReportLength": 14,
26+
"ReportParser": "OpenTabletDriver.Configurations.Parsers.XP_Pen.XP_PenGen2ReportParser",
27+
"FeatureInitReport": null,
28+
"OutputInitReport": [
29+
"ArAE"
30+
],
31+
"DeviceStrings": {},
32+
"InitializationStrings": []
33+
}
34+
],
35+
"AuxilaryDeviceIdentifiers": [],
36+
"Attributes": {
37+
"libinputoverride": "1"
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"Name": "XP-Pen Deco Pro LW Gen2",
3+
"Specifications": {
4+
"Digitizer": {
5+
"Width": 278.99,
6+
"Height": 173.99,
7+
"MaxX": 55798,
8+
"MaxY": 34798
9+
},
10+
"Pen": {
11+
"MaxPressure": 16383,
12+
"Buttons": {
13+
"ButtonCount": 2
14+
}
15+
},
16+
"AuxiliaryButtons": null,
17+
"MouseButtons": null,
18+
"Touch": null
19+
},
20+
"DigitizerIdentifiers": [
21+
{
22+
"VendorID": 10429,
23+
"ProductID": 2371,
24+
"InputReportLength": 14,
25+
"OutputReportLength": 14,
26+
"ReportParser": "OpenTabletDriver.Configurations.Parsers.XP_Pen.XP_PenGen2ReportParser",
27+
"FeatureInitReport": null,
28+
"OutputInitReport": [
29+
"ArAE"
30+
],
31+
"DeviceStrings": {},
32+
"InitializationStrings": []
33+
}
34+
],
35+
"AuxilaryDeviceIdentifiers": [],
36+
"Attributes": {
37+
"libinputoverride": "1"
38+
}
39+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"Name": "XP-Pen Deco Pro XLW Gen2",
3+
"Specifications": {
4+
"Digitizer": {
5+
"Width": 381,
6+
"Height": 229.005,
7+
"MaxX": 76200,
8+
"MaxY": 45801
9+
},
10+
"Pen": {
11+
"MaxPressure": 16383,
12+
"Buttons": {
13+
"ButtonCount": 2
14+
}
15+
},
16+
"AuxiliaryButtons": null,
17+
"MouseButtons": null,
18+
"Touch": null
19+
},
20+
"DigitizerIdentifiers": [
21+
{
22+
"VendorID": 10429,
23+
"ProductID": 2372,
24+
"InputReportLength": 14,
25+
"OutputReportLength": 14,
26+
"ReportParser": "OpenTabletDriver.Configurations.Parsers.XP_Pen.XP_PenGen2ReportParser",
27+
"FeatureInitReport": null,
28+
"OutputInitReport": [
29+
"ArAE"
30+
],
31+
"DeviceStrings": {},
32+
"InitializationStrings": []
33+
}
34+
],
35+
"AuxilaryDeviceIdentifiers": [],
36+
"Attributes": {
37+
"libinputoverride": "1"
38+
}
39+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using OpenTabletDriver.Plugin.Tablet;
2+
3+
namespace OpenTabletDriver.Configurations.Parsers.XP_Pen
4+
{
5+
public class XP_PenGen2ReportParser : IReportParser<IDeviceReport>
6+
{
7+
public IDeviceReport Parse(byte[] report)
8+
{
9+
if (report[1] == 0xC0)
10+
return new OutOfRangeReport(report);
11+
if ((report[1] & 0xF0) == 0xA0)
12+
return new XP_PenTabletGen2Report(report);
13+
return new DeviceReport(report);
14+
}
15+
}
16+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
using System.Numerics;
2+
using System.Runtime.CompilerServices;
3+
using OpenTabletDriver.Plugin.Tablet;
4+
5+
namespace OpenTabletDriver.Configurations.Parsers.XP_Pen
6+
{
7+
public struct XP_PenTabletGen2Report : ITabletReport, ITiltReport, IEraserReport
8+
{
9+
public XP_PenTabletGen2Report(byte[] report)
10+
{
11+
Raw = report;
12+
13+
Position = new Vector2
14+
{
15+
X = Unsafe.ReadUnaligned<ushort>(ref report[2]) | report[10] << 16,
16+
Y = Unsafe.ReadUnaligned<ushort>(ref report[4]) | report[11] << 16
17+
};
18+
Pressure = (uint)((Unsafe.ReadUnaligned<ushort>(ref report[6]) - 16384) | (report[13] & 0x01) << 13);
19+
Eraser = report[1].IsBitSet(3);
20+
21+
PenButtons = new bool[]
22+
{
23+
report[1].IsBitSet(1),
24+
report[1].IsBitSet(2)
25+
};
26+
27+
Tilt = new Vector2
28+
{
29+
X = (sbyte)report[8],
30+
Y = (sbyte)report[9]
31+
};
32+
}
33+
34+
public byte[] Raw { set; get; }
35+
public Vector2 Position { set; get; }
36+
public uint Pressure { set; get; }
37+
public bool[] PenButtons { set; get; }
38+
public Vector2 Tilt { set; get; }
39+
public bool Eraser { set; get; }
40+
}
41+
}

0 commit comments

Comments
 (0)