1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249
|
/*
Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 2020-2022 Collabora Ltd.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely.
*/
/* Hack #1: avoid inclusion of SDL_main.h by SDL_internal.h */
#define SDL_main_h_
/* Hack #2: avoid dynapi renaming (must be done before #include <SDL3/SDL.h>) */
#include "../src/dynapi/SDL_dynapi.h"
#ifdef SDL_DYNAMIC_API
#undef SDL_DYNAMIC_API
#endif
#define SDL_DYNAMIC_API 0
#ifdef HAVE_BUILD_CONFIG
#include "../src/SDL_internal.h"
#endif
/* Hack #3: undo Hack #1 */
#ifdef SDL_main_h_
#undef SDL_main_h_
#endif
#ifdef SDL_MAIN_NOIMPL
#undef SDL_MAIN_NOIMPL
#endif
#include <SDL3/SDL.h>
#include <SDL3/SDL_main.h>
#include <SDL3/SDL_test.h>
#include <stdio.h>
#include <string.h>
static int run_test(void);
/* FIXME: Need CMake tests for this */
#if (defined(HAVE_LIBUDEV_H) || defined(SDL_JOYSTICK_LINUX)) && defined(HAVE_LINUX_INPUT_H)
#include <stdint.h>
#include "../src/core/linux/SDL_evdev_capabilities.h"
#include "../src/core/linux/SDL_evdev_capabilities.c"
static const struct
{
int code;
const char *name;
} device_classes[] = {
#define CLS(x) \
{ \
SDL_UDEV_DEVICE_##x, #x \
}
CLS(MOUSE),
CLS(KEYBOARD),
CLS(HAS_KEYS),
CLS(JOYSTICK),
CLS(SOUND),
CLS(TOUCHSCREEN),
CLS(ACCELEROMETER),
CLS(TOUCHPAD),
#undef CLS
{ 0, NULL }
};
typedef struct
{
const char *name;
const char *eviocgname;
const char *usb_vendor_name;
const char *usb_product_name;
uint16_t bus_type;
uint16_t vendor_id;
uint16_t product_id;
uint16_t version;
uint16_t usb_device_version;
uint8_t ev[(EV_MAX + 1) / 8];
uint8_t keys[(KEY_MAX + 1) / 8];
uint8_t abs[(ABS_MAX + 1) / 8];
uint8_t rel[(REL_MAX + 1) / 8];
uint8_t ff[(FF_MAX + 1) / 8];
uint8_t props[(INPUT_PROP_MAX + 1) / 8];
int expected;
const char *todo;
size_t hid_report_descriptor_length;
const unsigned char *hid_report_descriptor;
} GuessTest;
/*
* Test-cases for guessing a device type from its capabilities.
*
* The bytes in ev, etc. are in little-endian byte order
* Trailing zeroes can be omitted.
*
* The evemu-describe tool is a convenient way to add a test-case for
* a physically available device. To contribute new test-cases, see:
* https://github.com/libsdl-org/SDL/issues/7801#issuecomment-1589114910
*/
#define ZEROx4 0, 0, 0, 0
#define ZEROx8 ZEROx4, ZEROx4
#define FFx4 0xff, 0xff, 0xff, 0xff
#define FFx8 FFx4, FFx4
static unsigned char xbox_one_elite_2_hid_report_descriptor[] =
{
/* Generic Desktop / Game Pad, Generic Desktop / Keyboard */
0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x01,
0x09, 0x01, 0xa1, 0x00, 0x09, 0x30, 0x09, 0x31,
0x15, 0x00, 0x27, 0xff, 0xff, 0x00, 0x00, 0x95,
0x02, 0x75, 0x10, 0x81, 0x02, 0xc0, 0x09, 0x01,
0xa1, 0x00, 0x09, 0x32, 0x09, 0x35, 0x15, 0x00,
0x27, 0xff, 0xff, 0x00, 0x00, 0x95, 0x02, 0x75,
0x10, 0x81, 0x02, 0xc0, 0x05, 0x02, 0x09, 0xc5,
0x15, 0x00, 0x26, 0xff, 0x03, 0x95, 0x01, 0x75,
0x0a, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00, 0x75,
0x06, 0x95, 0x01, 0x81, 0x03, 0x05, 0x02, 0x09,
0xc4, 0x15, 0x00, 0x26, 0xff, 0x03, 0x95, 0x01,
0x75, 0x0a, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00,
0x75, 0x06, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01,
0x09, 0x39, 0x15, 0x01, 0x25, 0x08, 0x35, 0x00,
0x46, 0x3b, 0x01, 0x66, 0x14, 0x00, 0x75, 0x04,
0x95, 0x01, 0x81, 0x42, 0x75, 0x04, 0x95, 0x01,
0x15, 0x00, 0x25, 0x00, 0x35, 0x00, 0x45, 0x00,
0x65, 0x00, 0x81, 0x03, 0x05, 0x09, 0x19, 0x01,
0x29, 0x0f, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01,
0x95, 0x0f, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00,
0x75, 0x01, 0x95, 0x01, 0x81, 0x03, 0x05, 0x0c,
0x0a, 0xb2, 0x00, 0x15, 0x00, 0x25, 0x01, 0x95,
0x01, 0x75, 0x01, 0x81, 0x02, 0x15, 0x00, 0x25,
0x00, 0x75, 0x07, 0x95, 0x01, 0x81, 0x03, 0x05,
0x0c, 0x09, 0x01, 0xa1, 0x01, 0x0a, 0x85, 0x00,
0x15, 0x00, 0x26, 0xff, 0x00, 0x95, 0x01, 0x75,
0x08, 0x81, 0x02, 0x0a, 0x99, 0x00, 0x15, 0x00,
0x26, 0xff, 0x00, 0x95, 0x01, 0x75, 0x04, 0x81,
0x02, 0x15, 0x00, 0x25, 0x00, 0x95, 0x01, 0x75,
0x04, 0x81, 0x03, 0x0a, 0x81, 0x00, 0x15, 0x00,
0x26, 0xff, 0x00, 0x95, 0x01, 0x75, 0x04, 0x81,
0x02, 0x15, 0x00, 0x25, 0x00, 0x95, 0x01, 0x75,
0x04, 0x81, 0x03, 0xc0, 0x05, 0x0f, 0x09, 0x21,
0x85, 0x03, 0xa1, 0x02, 0x09, 0x97, 0x15, 0x00,
0x25, 0x01, 0x75, 0x04, 0x95, 0x01, 0x91, 0x02,
0x15, 0x00, 0x25, 0x00, 0x75, 0x04, 0x95, 0x01,
0x91, 0x03, 0x09, 0x70, 0x15, 0x00, 0x25, 0x64,
0x75, 0x08, 0x95, 0x04, 0x91, 0x02, 0x09, 0x50,
0x66, 0x01, 0x10, 0x55, 0x0e, 0x15, 0x00, 0x26,
0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x91, 0x02,
0x09, 0xa7, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75,
0x08, 0x95, 0x01, 0x91, 0x02, 0x65, 0x00, 0x55,
0x00, 0x09, 0x7c, 0x15, 0x00, 0x26, 0xff, 0x00,
0x75, 0x08, 0x95, 0x01, 0x91, 0x02, 0xc0, 0x05,
0x0c, 0x09, 0x01, 0x85, 0x0c, 0xa1, 0x01, 0x0a,
0x9e, 0x00, 0x15, 0x00, 0x26, 0xff, 0x00, 0x95,
0x01, 0x75, 0x08, 0x81, 0x02, 0x0a, 0xa1, 0x00,
0x15, 0x00, 0x26, 0xff, 0x00, 0x95, 0x01, 0x75,
0x08, 0x81, 0x02, 0x0a, 0xa2, 0x00, 0x15, 0x00,
0x26, 0xff, 0x00, 0x95, 0x01, 0x75, 0x08, 0x81,
0x02, 0x0a, 0xa3, 0x00, 0x15, 0x00, 0x26, 0xff,
0x00, 0x95, 0x01, 0x75, 0x08, 0x81, 0x02, 0xc0,
0xc0, 0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x85,
0x05, 0x05, 0x07, 0x19, 0xe0, 0x29, 0xe7, 0x15,
0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x08, 0x81,
0x02, 0x95, 0x01, 0x75, 0x08, 0x81, 0x03, 0x95,
0x06, 0x75, 0x08, 0x15, 0x00, 0x25, 0x65, 0x05,
0x07, 0x19, 0x00, 0x29, 0x65, 0x81, 0x00, 0xc0,
};
SDL_COMPILE_TIME_ASSERT (xbox_one_elite_2, sizeof (xbox_one_elite_2_hid_report_descriptor) == 0720);
static unsigned char ps3_hid_report_descriptor[] =
{
/* Generic Desktop / Joystick */
0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0xa1, 0x02,
0x85, 0x01, 0x75, 0x08, 0x95, 0x01, 0x15, 0x00,
0x26, 0xff, 0x00, 0x81, 0x03, 0x75, 0x01, 0x95,
0x13, 0x15, 0x00, 0x25, 0x01, 0x35, 0x00, 0x45,
0x01, 0x05, 0x09, 0x19, 0x01, 0x29, 0x13, 0x81,
0x02, 0x75, 0x01, 0x95, 0x0d, 0x06, 0x00, 0xff,
0x81, 0x03, 0x15, 0x00, 0x26, 0xff, 0x00, 0x05,
0x01, 0x09, 0x01, 0xa1, 0x00, 0x75, 0x08, 0x95,
0x04, 0x35, 0x00, 0x46, 0xff, 0x00, 0x09, 0x30,
0x09, 0x31, 0x09, 0x32, 0x09, 0x35, 0x81, 0x02,
0xc0, 0x05, 0x01, 0x75, 0x08, 0x95, 0x27, 0x09,
0x01, 0x81, 0x02, 0x75, 0x08, 0x95, 0x30, 0x09,
0x01, 0x91, 0x02, 0x75, 0x08, 0x95, 0x30, 0x09,
0x01, 0xb1, 0x02, 0xc0, 0xa1, 0x02, 0x85, 0x02,
0x75, 0x08, 0x95, 0x30, 0x09, 0x01, 0xb1, 0x02,
0xc0, 0xa1, 0x02, 0x85, 0xee, 0x75, 0x08, 0x95,
0x30, 0x09, 0x01, 0xb1, 0x02, 0xc0, 0xa1, 0x02,
0x85, 0xef, 0x75, 0x08, 0x95, 0x30, 0x09, 0x01,
0xb1, 0x02, 0xc0, 0xc0, 0x00,
};
SDL_COMPILE_TIME_ASSERT (ps3, sizeof (ps3_hid_report_descriptor) == 149);
/* Same for Steam Deck LCD (jupiter) and OLED (galileo) */
static unsigned char steam_deck_mouse_hid_report_descriptor[] =
{
0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x09, 0x01,
0xa1, 0x00, 0x05, 0x09, 0x19, 0x01, 0x29, 0x02,
0x15, 0x00, 0x25, 0x01, 0x75, 0x01, 0x95, 0x02,
0x81, 0x02, 0x75, 0x06, 0x95, 0x01, 0x81, 0x01,
0x05, 0x01, 0x09, 0x30, 0x09, 0x31, 0x15, 0x81,
0x25, 0x7f, 0x75, 0x08, 0x95, 0x02, 0x81, 0x06,
0x95, 0x01, 0x09, 0x38, 0x81, 0x06, 0x05, 0x0c,
0x0a, 0x38, 0x02, 0x95, 0x01, 0x81, 0x06, 0xc0,
0xc0,
};
SDL_COMPILE_TIME_ASSERT (steam_deck_mouse,
sizeof (steam_deck_mouse_hid_report_descriptor) == 65);
/* Same for Steam Deck LCD (jupiter) and OLED (galileo) */
static unsigned char steam_deck_kb_hid_report_descriptor[] =
{
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07,
0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01,
0x75, 0x01, 0x95, 0x08, 0x81, 0x02, 0x81, 0x01,
0x19, 0x00, 0x29, 0x65, 0x15, 0x00, 0x25, 0x65,
0x75, 0x08, 0x95, 0x06, 0x81, 0x00, 0xc0,
};
SDL_COMPILE_TIME_ASSERT (steam_deck_oled_kb,
sizeof (steam_deck_kb_hid_report_descriptor) == 39);
static unsigned char steam_deck_lcd_js_hid_report_descriptor[] =
{
0x06, 0xff, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x15,
0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x40,
0x09, 0x01, 0x81, 0x02, 0x09, 0x01, 0xb1, 0x02,
0xc0,
};
SDL_COMPILE_TIME_ASSERT (steam_deck_lcd_js,
sizeof (steam_deck_lcd_js_hid_report_descriptor) == 25);
static unsigned char steam_deck_oled_js_hid_report_descriptor[] =
{
0x06, 0xff, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x09,
0x02, 0x09, 0x03, 0x15, 0x00, 0x26, 0xff, 0x00,
0x75, 0x08, 0x95, 0x40, 0x81, 0x02, 0x09, 0x06,
0x09, 0x07, 0x15, 0x00, 0x26, 0xff, 0x00, 0x75,
0x08, 0x95, 0x40, 0xb1, 0x02, 0xc0,
};
SDL_COMPILE_TIME_ASSERT (steam_deck_oled_js,
sizeof (steam_deck_oled_js_hid_report_descriptor) == 38);
static unsigned char vrs_pedals_hid_report_descriptor[] =
{
/* Generic Desktop / Joystick */
0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0x05, 0x01,
0xa1, 0x02, 0x85, 0x01, 0x09, 0x30, 0x09, 0x31,
0x09, 0x32, 0x15, 0x00, 0x27, 0xff, 0xff, 0x00,
0x00, 0x35, 0x00, 0x47, 0xff, 0xff, 0x00, 0x00,
0x75, 0x10, 0x95, 0x03, 0x81, 0x02, 0x06, 0x00,
0xff, 0x09, 0x01, 0x95, 0x39, 0x75, 0x08, 0x26,
0xff, 0x00, 0x15, 0x00, 0x81, 0x02, 0xc0, 0x06,
0x00, 0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x64,
0x95, 0x3f, 0x75, 0x08, 0x26, 0xff, 0x00, 0x15,
0x00, 0x09, 0x01, 0x91, 0x02, 0x85, 0x65, 0x95,
0x3f, 0x75, 0x08, 0x26, 0xff, 0x00, 0x15, 0x00,
0x09, 0x01, 0x81, 0x02, 0xc0, 0xc0,
};
SDL_COMPILE_TIME_ASSERT (vrs_pedals, sizeof (vrs_pedals_hid_report_descriptor) == 0136);
static unsigned char thinkpad_usb_keyboard_hid_report_descriptor[] =
{
/* Generic Desktop / Keyboard */
0x05, 0x01, 0x09, 0x06, 0xa1, 0x01, 0x05, 0x07,
0x19, 0xe0, 0x29, 0xe7, 0x15, 0x00, 0x25, 0x01,
0x95, 0x08, 0x75, 0x01, 0x81, 0x02, 0x95, 0x08,
0x75, 0x01, 0x81, 0x01, 0x05, 0x08, 0x19, 0x01,
0x29, 0x03, 0x95, 0x03, 0x75, 0x01, 0x91, 0x02,
0x95, 0x01, 0x75, 0x05, 0x91, 0x01, 0x05, 0x07,
0x19, 0x00, 0x2a, 0xff, 0x00, 0x15, 0x00, 0x26,
0xff, 0x00, 0x95, 0x06, 0x75, 0x08, 0x81, 0x00,
0xc0,
};
SDL_COMPILE_TIME_ASSERT (thinkpad_usb_keyboard, sizeof (thinkpad_usb_keyboard_hid_report_descriptor) == 65);
static unsigned char thinkpad_usb_trackpoint_hid_report_descriptor[] =
{
/* Generic Desktop / Mouse, Generic Desktop / System Control,
* Consumer Devices / Consumer Control */
0x05, 0x01, 0x09, 0x02, 0xa1, 0x01, 0x85, 0x01,
0x09, 0x01, 0xa1, 0x00, 0x05, 0x09, 0x19, 0x01,
0x29, 0x03, 0x15, 0x00, 0x25, 0x01, 0x95, 0x03,
0x75, 0x01, 0x81, 0x02, 0x95, 0x01, 0x75, 0x05,
0x81, 0x01, 0x05, 0x01, 0x09, 0x30, 0x09, 0x31,
0x15, 0x81, 0x25, 0x7f, 0x95, 0x02, 0x75, 0x08,
0x81, 0x06, 0xc0, 0xc0, 0x05, 0x01, 0x09, 0x80,
0xa1, 0x01, 0x85, 0x02, 0x05, 0x01, 0x15, 0x00,
0x25, 0x01, 0x95, 0x08, 0x75, 0x01, 0x19, 0x81,
0x29, 0x88, 0x81, 0x02, 0xc0, 0x05, 0x0c, 0x09,
0x01, 0xa1, 0x01, 0x85, 0x03, 0x95, 0x08, 0x75,
0x01, 0x15, 0x00, 0x25, 0x01, 0x09, 0xe9, 0x09,
0xea, 0x09, 0xe2, 0x09, 0xb7, 0x09, 0xcd, 0x09,
0xb5, 0x09, 0xb6, 0x0a, 0x94, 0x01, 0x81, 0x02,
0x09, 0x03, 0xa1, 0x02, 0x05, 0x09, 0x19, 0x10,
0x29, 0x17, 0x81, 0x02, 0x05, 0x09, 0x19, 0x18,
0x29, 0x1f, 0x81, 0x02, 0xc0, 0x05, 0x08, 0x95,
0x02, 0x09, 0x09, 0x09, 0x21, 0x91, 0x02, 0x95,
0x01, 0x75, 0x06, 0x91, 0x03, 0xc0, 0x06, 0x01,
0xff, 0x09, 0x01, 0xa1, 0x01, 0x85, 0x04, 0x95,
0x01, 0x75, 0x08, 0x15, 0x00, 0x26, 0xff, 0x00,
0x09, 0x20, 0xb1, 0x03, 0x09, 0x21, 0xb1, 0x03,
0x09, 0x22, 0xb1, 0x03, 0x09, 0x23, 0xb1, 0x03,
0xc0,
};
SDL_COMPILE_TIME_ASSERT (thinkpad_usb_trackpoint, sizeof (thinkpad_usb_trackpoint_hid_report_descriptor) == 185);
static unsigned char heusinkveld_pedals_hid_report_descriptor[] =
{
/* Generic Desktop / Joystick */
0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0x09, 0x33,
0x09, 0x34, 0x09, 0x35, 0x15, 0x00, 0x26, 0xff,
0x0f, 0x85, 0x01, 0x75, 0x10, 0x95, 0x03, 0x81,
0x02, 0x09, 0x00, 0x75, 0x10, 0x95, 0x06, 0x82,
0x01, 0x01, 0x85, 0x02, 0x75, 0x10, 0x95, 0x03,
0x09, 0x00, 0x09, 0x00, 0xb1, 0x02, 0x85, 0x03,
0x75, 0x08, 0x95, 0x03, 0x09, 0x00, 0x82, 0x01,
0x01, 0xc0,
};
SDL_COMPILE_TIME_ASSERT (heusinkveld_pedals, sizeof (heusinkveld_pedals_hid_report_descriptor) == 072);
static unsigned char fanatec_handbrake_hid_report_descriptor[] =
{
/* Generic Desktop / Joystick */
0x05, 0x01, 0x09, 0x04, 0xa1, 0x01, 0x15, 0x00,
0x26, 0xff, 0x00, 0x95, 0x01, 0x75, 0x08, 0x09,
0x30, 0x81, 0x02, 0x06, 0x00, 0xff, 0x09, 0x01,
0x95, 0x03, 0x81, 0x02, 0x06, 0x00, 0xff, 0x09,
0x01, 0x95, 0x02, 0x91, 0x02, 0xc0,
};
SDL_COMPILE_TIME_ASSERT (fanatec_handbrake, sizeof (fanatec_handbrake_hid_report_descriptor) == 046);
static unsigned char xpadneo09_xb1s_hid_report_descriptor[] =
{
0x05, 0x01, 0x09, 0x05, 0xa1, 0x01, 0x85, 0x01,
0x09, 0x01, 0xa1, 0x00, 0x09, 0x30, 0x09, 0x31,
0x15, 0x00, 0x27, 0xff, 0xff, 0x00, 0x00, 0x95,
0x02, 0x75, 0x10, 0x81, 0x02, 0xc0, 0x09, 0x01,
0xa1, 0x00, 0x09, 0x33, 0x09, 0x34, 0x15, 0x00,
0x27, 0xff, 0xff, 0x00, 0x00, 0x95, 0x02, 0x75,
0x10, 0x81, 0x02, 0xc0, 0x05, 0x01, 0x09, 0x32,
0x15, 0x00, 0x26, 0xff, 0x03, 0x95, 0x01, 0x75,
0x0a, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00, 0x75,
0x06, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01, 0x09,
0x35, 0x15, 0x00, 0x26, 0xff, 0x03, 0x95, 0x01,
0x75, 0x0a, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00,
0x75, 0x06, 0x95, 0x01, 0x81, 0x03, 0x05, 0x01,
0x09, 0x39, 0x15, 0x01, 0x25, 0x08, 0x35, 0x00,
0x46, 0x3b, 0x01, 0x66, 0x14, 0x00, 0x75, 0x04,
0x95, 0x01, 0x81, 0x42, 0x75, 0x04, 0x95, 0x01,
0x15, 0x00, 0x25, 0x00, 0x35, 0x00, 0x45, 0x00,
0x65, 0x00, 0x81, 0x03, 0x05, 0x09, 0x19, 0x01,
0x29, 0x0c, 0x15, 0x00, 0x25, 0x01, 0x75, 0x01,
0x95, 0x0c, 0x81, 0x02, 0x15, 0x00, 0x25, 0x00,
0x75, 0x01, 0x95, 0x04, 0x81, 0x03, 0x05, 0x0c,
0x0a, 0xb2, 0x00, 0x15, 0x00, 0x25, 0x01, 0x95,
0x01, 0x75, 0x01, 0x81, 0x02, 0x15, 0x00, 0x25,
0x00, 0x75, 0x07, 0x95, 0x01, 0x81, 0x03, 0x05,
0x0f, 0x09, 0x21, 0x85, 0x03, 0xa1, 0x02, 0x09,
0x97, 0x15, 0x00, 0x25, 0x01, 0x75, 0x04, 0x95,
0x01, 0x91, 0x02, 0x15, 0x00, 0x25, 0x00, 0x75,
0x04, 0x95, 0x01, 0x91, 0x03, 0x09, 0x70, 0x15,
0x00, 0x25, 0x64, 0x75, 0x08, 0x95, 0x04, 0x91,
0x02, 0x09, 0x50, 0x66, 0x01, 0x10, 0x55, 0x0e,
0x15, 0x00, 0x26, 0xff, 0x00, 0x75, 0x08, 0x95,
0x01, 0x91, 0x02, 0x09, 0xa7, 0x15, 0x00, 0x26,
0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x91, 0x02,
0x65, 0x00, 0x55, 0x00, 0x09, 0x7c, 0x15, 0x00,
0x26, 0xff, 0x00, 0x75, 0x08, 0x95, 0x01, 0x91,
0x02, 0xc0, 0xc0,
};
SDL_COMPILE_TIME_ASSERT (xpadneo09_xb1s, sizeof (xpadneo09_xb1s_hid_report_descriptor) == 283);
/* Test-cases derived from real devices or from Linux kernel source */
/* *INDENT-OFF* */ /* clang-format off */
static const GuessTest guess_tests[] =
{
{
.name = "Xbox 360 wired USB controller",
.eviocgname = "Microsoft X-Box 360 pad",
.usb_vendor_name = "©Microsoft Corporation",
.usb_product_name = "Controller",
/* 8BitDo N30 Pro 2 v0114 via USB-C (with the xpad driver) is
* reported as 0003:045e:028e v0114, and is functionally equivalent */
.bus_type = 0x0003,
.vendor_id = 0x045e,
.product_id = 0x028e,
.version = 0x0114,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, FF */
.ev = { 0x0b, 0x00, 0x20 },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{
.name = "X-Box One Elite",
.bus_type = 0x0003,
.vendor_id = 0x045e,
.product_id = 0x02e3,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{ /* Reference: https://github.com/libsdl-org/SDL/issues/7814 */
.name = "X-Box One Elite 2 via USB",
/* The same physical device via Bluetooth, 0005:045e:0b22 v0517,
* is reported differently (below). */
/* Version 0407 is functionally equivalent. */
.bus_type = 0x0003,
.vendor_id = 0x045e,
.product_id = 0x0b00,
.version = 0x0511,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, FF */
.ev = { 0x0b, 0x00, 0x20 },
/* XY (left stick), RX/RY (right stick), Z/RZ (triggers), HAT0 (dpad) */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x200 */ ZEROx8,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* BTN_TRIGGER_HAPPY5 up to BTN_TRIGGER_HAPPY8 inclusive are the
* back buttons (paddles) */
/* 0x2c0 */ 0xf0,
},
},
{ /* Reference: https://github.com/libsdl-org/SDL/issues/7814 */
.name = "X-Box One Elite 2 via Bluetooth",
/* The same physical device via USB, 0003:045e:0b00 v0511,
* is reported differently (above). */
.bus_type = 0x0003,
.vendor_id = 0x045e,
.product_id = 0x0b22,
.version = 0x0517,
.expected = SDL_UDEV_DEVICE_JOYSTICK | SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY, ABS, FF */
.ev = { 0x0b, 0x00, 0x20 },
/* Android-style mapping:
* XY (left stick), Z/RZ (right stick), GAS/BRAKE (triggers), HAT0 (dpad) */
.abs = { 0x27, 0x06, 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx8,
/* KEY_RECORD is advertised but isn't generated in practice */
/* 0x80 */ ZEROx4, 0x80, 0x00, 0x00, 0x00,
/* KEY_UNKNOWN (240) is reported for the profile selector and all
* four back buttons (paddles) */
/* 0xc0 */ ZEROx4, 0x00, 0x00, 0x01, 0x00,
/* ABXY, TL, TR, TL2, TR2, SELECT, START, MODE, THUMBL,
* THUMBR have their obvious meanings; C and Z are also
* advertised, but are not generated in practice. */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x7f,
},
.hid_report_descriptor_length = sizeof (xbox_one_elite_2_hid_report_descriptor),
.hid_report_descriptor = &xbox_one_elite_2_hid_report_descriptor[0],
},
{
.name = "X-Box One S via Bluetooth",
.bus_type = 0x0005,
.vendor_id = 0x045e,
.product_id = 0x02e0,
.version = 0x1130,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{
.name = "X-Box One S wired",
.bus_type = 0x0003,
.vendor_id = 0x045e,
.product_id = 0x02ea,
.version = 0x0301,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{
.name = "X-Box One S via xpadneo 0.9.x",
/* Reference: https://github.com/libsdl-org/SDL/issues/7823 */
.eviocgname = "Xbox Wireless Controller",
.bus_type = 0x0005,
.vendor_id = 0x045e,
.product_id = 0x028e,
.version = 0x1130,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC, FF */
.ev = { 0x1b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y
* plus MISC as a deprecated axis reporting (rz - z) */
.abs = { 0x3f, 0x00, 0x03, 0x00, 0x00, 0x01 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x200 */ ZEROx8,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* BTN_TRIGGER_HAPPY33 up to BTN_TRIGGER_HAPPY36 inclusive:
* used to represent the current profile */
/* 0x2c0 */ ZEROx4, 0xf0,
},
.hid_report_descriptor_length = sizeof (xpadneo09_xb1s_hid_report_descriptor),
.hid_report_descriptor = &xpadneo09_xb1s_hid_report_descriptor[0],
},
{
.name = "DualSense (PS5) - gamepad",
.bus_type = 0x0003,
.vendor_id = 0x054c,
.product_id = 0x0ce6,
.version = 0x111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, select, start, mode, thumbl,
* thumbr; note that C and Z don't physically exist */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x7f,
},
},
{
.name = "DualSense (PS5) v8111 - gamepad",
.eviocgname = "Sony Interactive Entertainment Wireless Controller",
.usb_vendor_name = "Sony Interactive Entertainment",
.usb_product_name = "Wireless Controller",
/* Same physical device via Bluetooth is 0005:054c:0ce6 v8100
* and EVIOCGNAME is just "Wireless Controller", otherwise equivalent */
.bus_type = 0x0003,
.vendor_id = 0x054c,
.product_id = 0x0ce6,
.version = 0x8111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7f,
},
},
{
.name = "DualShock 4 - gamepad",
/* EVIOCGNAME is just "Wireless Controller" when seen via Bluetooth */
.eviocgname = "Sony Interactive Entertainment Wireless Controller",
.usb_vendor_name = "Sony Interactive Entertainment",
.usb_product_name = "Wireless Controller",
/* Same physical device via Bluetooth is 0005:054c:09cc v8100,
* but otherwise equivalent */
.bus_type = 0x0003,
.vendor_id = 0x054c,
.product_id = 0x09cc,
.version = 0x8111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC, FF */
/* Some versions only have 0x0b, SYN, KEY, ABS, like the
* Bluetooth example below */
.ev = { 0x1b, 0x00, 0x20 },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7f,
},
},
{
.name = "DualShock 4 - gamepad via Bluetooth (unknown version)",
.bus_type = 0x0005,
.vendor_id = 0x054c,
.product_id = 0x09cc,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7f,
},
},
{
.name = "DualShock 4 - touchpad",
/* EVIOCGNAME is just "Wireless Controller Touchpad" when seen via Bluetooth */
.eviocgname = "Sony Interactive Entertainment Wireless Controller Touchpad",
.usb_vendor_name = "Sony Interactive Entertainment",
.usb_product_name = "Wireless Controller",
/* Same physical device via Bluetooth is 0005:054c:09cc v8100 and is
* functionally equivalent. */
/* DualSense (PS5), 0003:054c:0ce6 v8111, is functionally equivalent.
* Same physical device via Bluetooth is 0005:054c:0ce6 v8100 and also
* functionally equivalent. */
.bus_type = 0x0003,
.vendor_id = 0x054c,
.product_id = 0x09cc,
.version = 0x8111,
.expected = SDL_UDEV_DEVICE_TOUCHPAD,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, multitouch */
.abs = { 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0x60, 0x02 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* Left mouse button */
/* 0x100 */ 0x00, 0x00, 0x01, 0x00, ZEROx4,
/* BTN_TOOL_FINGER and some multitouch stuff */
/* 0x140 */ 0x20, 0x24, 0x00, 0x00
},
/* POINTER, BUTTONPAD */
.props = { 0x05 },
},
{
.name = "DualShock 4 - accelerometer",
/* EVIOCGNAME is just "Wireless Controller Motion Sensors" when seen via Bluetooth */
.eviocgname = "Sony Interactive Entertainment Wireless Controller Motion Sensors",
.usb_vendor_name = "Sony Interactive Entertainment",
.usb_product_name = "Wireless Controller",
/* Same physical device via Bluetooth is 0005:054c:09cc v8100 and is
* functionally equivalent. */
/* DualSense (PS5), 0003:054c:0ce6 v8111, is functionally equivalent.
* Same physical device via Bluetooth is 0005:054c:0ce6 v8100 and also
* functionally equivalent. */
.bus_type = 0x0003,
.vendor_id = 0x054c,
.product_id = 0x09cc,
.version = 0x8111,
.expected = SDL_UDEV_DEVICE_ACCELEROMETER,
/* SYN, ABS, MSC */
.ev = { 0x19 },
/* X, Y, Z, RX, RY, RZ */
.abs = { 0x3f },
/* ACCELEROMETER */
.props = { 0x40 },
},
{
.name = "DualShock 4 via USB dongle",
.bus_type = 0x0003,
.vendor_id = 0x054c,
.product_id = 0x0ba0,
.version = 0x8111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, ABS, KEY */
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7f,
},
},
{
.name = "DualShock 3 - gamepad",
.eviocgname = "Sony PLAYSTATION(R)3 Controller",
.usb_vendor_name = "Sony",
.usb_product_name = "PLAYSTATION(R)3 Controller",
.bus_type = 0x0003,
.vendor_id = 0x054c,
.product_id = 0x0268,
.version = 0x8111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC, FF */
.ev = { 0x1b, 0x00, 0x20 },
/* X, Y, Z, RX, RY, RZ */
.abs = { 0x3f },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7f,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* Digital dpad */
/* 0x200 */ ZEROx4, 0x0f, 0x00, 0x00, 0x00,
},
.hid_report_descriptor_length = sizeof (ps3_hid_report_descriptor),
.hid_report_descriptor = &ps3_hid_report_descriptor[0],
},
{
.name = "DualShock 3 - accelerometer",
.eviocgname = "Sony PLAYSTATION(R)3 Controller Motion Sensors",
.usb_vendor_name = "Sony",
.usb_product_name = "PLAYSTATION(R)3 Controller",
.bus_type = 0x0003,
.vendor_id = 0x054c,
.product_id = 0x0268,
.expected = SDL_UDEV_DEVICE_ACCELEROMETER,
/* SYN, ABS */
.ev = { 0x09 },
/* X, Y, Z */
.abs = { 0x07 },
/* ACCELEROMETER */
.props = { 0x40 },
.hid_report_descriptor_length = sizeof (ps3_hid_report_descriptor),
.hid_report_descriptor = &ps3_hid_report_descriptor[0],
},
{
.name = "Steam Controller - gamepad",
.bus_type = 0x0003,
.vendor_id = 0x28de,
.product_id = 0x1142,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, RX, RY, HAT0X, HAT0Y, HAT2X, HAT2Y */
.abs = { 0x1b, 0x00, 0x33 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL, THUMBR, joystick THUMB, joystick THUMB2 */
/* 0x100 */ ZEROx4, 0x06, 0x00, 0xdb, 0x7f,
/* GEAR_DOWN, GEAR_UP */
/* 0x140 */ 0x00, 0x00, 0x03, 0x00, ZEROx4,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* Digital dpad */
/* 0x200 */ ZEROx4, 0x0f, 0x00, 0x00, 0x00,
},
},
{
/* Present to support lizard mode, even if no Steam Controller
* is connected */
.name = "Steam Controller - dongle",
.bus_type = 0x0003,
.vendor_id = 0x28de,
.product_id = 0x1142,
.expected = (SDL_UDEV_DEVICE_HAS_KEYS
| SDL_UDEV_DEVICE_KEYBOARD
| SDL_UDEV_DEVICE_MOUSE),
/* SYN, KEY, REL, MSC, LED, REP */
.ev = { 0x17, 0x00, 0x12 },
/* X, Y, mouse wheel, high-res mouse wheel */
.rel = { 0x03, 0x09 },
.keys = {
/* 0x00 */ 0xfe, 0xff, 0xff, 0xff, FFx4,
/* 0x40 */ 0xff, 0xff, 0xcf, 0x01, 0xdf, 0xff, 0x80, 0xe0,
/* 0x80 */ ZEROx8,
/* 0xc0 */ ZEROx8,
/* 0x100 */ 0x00, 0x00, 0x1f, 0x00, ZEROx4,
},
},
{
.name = "Steam Deck - mouse",
/* This is the LCD model (jupiter).
* Steam Deck OLED (galileo, possibly pre-production) has
* .eviocgname = "Valve Software Steam Controller"
* .version = 0x0110
* .usb_device_version = 0x0300
* but is otherwise equivalent.
*/
.eviocgname = "Valve Software Steam Deck Controller",
.usb_vendor_name = "Valve Software",
.usb_product_name = "Steam Deck Controller",
.bus_type = 0x0003,
.vendor_id = 0x28de,
.product_id = 0x1205,
.version = 0x011,
.usb_device_version = 0x0200,
/* SYN, KEY, REL, MSC */
.ev = { 0x17 },
/* X, Y, mouse wheel v/h, high-res mouse wheel v/h */
.rel = { 0x43, 0x19 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* left/right mouse button */
/* 0x100 */ 0x00, 0x00, 0x03, 0x00, ZEROx4,
},
.expected = SDL_UDEV_DEVICE_MOUSE,
.hid_report_descriptor_length = sizeof (steam_deck_mouse_hid_report_descriptor),
.hid_report_descriptor = &steam_deck_mouse_hid_report_descriptor[0],
},
{
.name = "Steam Deck - keyboard",
/* This is the LCD model (jupiter).
* Steam Deck OLED (galileo, possibly pre-production) has
* .eviocgname = "Valve Software Steam Controller"
* .version = 0x0110
* .usb_device_version = 0x0300
* but is otherwise equivalent.
*/
.eviocgname = "Valve Software Steam Deck Controller",
.usb_vendor_name = "Valve Software",
.usb_product_name = "Steam Deck Controller",
.bus_type = 0x0003,
.vendor_id = 0x28de,
.product_id = 0x1205,
.version = 0x0110,
.usb_device_version = 0x0300,
/* SYN, KEY, MSC, REP */
.ev = { 0x13, 0x00, 0x10 },
.keys = {
/* 0x00 */ 0xfe, 0xff, 0xff, 0xff, FFx4,
/* 0x40 */ 0xff, 0xff, 0xcf, 0x01, 0xdf, 0xff, 0x80, 0xe0,
},
.expected = SDL_UDEV_DEVICE_KEYBOARD | SDL_UDEV_DEVICE_HAS_KEYS,
.hid_report_descriptor_length = sizeof (steam_deck_kb_hid_report_descriptor),
.hid_report_descriptor = &steam_deck_kb_hid_report_descriptor[0],
},
{
.name = "Steam Deck LCD - gamepad",
.eviocgname = "Valve Software Steam Deck Controller",
.usb_vendor_name = "Valve Software",
.usb_product_name = "Steam Deck Controller",
.bus_type = 0x0003,
.vendor_id = 0x28de,
.product_id = 0x1205,
.version = 0x0111,
.usb_device_version = 0x0200,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* TODO: The data I have for Steam Deck LCD didn't seem to have
* an evdev device available, so this is extrapolated from
* kernel source code as being the same as the OLED model
* (the kernel driver doesn't distinguish). */
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, RX, RY, hat 0-2 x/y */
.abs = { 0x1b, 0x00, 0x3f },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 0x120 0x46: joystick THUMB, THUMB2, BASE */
/* 0x130 0xdb: gamepad ABXY, TL/TR */
/* 0x138 0x7f: gamepad TL2/TR2, SELECT/START, MODE, THUMBL/R */
/* 0x100 */ ZEROx4, 0x46, 0x00, 0xdb, 0x7f,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x220 0x0f: dpad up/down/left/right */
/* 0x200 */ ZEROx4, 0x0f, 0x00, 0x00, 0x00,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* 0x2c0 0x0f: joystick TRIGGER_HAPPY1..TRIGGER_HAPPY4 */
/* 0x2c0 */ 0x0f,
},
.hid_report_descriptor_length = sizeof (steam_deck_lcd_js_hid_report_descriptor),
.hid_report_descriptor = &steam_deck_lcd_js_hid_report_descriptor[0],
},
{
.name = "Steam Deck OLED - gamepad",
.eviocgname = "Valve Software Steam Controller",
.usb_vendor_name = "Valve Software",
.usb_product_name = "Steam Controller",
.bus_type = 0x0003,
.vendor_id = 0x28de,
.product_id = 0x1205,
.version = 0x0110,
.usb_device_version = 0x0300,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, RX, RY, hat 0-2 x/y */
.abs = { 0x1b, 0x00, 0x3f },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 0x120 0x46: joystick THUMB, THUMB2, BASE */
/* 0x130 0xdb: gamepad ABXY, TL/TR */
/* 0x138 0x7f: gamepad TL2/TR2, SELECT/START, MODE, THUMBL/R */
/* 0x100 */ ZEROx4, 0x46, 0x00, 0xdb, 0x7f,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x220 0x0f: dpad up/down/left/right */
/* 0x200 */ ZEROx4, 0x0f, 0x00, 0x00, 0x00,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* 0x2c0 0x0f: joystick TRIGGER_HAPPY1..TRIGGER_HAPPY4 */
/* 0x2c0 */ 0x0f,
},
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.hid_report_descriptor_length = sizeof (steam_deck_oled_js_hid_report_descriptor),
.hid_report_descriptor = &steam_deck_oled_js_hid_report_descriptor[0],
},
{
.name = "Steam Input virtual controller",
.eviocgname = "Microsoft X-Box 360 pad 0",
.bus_type = 0x0003,
.vendor_id = 0x28de,
.product_id = 0x11ff,
.version = 0x0001,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, FF */
.ev = { 0x0b, 0x00, 0x20 },
/* XYZ, RXYZ, hat 0 */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 0x130 0xdb: gamepad ABXY, TL/TR */
/* 0x138 0x7f: gamepad SELECT/START, MODE, THUMBL/R */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{
.name = "Guitar Hero for PS3",
/* SWITCH CO.,LTD. Controller (Dinput) off-brand N64-style USB controller
* 0003:2563:0575 v0111 is functionally equivalent.
* https://linux-hardware.org/?id=usb:2563-0575 reports the same IDs as
* ShenZhen ShanWan Technology ZD-V+ Wired Gaming Controller */
.bus_type = 0x0003,
.vendor_id = 0x12ba,
.product_id = 0x0100,
.version = 0x0110,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RZ, HAT0X, HAT0Y */
.abs = { 0x27, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, SELECT, START, MODE */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x1f,
},
},
{
.name = "G27 Racing Wheel, 0003:046d:c29b v0111",
.bus_type = 0x0003,
.vendor_id = 0x046d,
.product_id = 0xc29b,
.version = 0x0111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RZ, HAT0X, HAT0Y */
.abs = { 0x27, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 16 buttons: TRIGGER, THUMB, THUMB2, TOP, TOP2, PINKIE, BASE,
* BASE2..BASE6, unregistered event codes 0x12c-0x12e, DEAD */
/* 0x100 */ ZEROx4, 0xff, 0xff, 0x00, 0x00,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x200 */ ZEROx8,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* TRIGGER_HAPPY1..TRIGGER_HAPPY7 */
/* 0x2c0 */ 0x7f,
},
},
{
.name = "Logitech Driving Force, 0003:046d:c294 v0100",
.bus_type = 0x0003,
.vendor_id = 0x046d,
.product_id = 0xc294,
.version = 0x0100,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, RZ, HAT0X, HAT0Y */
.abs = { 0x23, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 12 buttons: TRIGGER, THUMB, THUMB2, TOP, TOP2, PINKIE, BASE,
* BASE2..BASE6 */
/* 0x100 */ ZEROx4, 0xff, 0x0f, 0x00, 0x00,
},
},
{
.name = "Logitech Dual Action",
.bus_type = 0x0003,
.vendor_id = 0x046d,
.product_id = 0xc216,
.version = 0x0110,
/* Logitech RumblePad 2 USB, 0003:046d:c218 v0110, is the same
* except for having force feedback, which we don't use in our
* heuristic */
/* Jess Tech GGE909 PC Recoil Pad, 0003:0f30:010b v0110, is the same */
/* 8BitDo SNES30 via USB, 0003:2dc8:ab20 v0110, is the same;
* see below for the same physical device via Bluetooth,
* 0005:2dc8:2840 v0100 */
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RZ, HAT0X, HAT0Y */
.abs = { 0x27, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 12 buttons: TRIGGER, THUMB, THUMB2, TOP, TOP2, PINKIE, BASE,
* BASE2..BASE6 */
/* 0x100 */ ZEROx4, 0xff, 0x0f, 0x00, 0x00,
},
},
{
.name = "8BitDo SNES30 v0100 via Bluetooth",
.eviocgname = "8Bitdo SNES30 GamePad",
/* The same physical device via USB, 0003:2dc8:ab20 v0110,
* is reported differently (above). */
/* 8BitDo NES30 Pro (aka N30 Pro) via Bluetooth, 0005:2dc8:3820 v0100,
* is functionally equivalent; but the same physical device via USB,
* 0003:2dc8:9001 v0111, matches N30 Pro 2 v0111. */
.bus_type = 0x0005,
.vendor_id = 0x2dc8,
.product_id = 0x2840,
.version = 0x0100,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC */
.ev = { 0x1b },
/* XYZ, RZ, GAS, BRAKE, HAT0X, HAT0Y */
.abs = { 0x27, 0x06, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, SELECT, START, MODE, THUMBL, THUMBR,
* and an unassigned button code */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0xff,
},
},
{
.name = "Saitek ST290 Pro flight stick",
.bus_type = 0x0003,
.vendor_id = 0x06a3,
.product_id = 0x0160, /* 0x0460 seems to be the same */
.version = 0x0100,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC */
.ev = { 0x1b },
/* X, Y, Z, RZ, HAT0X, HAT0Y */
.abs = { 0x27, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* TRIGGER, THUMB, THUMB2, TOP, TOP2, PINKIE */
/* 0x100 */ ZEROx4, 0x3f, 0x00, 0x00, 0x00,
},
},
{
.name = "Saitek X52 Pro Flight Control System",
.bus_type = 0x0003,
.vendor_id = 0x06a3,
.product_id = 0x0762,
.version = 0x0111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.ev = { 0x0b },
/* XYZ, RXYZ, throttle, hat0, MISC, unregistered event code 0x29 */
.abs = { 0x7f, 0x00, 0x03, 0x00, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 16 buttons: TRIGGER, THUMB, THUMB2, TOP, TOP2, PINKIE, BASE,
* BASE2..BASE6, unregistered event codes 0x12c-0x12e, DEAD */
/* 0x100 */ ZEROx4, 0xff, 0xff, 0x00, 0x00,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x200 */ ZEROx8,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* TRIGGER_HAPPY1..TRIGGER_HAPPY23 */
/* 0x2c0 */ 0xff, 0xff, 0x7f,
},
},
{
.name = "Logitech Extreme 3D",
.bus_type = 0x0003,
.vendor_id = 0x046d,
.product_id = 0xc215,
.version = 0x0110,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC */
.ev = { 0x0b },
/* X, Y, RZ, throttle, hat 0 */
.abs = { 0x63, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 12 buttons: TRIGGER, THUMB, THUMB2, TOP, TOP2, PINKIE, BASE,
* BASE2..BASE6 */
/* 0x100 */ ZEROx4, 0xff, 0x0f, 0x00, 0x00,
},
},
{
.name = "Hori Real Arcade Pro VX-SA",
.bus_type = 0x0003,
.vendor_id = 0x24c6,
.product_id = 0x5501,
.version = 0x0533,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, hat 0 */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{
/* https://github.com/ValveSoftware/steam-devices/pull/42
* PS4 mode is functionally equivalent, but with product ID 0x011c
* and version 0x1101. */
.name = "Hori Fighting Stick Alpha - PS5 mode",
.bus_type = 0x0003, /* USB */
.vendor_id = 0x0f0d, /* Hori Co., Ltd. */
.product_id = 0x0184, /* HORI FIGHTING STICK α (PS5 mode) */
.version = 0x0111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC */
.ev = { 0x1b },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x3f,
},
},
{ /* https://github.com/ValveSoftware/steam-devices/pull/42 */
.name = "Hori Fighting Stick Alpha - PC mode",
.bus_type = 0x0003, /* USB */
.vendor_id = 0x0f0d, /* Hori Co., Ltd. */
.product_id = 0x011e, /* HORI FIGHTING STICK α (PC mode) */
.version = 0x0116,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, FF */
.ev = { 0x0b, 0x00, 0x20 },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{ /* https://github.com/ValveSoftware/steam-devices/issues/29 */
.name = "HORIPAD S for Nintendo",
.bus_type = 0x0003, /* USB */
.vendor_id = 0x0f0d, /* Hori Co., Ltd. */
.product_id = 0x00dc, /* HORIPAD S */
.version = 0x0112,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, FF */
.ev = { 0x0b, 0x00, 0x20 },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{
.name = "Switch Pro Controller via Bluetooth",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x2009,
.version = 0x0001,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, RX, RY, hat 0 */
.abs = { 0x1b, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 16 buttons: TRIGGER, THUMB, THUMB2, TOP, TOP2, PINKIE, BASE,
* BASE2..BASE6, unregistered event codes 0x12c-0x12e, DEAD */
/* 0x100 */ ZEROx4, 0xff, 0xff, 0x00, 0x00,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x200 */ ZEROx8,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* TRIGGER_HAPPY1..TRIGGER_HAPPY2 */
/* 0x2c0 */ 0x03,
},
},
{
.name = "Switch Pro Controller via Bluetooth (Linux 6.2.11)",
.eviocgname = "Pro Controller",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x2009,
.version = 0x0001,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, RX, RY, hat 0 */
.abs = { 0x1b, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, SELECT, START, MODE, THUMBL, THUMBR,
* and an unassigned button code */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0xff,
},
},
{
.name = "Switch Pro Controller via USB",
.eviocgname = "Nintendo Co., Ltd. Pro Controller",
.usb_vendor_name = "Nintendo Co., Ltd.",
.usb_product_name = "Pro Controller",
.bus_type = 0x0003,
.vendor_id = 0x057e,
.product_id = 0x2009,
.version = 0x0111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, Z, RZ, HAT0X, HAT0Y */
.abs = { 0x27, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* 16 buttons: TRIGGER, THUMB, THUMB2, TOP, TOP2, PINKIE, BASE,
* BASE2..BASE6, unregistered event codes 0x12c-0x12e, DEAD */
/* 0x100 */ ZEROx4, 0xff, 0xff, 0x00, 0x00,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x200 */ ZEROx8,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* TRIGGER_HAPPY1..TRIGGER_HAPPY2 */
/* 0x2c0 */ 0x03,
},
},
{ /* https://github.com/ValveSoftware/steam-devices/pull/40 */
.name = "PDP wired Pro Controller for Switch",
/* 0003:0e6f:0184 "Performance Designed Products" /
* "Faceoff Deluxe+ Audio Wired Controller for Nintendo Switch" appears
* to be functionally equivalent */
.eviocgname = "PDP CO.,LTD. Faceoff Wired Pro Controller for Nintendo Switch",
.usb_vendor_name = "PDP CO.,LTD.",
.usb_product_name = "Faceoff Wired Pro Controller for Nintendo Switch",
.bus_type = 0x0003,
.vendor_id = 0x0e6f,
.product_id = 0x0180,
.version = 0x0111,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC */
.ev = { 0x1b },
/* X, Y, Z, RZ, HAT0X, HAT0Y */
.abs = { 0x27, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x3f,
},
},
{
.name = "NES Controller (R) NES-style Joycon from Nintendo Online",
.eviocgname = "NES Controller (R)",
/* Joy-Con (L), 0005:057e:2006 v0001, is functionally equivalent.
* Ordinary Joy-Con (R) and NES-style Joy-Con (L) are assumed to be
* functionally equivalent as well. */
.bus_type = 0x0005, /* Bluetooth-only */
.vendor_id = 0x057e,
.product_id = 0x2007,
.version = 0x0001,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, RX, RY, hat 0 */
.abs = { 0x1b, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, SELECT, START, MODE, THUMBL, THUMBR,
* and an unassigned button code */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0xff,
},
},
{
.name = "Thrustmaster Racing Wheel FFB",
/* Several devices intended for PS4 are functionally equivalent to this:
* https://github.com/ValveSoftware/steam-devices/pull/34
* Mad Catz FightStick TE S+ PS4, 0003:0738:8384:0111 v0111
* (aka Street Fighter V Arcade FightStick TES+)
* Mad Catz FightStick TE2+ PS4, 0003:0738:8481 v0100
* (aka Street Fighter V Arcade FightStick TE2+)
* Bigben Interactive DAIJA Arcade Stick, 0003:146b:0d09 v0111
* (aka Nacon Daija PS4 Arcade Stick)
* Razer Razer Raiju Ultimate Wired, 0003:1532:1009 v0000
* Razer Razer Raiju Ultimate (Bluetooth), 0005:1532:1009 v0001
*/
.bus_type = 0x0003,
.vendor_id = 0x044f,
.product_id = 0xb66d,
.version = 0x0110,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.ev = { 0x0b },
/* XYZ, RXYZ, hat 0 */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x3f,
},
},
{
.name = "Thrustmaster T.Flight Hotas X",
.bus_type = 0x0003,
.vendor_id = 0x044f,
.product_id = 0xb108,
.version = 0x0100,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.ev = { 0x0b },
/* XYZ, RZ, throttle, hat 0 */
.abs = { 0x67, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* trigger, thumb, thumb2, top, top2, pinkie, base,
* base2..base6 */
/* 0x100 */ ZEROx4, 0xff, 0x0f
},
},
{
.name = "8BitDo N30 Pro via Bluetooth",
/* This device has also been seen reported with an additional
* unassigned button code, the same as the SNES30 v0100 via Bluetooth */
.bus_type = 0x0005,
.vendor_id = 0x2dc8,
.product_id = 0x3820,
.version = 0x0100,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS, MSC */
.ev = { 0x1b },
/* XYZ, RZ, gas, brake, hat0 */
.abs = { 0x27, 0x06, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, select, start, mode, thumbl,
* thumbr */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x7f,
},
},
{
.name = "8BitDo N30 Pro 2 v0111",
.bus_type = 0x0003,
.vendor_id = 0x2dc8,
.product_id = 0x9015,
.version = 0x0111,
/* 8BitDo NES30 Pro via USB, 0003:2dc8:9001 v0111, is the same;
* but the same physical device via Bluetooth, 0005:2dc8:3820 v0100,
* matches 8BitDo SNES30 v0100 via Bluetooth instead (see above). */
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.ev = { 0x0b },
/* XYZ, RZ, gas, brake, hat0 */
.abs = { 0x27, 0x06, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, select, start, mode, thumbl,
* thumbr */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x7f,
},
},
{
.name = "8BitDo N30 Pro 2 via Bluetooth",
/* Physically the same device as the one that mimics an Xbox 360
* USB controller when wired */
.bus_type = 0x0005,
.vendor_id = 0x045e,
.product_id = 0x02e0,
.version = 0x0903,
.expected = SDL_UDEV_DEVICE_JOYSTICK | SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY, ABS, MSC, FF */
.ev = { 0x1b, 0x00, 0x20 },
/* X, Y, Z, RX, RY, RZ, HAT0X, HAT0Y */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx8,
/* KEY_MENU */
/* 0x80 */ 0x00, 0x08, 0x00, 0x00, ZEROx4,
/* 0xc0 */ ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2 */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x03,
},
},
{
.name = "Retro Power SNES-style controller, 0003:0079:0011 v0110",
.bus_type = 0x0003,
.vendor_id = 0x0079,
.product_id = 0x0011,
.version = 0x0110,
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.ev = { 0x0b },
/* X, Y */
.abs = { 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* trigger, thumb, thumb2, top, top2, pinkie, base,
* base2..base4 */
/* 0x100 */ ZEROx4, 0xff, 0x03, 0x00, 0x00,
},
},
{
.name = "Google Stadia Controller rev.A",
.eviocgname = "Google LLC Stadia Controller rev. A",
.usb_vendor_name = "Google LLC",
.usb_product_name = "Stadia Controller rev. A",
/* This data is with USB-C, but the same physical device via Bluetooth,
* 0005:18d1:9400 v0000, is functionally equivalent other than having
* EVIOCGNAME = StadiaXXXX-YYYY where XXXX is the last 4 digits of
* the serial number and YYYY is some other mystery number */
.bus_type = 0x0003,
.vendor_id = 0x18d1,
.product_id = 0x9400,
.version = 0x0100,
.expected = SDL_UDEV_DEVICE_JOYSTICK | SDL_UDEV_DEVICE_HAS_KEYS,
.ev = { 0x0b },
/* XYZ, RZ, gas, brake, hat0 */
.abs = { 0x27, 0x06, 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* Volume up/down */
/* 0x40 */ ZEROx4, 0x00, 0x00, 0x0c, 0x00,
/* Media play/pause */
/* 0x80 */ ZEROx4, 0x10, 0x00, 0x00, 0x00,
/* 0xc0 */ ZEROx8,
/* ABXY, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* 0x200 */ ZEROx8,
/* 0x240 */ ZEROx8,
/* 0x280 */ ZEROx8,
/* TRIGGER_HAPPY 1-4 */
/* 0x2c0 */ 0x0f, 0x00, 0x00, 0x00, ZEROx4,
},
},
{
.name = "Microsoft Xbox Series S|X Controller (model 1914) via USB",
.eviocgname = "Microsoft Xbox Series S|X Controller",
.usb_vendor_name = "Microsoft",
.usb_product_name = "Controller",
/* Physically the same device as 0003:045e:0b13 v0515 below,
* but some functionality is mapped differently */
.bus_type = 0x0003,
.vendor_id = 0x045e,
.product_id = 0x0b12,
.version = 0x050f,
.expected = SDL_UDEV_DEVICE_JOYSTICK | SDL_UDEV_DEVICE_HAS_KEYS,
.ev = { 0x0b },
/* X, Y, Z, RX, RY, RZ, hat 0 */
.abs = { 0x3f, 0x00, 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx8,
/* Record */
/* 0x80 */ ZEROx4, 0x80, 0x00, 0x00, 0x00,
/* 0xc0 */ ZEROx8,
/* ABXY, TL, TR, SELECT, START, MODE, THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7c,
},
},
{
.name = "Microsoft Xbox Series S|X Controller (model 1914) via Bluetooth",
.eviocgname = "Xbox Wireless Controller",
/* Physically the same device as 0003:045e:0b12 v050f above,
* but some functionality is mapped differently */
.bus_type = 0x0005,
.vendor_id = 0x045e,
.product_id = 0x0b13,
.version = 0x0515,
.expected = SDL_UDEV_DEVICE_JOYSTICK | SDL_UDEV_DEVICE_HAS_KEYS,
.ev = { 0x0b },
/* XYZ, RZ, gas, brake, hat0 */
.abs = { 0x27, 0x06, 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx8,
/* Record */
/* 0x80 */ ZEROx4, 0x80, 0x00, 0x00, 0x00,
/* 0xc0 */ ZEROx8,
/* ABC, XYZ, TL, TR, TL2, TR2, select, start, mode, thumbl,
* thumbr */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xff, 0x7f,
},
},
{
.name = "Wiimote - buttons",
.eviocgname = "Nintendo Wii Remote",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x0600,
/* This one is a bit weird because some of the buttons are mapped
* to the arrow, page up and page down keys, so it's a joystick
* with a subset of a keyboard attached. */
/* TODO: Should this be JOYSTICK, or even JOYSTICK|HAS_KEYS? */
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY, FF */
.ev = { 0x03, 0x00, 0x20 },
.keys = {
/* 0x00 */ ZEROx8,
/* left, right, up down */
/* 0x40 */ ZEROx4, 0x80, 0x16, 0x00, 0x00,
/* 0x80 */ ZEROx8,
/* 0xc0 */ ZEROx8,
/* BTN_1, BTN_2, BTN_A, BTN_B, BTN_MODE */
/* 0x100 */ 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x10,
/* 0x140 */ ZEROx8,
/* next (keyboard page down), previous (keyboard page up) */
/* 0x180 */ 0x00, 0x00, 0x80, 0x10, ZEROx4,
},
},
{
.name = "Wiimote - accelerometer",
.eviocgname = "Nintendo Wii Remote Accelerometer",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x0600,
.expected = SDL_UDEV_DEVICE_ACCELEROMETER,
/* SYN, ABS */
.ev = { 0x09 },
/* RX, RY, RZ - even though it would more conventionally be X, Y, Z */
.abs = { 0x38 },
},
{
.name = "Wiimote - Motion Plus gyroscope",
.eviocgname = "Nintendo Wii Remote Motion Plus",
/* Note that if we only look at the bus type, vendor, product, version
* and axes, this is indistinguishable from the accelerometer */
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x0600,
.expected = SDL_UDEV_DEVICE_ACCELEROMETER,
/* SYN, ABS */
.ev = { 0x09 },
/* RX, RY, RZ */
.abs = { 0x38 },
},
{
.name = "Wiimote - IR positioning",
.eviocgname = "Nintendo Wii Remote IR",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x0600,
.expected = SDL_UDEV_DEVICE_UNKNOWN,
/* SYN, ABS */
.ev = { 0x09 },
/* HAT0X, Y to HAT3X, Y */
.abs = { 0x00, 0x00, 0xff },
},
{
.name = "Wiimote - Nunchuck",
.eviocgname = "Nintendo Wii Remote Nunchuk",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x0600,
/* TODO: Should this be JOYSTICK? It has one stick and two buttons */
.expected = SDL_UDEV_DEVICE_UNKNOWN,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* RX, RY, RZ, hat 0 - even though this is an accelerometer, which
* would more conventionally be X, Y, Z, and a left joystick, which
* would more conventionally be X, Y */
.abs = { 0x38, 0x00, 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* C and Z buttons */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0x24, 0x00,
},
},
{
.name = "Wiimote - Classic Controller",
.eviocgname = "Nintendo Wii Remote Classic Controller",
.bus_type = 0x0005,
.vendor_id = 0x057e,
.product_id = 0x0306,
.version = 0x0600,
/* TODO: Should this be JOYSTICK, or maybe JOYSTICK|HAS_KEYS?
* It's unusual in the same ways as the Wiimote */
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* Hat 1-3 X and Y */
.abs = { 0x00, 0x00, 0xfc },
.keys = {
/* 0x00 */ ZEROx8,
/* left, right, up down */
/* 0x40 */ ZEROx4, 0x80, 0x16, 0x00, 0x00,
/* 0x80 */ ZEROx8,
/* 0xc0 */ ZEROx8,
/* A, B, X, Y, MODE, TL, TL2, TR, TR2 */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x13,
/* 0x140 */ ZEROx8,
/* next (keyboard page down), previous (keyboard page up) */
/* 0x180 */ 0x00, 0x00, 0x80, 0x10, ZEROx4,
},
},
{
/* Flags guessed from kernel source code, not confirmed with real
* hardware */
.name = "Wiimote - Balance Board",
/* TODO: Should this be JOYSTICK? */
.expected = SDL_UDEV_DEVICE_UNKNOWN,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* Hat 0-1 */
.abs = { 0x00, 0x00, 0x0f },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* BTN_A */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0x01, 0x00,
},
},
{
/* Flags guessed from kernel source code, not confirmed with real
* hardware */
.name = "Wiimote - Wii U Pro Controller",
.expected = SDL_UDEV_DEVICE_JOYSTICK,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, RX, RY */
.abs = { 0x1b },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* A, B, X, Y, TL, TR, TL2, TR2, SELECT, START, MODE,
* THUMBL, THUMBR */
/* 0x100 */ ZEROx4, 0x00, 0x00, 0xdb, 0x7f,
/* 0x140 */ ZEROx8,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ ZEROx8,
/* Digital dpad */
/* 0x200 */ ZEROx4, 0x0f, 0x00, 0x00, 0x00,
},
},
{
.name = "Synaptics TM3381-002 (Thinkpad X280 trackpad)",
.eviocgname = "Synaptics TM3381-002",
.bus_type = 0x001d, /* BUS_RMI */
.vendor_id = 0x06cb,
.product_id = 0x0000,
.version = 0x0000,
.expected = SDL_UDEV_DEVICE_TOUCHPAD,
/* SYN, KEY, ABS */
.ev = { 0x0b },
/* X, Y, pressure, multitouch */
.abs = { 0x03, 0x00, 0x00, 0x01, 0x00, 0x80, 0xf3, 0x06 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* Left mouse button */
/* 0x100 */ 0x00, 0x00, 0x01, 0x00, ZEROx4,
/* BTN_TOOL_FINGER and some multitouch gestures */
/* 0x140 */ 0x20, 0xe5
},
/* POINTER, BUTTONPAD */
.props = { 0x05 },
},
{
.name = "DELL08AF:00 (Dell XPS laptop touchpad)",
.bus_type = 0x18,
.vendor_id = 0x6cb,
.product_id = 0x76af,
.version = 0x100,
.ev = { 0x0b },
.expected = SDL_UDEV_DEVICE_TOUCHPAD,
/* X, Y, multitouch */
.abs = { 0x03, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe0, 0x02 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* Left mouse button */
/* 0x100 */ 0x00, 0x00, 0x01, 0x00, ZEROx4,
/* BTN_TOOL_FINGER and some multitouch gestures */
/* 0x140 */ 0x20, 0xe5
},
/* POINTER, BUTTONPAD */
.props = { 0x05 },
},
{
.name = "TPPS/2 Elan TrackPoint (Thinkpad X280)",
.eviocgname = "TPPS/2 Elan TrackPoint",
.bus_type = 0x0011, /* BUS_I8042 */
.vendor_id = 0x0002,
.product_id = 0x000a,
.version = 0x0000,
.expected = SDL_UDEV_DEVICE_MOUSE,
/* SYN, KEY, REL */
.ev = { 0x07 },
/* X, Y */
.rel = { 0x03 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* Left, middle, right mouse buttons */
/* 0x100 */ 0x00, 0x00, 0x07,
},
/* POINTER, POINTING_STICK */
.props = { 0x21 },
},
{
.name = "Thinkpad ACPI buttons",
.eviocgname = "ThinkPad Extra Buttons",
.bus_type = 0x0019,
.vendor_id = 0x17aa,
.product_id = 0x5054,
.version = 0x4101,
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY, MSC, SW */
.ev = { 0x33 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx4, 0x00, 0x00, 0x0e, 0x01,
/* 0x80 */ 0x00, 0x50, 0x11, 0x51, 0x00, 0x28, 0x00, 0xc0,
/* 0xc0 */ 0x04, 0x20, 0x10, 0x02, 0x1b, 0x70, 0x01, 0x00,
/* 0x100 */ ZEROx8,
/* 0x140 */ ZEROx4, 0x00, 0x00, 0x50, 0x00,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ 0x00, 0x00, 0x04, 0x18, ZEROx4,
/* 0x200 */ ZEROx8,
/* 0x240 */ 0x40, 0x00, 0x01, 0x00, ZEROx4,
},
},
{
.name = "Thinkpad ACPI buttons (Linux 6.1)",
.eviocgname = "ThinkPad Extra Buttons",
.bus_type = 0x0019,
.vendor_id = 0x17aa,
.product_id = 0x5054,
.version = 0x4101,
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY, MSC, SW */
.ev = { 0x33 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx4, 0x00, 0x00, 0x0e, 0x01,
/* 0x80 */ 0x00, 0x50, 0x11, 0x51, 0x00, 0x28, 0x00, 0xc0,
/* 0xc0 */ 0x04, 0x20, 0x10, 0x02, 0x1b, 0x70, 0x01, 0x00,
/* 0x100 */ ZEROx8,
/* 0x140 */ ZEROx4, 0x00, 0x00, 0x50, 0x00,
/* 0x180 */ ZEROx4, 0x00, 0x00, 0x00, 0x70,
/* 0x1c0 */ 0x00, 0x00, 0x04, 0x18, 0x20, 0x00, 0x00, 0x00,
/* 0x200 */ ZEROx8,
/* 0x240 */ ZEROx8,
},
},
{
.name = "PC speaker",
.eviocgname = "PC Speaker",
.bus_type = 0x0010, /* BUS_ISA */
.vendor_id = 0x001f,
.product_id = 0x0001,
.version = 0x0100,
.expected = SDL_UDEV_DEVICE_UNKNOWN,
/* SYN, SND */
.ev = { 0x01, 0x00, 0x04 },
},
{
.name = "HDA Digital PCBeep",
.eviocgname = "HDA Digital PCBeep",
.bus_type = 0x0001,
.vendor_id = 0x10ec,
.product_id = 0x0257,
.version = 0x0001,
.expected = SDL_UDEV_DEVICE_UNKNOWN,
/* SYN, SND */
.ev = { 0x01, 0x00, 0x04 },
},
{
.name = "ALSA headphone detection, etc.",
.eviocgname = "HDA Intel PCH Mic",
/* HDA Intel PCH Headphone is functionally equivalent */
/* HDA Intel PCH HDMI/DP,pcm=3 is functionally equivalent */
/* HDA Intel PCH HDMI/DP,pcm=7 is functionally equivalent */
/* HDA Intel PCH HDMI/DP,pcm=8 is functionally equivalent */
.bus_type = 0x0000,
.vendor_id = 0x0000,
.product_id = 0x0000,
.version = 0x0000,
.expected = SDL_UDEV_DEVICE_UNKNOWN,
/* SYN, SW */
.ev = { 0x21 },
},
{
/* Assumed to be a reasonably typical i8042 (PC AT) keyboard */
.name = "Thinkpad T520 and X280 keyboards",
/* Steam Deck LCD/OLED keyboard interface is version 0xab83 but
* otherwise equivalent */
.eviocgname = "AT Translated Set 2 keyboard",
.bus_type = 0x0011, /* BUS_I8042 */
.vendor_id = 0x0001,
.product_id = 0x0001,
.version = 0xab54,
.expected = SDL_UDEV_DEVICE_HAS_KEYS | SDL_UDEV_DEVICE_KEYBOARD,
/* SYN, KEY, MSC, LED, REP */
.ev = { 0x13, 0x00, 0x12 },
.keys = {
/* 0x00 */ 0xfe, 0xff, 0xff, 0xff, FFx4,
/* 0x40 */ 0xff, 0xff, 0xef, 0xff, 0xdf, 0xff, 0xff, 0xfe,
/* 0x80 */ 0x01, 0xd0, 0x00, 0xf8, 0x78, 0x30, 0x80, 0x03,
/* 0xc0 */ 0x00, 0x00, 0x00, 0x02, 0x04, 0x00, 0x00, 0x00,
},
},
{
.name = "Thinkpad X280 sleep button",
.eviocgname = "Sleep Button",
.bus_type = 0x0019, /* BUS_HOST */
.vendor_id = 0x0000,
.product_id = 0x0003,
.version = 0x0000,
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY */
.ev = { 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx8,
/* KEY_SLEEP */
/* 0x80 */ 0x00, 0x40,
},
},
{
/* As seen on Thinkpad X280, Steam Deck LCD, Steam Deck OLED */
.name = "ACPI lid switch",
.eviocgname = "Lid Switch",
.bus_type = 0x0019, /* BUS_HOST */
.vendor_id = 0x0000,
.product_id = 0x0005,
.version = 0x0000,
.expected = SDL_UDEV_DEVICE_UNKNOWN,
/* SYN, SW */
.ev = { 0x21 },
},
{
/* As seen on Thinkpad X280, Steam Deck LCD, Steam Deck OLED */
.name = "ACPI power button",
.eviocgname = "Power Button",
.bus_type = 0x0019, /* BUS_HOST */
.vendor_id = 0x0000,
.product_id = 0x0001,
.version = 0x0000,
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY */
.ev = { 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* KEY_POWER */
/* 0x40 */ ZEROx4, 0x00, 0x00, 0x10, 0x00,
},
},
{
/* As seen on Thinkpad X280, Steam Deck LCD, Steam Deck OLED */
.name = "ACPI video bus",
.eviocgname = "Video Bus",
.bus_type = 0x0019, /* BUS_HOST */
.vendor_id = 0x0000,
.product_id = 0x0006,
.version = 0x0000,
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY */
.ev = { 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx8,
/* 0x80 */ ZEROx8,
/* brightness control, video mode, display off */
/* 0xc0 */ ZEROx4, 0x0b, 0x00, 0x3e, 0x00,
},
},
{
.name = "Thinkpad X280 webcam",
.eviocgname = "Integrated Camera: Integrated C",
.usb_vendor_name = "Chicony Electronics Co.,Ltd.",
.usb_product_name = "Integrated Camera",
.bus_type = 0x0003,
.vendor_id = 0x04f2,
.product_id = 0xb604,
.version = 0x0027,
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY */
.ev = { 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx8,
/* 0x80 */ ZEROx8,
/* KEY_CAMERA */
/* 0xc0 */ 0x00, 0x00, 0x10, 0x00, ZEROx4,
},
},
{
.name = "Thinkpad X280 extra buttons",
.bus_type = 0x0019, /* BUS_HOST */
.vendor_id = 0x17aa,
.product_id = 0x5054,
.version = 0x4101,
.expected = SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY */
.ev = { 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx4, 0x00, 0x00, 0x0e, 0x01,
/* 0x80 */ 0x00, 0x50, 0x11, 0x51, 0x00, 0x28, 0x00, 0xc0,
/* 0xc0 */ 0x04, 0x20, 0x10, 0x02, 0x1b, 0x70, 0x01, 0x00,
/* 0x100 */ ZEROx8,
/* 0x140 */ ZEROx4, 0x00, 0x00, 0x50, 0x00,
/* 0x180 */ ZEROx8,
/* 0x1c0 */ 0x00, 0x00, 0x04, 0x18, ZEROx4,
/* 0x200 */ ZEROx8,
/* 0x240 */ 0x40, 0x00, 0x01, 0x00, ZEROx4,
},
},
{
.name = "Thinkpad USB keyboard with Trackpoint - keyboard",
.eviocgname = "Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint",
.usb_vendor_name = "Lite-On Technology Corp.",
.usb_product_name = "ThinkPad USB Keyboard with TrackPoint",
.bus_type = 0x0003,
.vendor_id = 0x17ef,
.product_id = 0x6009,
.expected = SDL_UDEV_DEVICE_HAS_KEYS | SDL_UDEV_DEVICE_KEYBOARD,
/* SYN, KEY, MSC, LED, REP */
.ev = { 0x13, 0x00, 0x12 },
.keys = {
/* 0x00 */ 0xfe, 0xff, 0xff, 0xff, FFx4,
/* 0x40 */ 0xff, 0xff, 0xef, 0xff, 0xdf, 0xff, 0xbe, 0xfe,
/* 0x80 */ 0xff, 0x57, 0x40, 0xc1, 0x7a, 0x20, 0x9f, 0xff,
/* 0xc0 */ 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
},
.hid_report_descriptor_length = sizeof (thinkpad_usb_keyboard_hid_report_descriptor),
.hid_report_descriptor = &thinkpad_usb_keyboard_hid_report_descriptor[0],
},
{
.name = "Thinkpad USB keyboard with Trackpoint - Trackpoint",
.eviocgname = "Lite-On Technology Corp. ThinkPad USB Keyboard with TrackPoint",
.usb_vendor_name = "Lite-On Technology Corp.",
.usb_product_name = "ThinkPad USB Keyboard with TrackPoint",
.bus_type = 0x0003,
.vendor_id = 0x17ef,
.product_id = 0x6009,
.version = 0x0110,
/* For some reason the special keys like mute and wlan toggle
* show up here instead of, or in addition to, as part of
* the keyboard - so both udev and SDL report this as having keys too. */
.expected = SDL_UDEV_DEVICE_MOUSE | SDL_UDEV_DEVICE_HAS_KEYS,
/* SYN, KEY, REL, MSC, LED */
.ev = { 0x17, 0x00, 0x02 },
/* X, Y */
.rel = { 0x03 },
.keys = {
/* 0x00 */ ZEROx8,
/* 0x40 */ ZEROx4, 0x00, 0x00, 0x1e, 0x00,
/* 0x80 */ 0x00, 0xcc, 0x11, 0x01, 0x78, 0x40, 0x00, 0xc0,
/* 0xc0 */ 0x00, 0x20, 0x10, 0x00, 0x0b, 0x50, 0x00, 0x00,
/* Mouse buttons: left, right, middle, "task" */
/* 0x100 */ 0x00, 0x00, 0x87, 0x68, ZEROx4,
/* 0x140 */ ZEROx4, 0x00, 0x00, 0x10, 0x00,
/* 0x180 */ ZEROx4, 0x00, 0x00, 0x40, 0x00,
},
.hid_report_descriptor_length = sizeof (thinkpad_usb_trackpoint_hid_report_descriptor),
.hid_report_descriptor = &thinkpad_usb_trackpoint_hid_report_descriptor[0],
},
{ /* https://github.com/ValveSoftware/Proton/issues/5126 */
.name = "Smarty Co. VRS DirectForce Pro Pedals",
.bus_type = 0x0003,
.vendor_id = 0x0483, /* STMicroelectronics */
.product_id = 0xa3be, /* VRS DirectForce Pro Pedals */
.version = 0x0111,
/* TODO: Ideally we would identify this as a joystick, but there
* isn't currently enough information to do that without a table
* of known devices. */
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.todo = "https://github.com/ValveSoftware/Proton/issues/5126",
/* SYN, ABS */
.ev = { 0x09 },
/* X, Y, Z */
.abs = { 0x07 },
.hid_report_descriptor_length = sizeof (vrs_pedals_hid_report_descriptor),
.hid_report_descriptor = &vrs_pedals_hid_report_descriptor[0],
},
{ /* https://github.com/ValveSoftware/Proton/issues/5126 */
.name = "Heusinkveld Heusinkveld Sim Pedals Ultimate",
.bus_type = 0x0003,
.vendor_id = 0x30b7, /* Heusinkveld Engineering */
.product_id = 0x1003, /* Heusinkveld Sim Pedals Ultimate */
.version = 0x0000,
/* TODO: Ideally we would identify this as a joystick, but there
* isn't currently enough information to do that without a table
* of known devices. */
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.todo = "https://github.com/ValveSoftware/Proton/issues/5126",
/* SYN, ABS */
.ev = { 0x09 },
/* RX, RY, RZ */
.abs = { 0x38 },
.hid_report_descriptor_length = sizeof (heusinkveld_pedals_hid_report_descriptor),
.hid_report_descriptor = &heusinkveld_pedals_hid_report_descriptor[0],
},
{ /* https://github.com/ValveSoftware/Proton/issues/5126 */
.name = "Vitaly [mega_mozg] Naidentsev ODDOR-handbrake",
.bus_type = 0x0003,
.vendor_id = 0x0000,
.product_id = 0x0000,
.version = 0x0001,
/* TODO: Ideally we would identify this as a joystick by it having
* the joystick-specific THROTTLE axis and TRIGGER/THUMB buttons */
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.todo = "https://github.com/ValveSoftware/Proton/issues/5126",
/* SYN, KEY, ABS, MSC */
.ev = { 0x1b },
/* THROTTLE only */
.abs = { 0x40 },
.keys = {
/* 0x00-0xff */ ZEROx8, ZEROx8, ZEROx8, ZEROx8,
/* TRIGGER = 0x120, THUMB = 0x121 */
/* 0x100 */ ZEROx4, 0x03, 0x00, 0x00, 0x00,
},
},
{ /* https://github.com/ValveSoftware/Proton/issues/5126 */
.name = "Leo Bodnar Logitech® G25 Pedals",
.bus_type = 0x0003,
.vendor_id = 0x1dd2, /* Leo Bodnar Electronics Ltd */
.product_id = 0x100c,
.version = 0x0110,
/* TODO: Ideally we would identify this as a joystick, but there
* isn't currently enough information to do that without a table
* of known devices. */
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.todo = "https://github.com/ValveSoftware/Proton/issues/5126",
/* SYN, ABS */
.ev = { 0x09 },
/* RX, RY, RZ */
.abs = { 0x38 },
},
{ /* https://github.com/ValveSoftware/Proton/issues/5126 */
.name = "FANATEC ClubSport USB Handbrake",
.bus_type = 0x0003,
.vendor_id = 0x0eb7,
.product_id = 0x1a93,
.version = 0x0111,
/* TODO: Ideally we would identify this as a joystick, but there
* isn't currently enough information to do that without a table
* of known devices. */
.expected = SDL_UDEV_DEVICE_JOYSTICK,
.todo = "https://github.com/ValveSoftware/Proton/issues/5126",
/* SYN, ABS */
.ev = { 0x09 },
/* X only */
.abs = { 0x01 },
.hid_report_descriptor_length = sizeof (fanatec_handbrake_hid_report_descriptor),
.hid_report_descriptor = &fanatec_handbrake_hid_report_descriptor[0],
},
{ /* Artificial test data, not a real device */
.name = "Fake accelerometer with fewer than usual axes reported",
.expected = SDL_UDEV_DEVICE_ACCELEROMETER,
/* SYN, ABS */
.ev = { 0x09 },
/* X only */
.abs = { 0x01 },
/* ACCELEROMETER */
.props = { 0x40 },
},
{ /* Artificial test data, not a real device */
.name = "Fake pointing stick with no buttons",
.expected = SDL_UDEV_DEVICE_MOUSE,
/* SYN, REL */
.ev = { 0x05 },
/* X,Y */
.rel = { 0x03 },
/* POINTER, POINTING_STICK */
.props = { 0x21 },
},
{ /* Artificial test data, not a real device */
.name = "Fake buttonpad",
.expected = SDL_UDEV_DEVICE_TOUCHPAD,
/* SYN, ABS */
.ev = { 0x09 },
/* X,Y */
.abs = { 0x03 },
/* POINTER, BUTTONPAD */
.props = { 0x05 },
},
{
.name = "No information",
.expected = SDL_UDEV_DEVICE_UNKNOWN,
}
};
/* *INDENT-ON* */ /* clang-format on */
/* The Linux kernel provides capability info in EVIOCGBIT and in /sys
* as an array of unsigned long in native byte order, rather than an array
* of bytes, an array of native-endian 32-bit words or an array of
* native-endian 64-bit words like you might have reasonably expected.
* The order of words in the array is always lowest-valued first: for
* instance, the first unsigned long in abs[] contains the bit representing
* absolute axis 0 (ABS_X).
*
* The constant arrays above provide test data in little-endian, because
* that's the easiest representation for hard-coding into a test like this.
* On a big-endian platform we need to byteswap it, one unsigned long at a
* time, to match what the kernel would produce. This requires us to choose
* an appropriate byteswapping function for the architecture's word size. */
SDL_COMPILE_TIME_ASSERT(sizeof_long, sizeof(unsigned long) == 4 || sizeof(unsigned long) == 8);
#define SwapLongLE(X) \
((sizeof(unsigned long) == 4) ? SDL_Swap32LE(X) : SDL_Swap64LE(X))
static int
run_test(void)
{
int success = 1;
size_t i;
for (i = 0; i < SDL_arraysize(guess_tests); i++) {
const GuessTest *t = &guess_tests[i];
size_t j;
int actual;
struct
{
unsigned long props[NBITS(INPUT_PROP_MAX)];
unsigned long ev[NBITS(EV_MAX)];
unsigned long abs[NBITS(ABS_MAX)];
unsigned long keys[NBITS(KEY_MAX)];
unsigned long rel[NBITS(REL_MAX)];
} caps;
printf("%s...\n", t->name);
SDL_memset(&caps, '\0', sizeof(caps));
SDL_memcpy(caps.props, t->props, sizeof(t->props));
SDL_memcpy(caps.ev, t->ev, sizeof(t->ev));
SDL_memcpy(caps.keys, t->keys, sizeof(t->keys));
SDL_memcpy(caps.abs, t->abs, sizeof(t->abs));
SDL_memcpy(caps.rel, t->rel, sizeof(t->rel));
for (j = 0; j < SDL_arraysize(caps.props); j++) {
caps.props[j] = SwapLongLE(caps.props[j]);
}
for (j = 0; j < SDL_arraysize(caps.ev); j++) {
caps.ev[j] = SwapLongLE(caps.ev[j]);
}
for (j = 0; j < SDL_arraysize(caps.keys); j++) {
caps.keys[j] = SwapLongLE(caps.keys[j]);
}
for (j = 0; j < SDL_arraysize(caps.abs); j++) {
caps.abs[j] = SwapLongLE(caps.abs[j]);
}
for (j = 0; j < SDL_arraysize(caps.rel); j++) {
caps.rel[j] = SwapLongLE(caps.rel[j]);
}
actual = SDL_EVDEV_GuessDeviceClass(caps.props, caps.ev, caps.abs,
caps.keys, caps.rel);
if (actual == t->expected) {
printf("\tOK\n");
} else {
printf("\tExpected 0x%08x\n", t->expected);
for (j = 0; device_classes[j].code != 0; j++) {
if (t->expected & device_classes[j].code) {
printf("\t\t%s\n", device_classes[j].name);
}
}
printf("\tGot 0x%08x\n", actual);
for (j = 0; device_classes[j].code != 0; j++) {
if (actual & device_classes[j].code) {
printf("\t\t%s\n", device_classes[j].name);
}
}
if (t->todo) {
printf("\tKnown issue, ignoring: %s\n", t->todo);
} else {
printf("\tFailed\n");
success = 0;
}
}
}
return success;
}
#else /* !(HAVE_LIBUDEV_H || defined(SDL_JOYSTICK_LINUX)) */
static int
run_test(void)
{
printf("SDL compiled without evdev capability check.\n");
return 1;
}
#endif
int main(int argc, char *argv[])
{
int result;
SDLTest_CommonState *state;
/* Initialize test framework */
state = SDLTest_CommonCreateState(argv, 0);
if (!state) {
return 1;
}
/* Parse commandline */
if (!SDLTest_CommonDefaultArgs(state, argc, argv)) {
return 1;
}
result = run_test() ? 0 : 1;
SDL_Quit();
SDLTest_CommonDestroyState(state);
return result;
}
|