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 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916
|
diff -urN linux-2.4.25/arch/sparc64/kernel/ioctl32.c linux-2.4.25-mh5/arch/sparc64/kernel/ioctl32.c
--- linux-2.4.25/arch/sparc64/kernel/ioctl32.c 2004-02-18 14:36:31.000000000 +0100
+++ linux-2.4.25-mh5/arch/sparc64/kernel/ioctl32.c 2004-08-01 16:57:23.000000000 +0200
@@ -4318,6 +4318,11 @@
#define CMTPGETCONNLIST _IOR('C', 210, int)
#define CMTPGETCONNINFO _IOR('C', 211, int)
+#define HIDPCONNADD _IOW('H', 200, int)
+#define HIDPCONNDEL _IOW('H', 201, int)
+#define HIDPGETCONNLIST _IOR('H', 210, int)
+#define HIDPGETCONNINFO _IOR('H', 211, int)
+
struct ioctl_trans {
unsigned int cmd;
unsigned int handler;
@@ -5045,6 +5050,10 @@
COMPATIBLE_IOCTL(CMTPCONNDEL)
COMPATIBLE_IOCTL(CMTPGETCONNLIST)
COMPATIBLE_IOCTL(CMTPGETCONNINFO)
+COMPATIBLE_IOCTL(HIDPCONNADD)
+COMPATIBLE_IOCTL(HIDPCONNDEL)
+COMPATIBLE_IOCTL(HIDPGETCONNLIST)
+COMPATIBLE_IOCTL(HIDPGETCONNINFO)
/* Scanner */
COMPATIBLE_IOCTL(SCANNER_IOCTL_VENDOR)
COMPATIBLE_IOCTL(SCANNER_IOCTL_PRODUCT)
diff -urN linux-2.4.25/CREDITS linux-2.4.25-mh5/CREDITS
--- linux-2.4.25/CREDITS 2004-02-18 14:36:30.000000000 +0100
+++ linux-2.4.25-mh5/CREDITS 2004-08-01 16:57:23.000000000 +0200
@@ -1348,6 +1348,7 @@
D: Maintainer of the Linux Bluetooth Subsystem
D: Author and maintainer of the various Bluetooth HCI drivers
D: Author and maintainer of the CAPI message transport protocol driver
+D: Author and maintainer of the Bluetooth HID protocol driver
D: Various other Bluetooth related patches, cleanups and fixes
S: Germany
diff -urN linux-2.4.25/Documentation/Configure.help linux-2.4.25-mh5/Documentation/Configure.help
--- linux-2.4.25/Documentation/Configure.help 2004-02-18 14:36:30.000000000 +0100
+++ linux-2.4.25-mh5/Documentation/Configure.help 2004-08-01 16:57:23.000000000 +0200
@@ -22921,22 +22921,21 @@
Linux Bluetooth subsystem consist of several layers:
BlueZ Core (HCI device and connection manager, scheduler)
- HCI Device drivers (interface to the hardware)
- L2CAP Module (L2CAP protocol)
- SCO Module (SCO links)
- RFCOMM Module (RFCOMM protocol)
- BNEP Module (BNEP protocol)
- CMTP Module (CMTP protocol)
+ HCI Device drivers (Interface to the hardware)
+ SCO Module (SCO audio links)
+ L2CAP Module (Logical Link Control and Adaptation Protocol)
+ RFCOMM Module (RFCOMM Protocol)
+ BNEP Module (Bluetooth Network Encapsulation Protocol)
+ CMTP Module (CAPI Message Transport Protocol)
+ HIDP Module (Human Interface Device Protocol)
- Say Y here to enable Linux Bluetooth support and to build BlueZ Core
- layer.
+ Say Y here to compile Bluetooth support into the kernel or say M to
+ compile it as module (bluez.o).
To use Linux Bluetooth subsystem, you will need several user-space
utilities like hciconfig and hcid. These utilities and updates to
Bluetooth kernel modules are provided in the BlueZ package.
- For more information, see <http://bluez.sourceforge.net/>.
-
- If you want to compile BlueZ Core as module (bluez.o) say M here.
+ For more information, see <http://www.bluez.org/>.
L2CAP protocol support
CONFIG_BLUEZ_L2CAP
@@ -22949,7 +22948,7 @@
SCO links support
CONFIG_BLUEZ_SCO
- SCO link provides voice transport over Bluetooth. SCO support is
+ SCO link provides voice transport over Bluetooth. SCO support is
required for voice applications like Headset and Audio.
Say Y here to compile SCO support into the kernel or say M to
@@ -22957,7 +22956,7 @@
RFCOMM protocol support
CONFIG_BLUEZ_RFCOMM
- RFCOMM provides connection oriented stream transport. RFCOMM
+ RFCOMM provides connection oriented stream transport. RFCOMM
support is required for Dialup Networking, OBEX and other Bluetooth
applications.
@@ -22971,32 +22970,37 @@
BNEP protocol support
CONFIG_BLUEZ_BNEP
BNEP (Bluetooth Network Encapsulation Protocol) is Ethernet
- emulation layer on top of Bluetooth. BNEP is required for Bluetooth
- PAN (Personal Area Network).
-
- To use BNEP, you will need user-space utilities provided in the
- BlueZ-PAN package.
- For more information, see <http://bluez.sourceforge.net>.
+ emulation layer on top of Bluetooth. BNEP is required for
+ Bluetooth PAN (Personal Area Network).
Say Y here to compile BNEP support into the kernel or say M to
compile it as module (bnep.o).
+BNEP multicast filter support
+CONFIG_BLUEZ_BNEP_MC_FILTER
+ This option enables the multicast filter support for BNEP.
+
+BNEP protocol filter support
+CONFIG_BLUEZ_BNEP_PROTO_FILTER
+ This option enables the protocol filter support for BNEP.
+
CMTP protocol support
CONFIG_BLUEZ_CMTP
CMTP (CAPI Message Transport Protocol) is a transport layer
- for CAPI messages. CMTP is required for the Bluetooth Common
+ for CAPI messages. CMTP is required for the Bluetooth Common
ISDN Access Profile.
Say Y here to compile CMTP support into the kernel or say M to
compile it as module (cmtp.o).
-BNEP multicast filter support
-CONFIG_BLUEZ_BNEP_MC_FILTER
- This option enables the multicast filter support for BNEP.
+HIDP protocol support
+CONFIG_BLUEZ_HIDP
+ HIDP (Human Interface Device Protocol) is a transport layer
+ for HID reports. HIDP is required for the Bluetooth Human
+ Interface Device Profile.
-BNEP protocol filter support
-CONFIG_BLUEZ_BNEP_PROTO_FILTER
- This option enables the protocol filter support for BNEP.
+ Say Y here to compile HIDP support into the kernel or say M to
+ compile it as module (hidp.o).
HCI UART driver
CONFIG_BLUEZ_HCIUART
@@ -23087,9 +23091,6 @@
3Com Bluetooth Card (3CRWB6096)
HP Bluetooth Card
- The HCI BT3C driver uses external firmware loader program provided in
- the BlueFW package. For more information, see <http://bluez.sf.net>.
-
Say Y here to compile support for HCI BT3C devices into the
kernel or say M to compile it as module (bt3c_cs.o).
diff -urN linux-2.4.25/drivers/bluetooth/bfusb.c linux-2.4.25-mh5/drivers/bluetooth/bfusb.c
--- linux-2.4.25/drivers/bluetooth/bfusb.c 2003-11-28 19:26:19.000000000 +0100
+++ linux-2.4.25-mh5/drivers/bluetooth/bfusb.c 2004-08-01 16:57:22.000000000 +0200
@@ -359,11 +359,11 @@
BT_DBG("bfusb %p urb %p skb %p len %d", bfusb, urb, skb, skb->len);
- if (!test_bit(HCI_RUNNING, &bfusb->hdev.flags))
- return;
-
read_lock(&bfusb->lock);
+ if (!test_bit(HCI_RUNNING, &bfusb->hdev.flags))
+ goto unlock;
+
if (urb->status || !count)
goto resubmit;
@@ -414,6 +414,7 @@
bfusb->hdev.name, urb, err);
}
+unlock:
read_unlock(&bfusb->lock);
}
diff -urN linux-2.4.25/drivers/bluetooth/bluecard_cs.c linux-2.4.25-mh5/drivers/bluetooth/bluecard_cs.c
--- linux-2.4.25/drivers/bluetooth/bluecard_cs.c 2002-11-29 00:53:12.000000000 +0100
+++ linux-2.4.25-mh5/drivers/bluetooth/bluecard_cs.c 2004-08-01 16:57:23.000000000 +0200
@@ -803,6 +803,9 @@
unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev);
+ if (info->link.state & DEV_CONFIG_PENDING)
+ return -ENODEV;
+
bluecard_hci_close(hdev);
clear_bit(CARD_READY, &(info->hw_state));
diff -urN linux-2.4.25/drivers/bluetooth/bt3c_cs.c linux-2.4.25-mh5/drivers/bluetooth/bt3c_cs.c
--- linux-2.4.25/drivers/bluetooth/bt3c_cs.c 2002-11-29 00:53:12.000000000 +0100
+++ linux-2.4.25-mh5/drivers/bluetooth/bt3c_cs.c 2004-08-01 16:57:23.000000000 +0200
@@ -24,8 +24,6 @@
#include <linux/config.h>
#include <linux/module.h>
-#define __KERNEL_SYSCALLS__
-
#include <linux/kernel.h>
#include <linux/kmod.h>
#include <linux/init.h>
@@ -48,6 +46,8 @@
#include <asm/bitops.h>
#include <asm/io.h>
+#include <linux/firmware.h>
+
#include <pcmcia/version.h>
#include <pcmcia/cs_types.h>
#include <pcmcia/cs.h>
@@ -485,78 +485,101 @@
-/* ======================== User mode firmware loader ======================== */
+/* ======================== Card services HCI interaction ======================== */
-#define FW_LOADER "/sbin/bluefw"
-static int errno;
+static int bt3c_load_firmware(bt3c_info_t *info, unsigned char *firmware, int count)
+{
+ char *ptr = (char *) firmware;
+ char b[9];
+ unsigned int iobase, size, addr, fcs, tmp;
+ int i, err = 0;
+ iobase = info->link.io.BasePort1;
-static int bt3c_fw_loader_exec(void *dev)
-{
- char *argv[] = { FW_LOADER, "pccard", dev, NULL };
- char *envp[] = { "HOME=/", "TERM=linux", "PATH=/sbin:/usr/sbin:/bin:/usr/bin", NULL };
- int err;
+ /* Reset */
- err = exec_usermodehelper(FW_LOADER, argv, envp);
- if (err)
- printk(KERN_WARNING "bt3c_cs: Failed to exec \"%s pccard %s\".\n", FW_LOADER, (char *)dev);
+ bt3c_io_write(iobase, 0x8040, 0x0404);
+ bt3c_io_write(iobase, 0x8040, 0x0400);
- return err;
-}
+ udelay(1);
+ bt3c_io_write(iobase, 0x8040, 0x0404);
-static int bt3c_firmware_load(bt3c_info_t *info)
-{
- sigset_t tmpsig;
- char dev[16];
- pid_t pid;
- int result;
+ udelay(17);
- /* Check if root fs is mounted */
- if (!current->fs->root) {
- printk(KERN_WARNING "bt3c_cs: Root filesystem is not mounted.\n");
- return -EPERM;
- }
+ /* Load */
- sprintf(dev, "%04x", info->link.io.BasePort1);
+ while (count) {
+ if (ptr[0] != 'S') {
+ printk(KERN_WARNING "bt3c_cs: Bad address in firmware.\n");
+ err = -EFAULT;
+ goto error;
+ }
- pid = kernel_thread(bt3c_fw_loader_exec, (void *)dev, 0);
- if (pid < 0) {
- printk(KERN_WARNING "bt3c_cs: Forking of kernel thread failed (errno=%d).\n", -pid);
- return pid;
- }
+ memset(b, 0, sizeof(b));
+ memcpy(b, ptr + 2, 2);
+ size = simple_strtol(b, NULL, 16);
+
+ memset(b, 0, sizeof(b));
+ memcpy(b, ptr + 4, 8);
+ addr = simple_strtol(b, NULL, 16);
+
+ memset(b, 0, sizeof(b));
+ memcpy(b, ptr + (size * 2) + 2, 2);
+ fcs = simple_strtol(b, NULL, 16);
+
+ memset(b, 0, sizeof(b));
+ for (tmp = 0, i = 0; i < size; i++) {
+ memcpy(b, ptr + (i * 2) + 2, 2);
+ tmp += simple_strtol(b, NULL, 16);
+ }
- /* Block signals, everything but SIGKILL/SIGSTOP */
- spin_lock_irq(¤t->sigmask_lock);
- tmpsig = current->blocked;
- siginitsetinv(¤t->blocked, sigmask(SIGKILL) | sigmask(SIGSTOP));
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ if (((tmp + fcs) & 0xff) != 0xff) {
+ printk(KERN_WARNING "bt3c_cs: Checksum error in firmware.\n");
+ err = -EILSEQ;
+ goto error;
+ }
- result = waitpid(pid, NULL, __WCLONE);
+ if (ptr[1] == '3') {
+ bt3c_address(iobase, addr);
- /* Allow signals again */
- spin_lock_irq(¤t->sigmask_lock);
- current->blocked = tmpsig;
- recalc_sigpending(current);
- spin_unlock_irq(¤t->sigmask_lock);
+ memset(b, 0, sizeof(b));
+ for (i = 0; i < (size - 4) / 2; i++) {
+ memcpy(b, ptr + (i * 4) + 12, 4);
+ tmp = simple_strtol(b, NULL, 16);
+ bt3c_put(iobase, tmp);
+ }
+ }
- if (result != pid) {
- printk(KERN_WARNING "bt3c_cs: Waiting for pid %d failed (errno=%d).\n", pid, -result);
- return -result;
+ ptr += (size * 2) + 6;
+ count -= (size * 2) + 6;
}
- return 0;
-}
+ udelay(17);
+ /* Boot */
+ bt3c_address(iobase, 0x3000);
+ outb(inb(iobase + CONTROL) | 0x40, iobase + CONTROL);
-/* ======================== Card services HCI interaction ======================== */
+error:
+ udelay(17);
+
+ /* Clear */
+
+ bt3c_io_write(iobase, 0x7006, 0x0000);
+ bt3c_io_write(iobase, 0x7005, 0x0000);
+ bt3c_io_write(iobase, 0x7001, 0x0000);
+
+ return err;
+}
int bt3c_open(bt3c_info_t *info)
{
+ const struct firmware *firmware;
+ char device[16];
struct hci_dev *hdev;
int err;
@@ -570,8 +593,22 @@
/* Load firmware */
- if ((err = bt3c_firmware_load(info)) < 0)
+ snprintf(device, sizeof(device), "bt3c%4.4x", info->link.io.BasePort1);
+
+ err = request_firmware(&firmware, "BT3CPCC.bin", device);
+ if (err < 0) {
+ printk(KERN_WARNING "bt3c_cs: Firmware request failed.\n");
return err;
+ }
+
+ err = bt3c_load_firmware(info, firmware->data, firmware->size);
+
+ release_firmware(firmware);
+
+ if (err < 0) {
+ printk(KERN_WARNING "bt3c_cs: Firmware loading failed.\n");
+ return err;
+ }
/* Timeout before it is safe to send the first HCI packet */
@@ -606,6 +643,9 @@
{
struct hci_dev *hdev = &(info->hdev);
+ if (info->link.state & DEV_CONFIG_PENDING)
+ return -ENODEV;
+
bt3c_hci_close(hdev);
if (hci_unregister_dev(hdev) < 0)
diff -urN linux-2.4.25/drivers/bluetooth/btuart_cs.c linux-2.4.25-mh5/drivers/bluetooth/btuart_cs.c
--- linux-2.4.25/drivers/bluetooth/btuart_cs.c 2003-06-13 16:51:32.000000000 +0200
+++ linux-2.4.25-mh5/drivers/bluetooth/btuart_cs.c 2004-08-01 16:57:23.000000000 +0200
@@ -556,6 +556,9 @@
unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev);
+ if (info->link.state & DEV_CONFIG_PENDING)
+ return -ENODEV;
+
btuart_hci_close(hdev);
spin_lock_irqsave(&(info->lock), flags);
diff -urN linux-2.4.25/drivers/bluetooth/dtl1_cs.c linux-2.4.25-mh5/drivers/bluetooth/dtl1_cs.c
--- linux-2.4.25/drivers/bluetooth/dtl1_cs.c 2002-11-29 00:53:12.000000000 +0100
+++ linux-2.4.25-mh5/drivers/bluetooth/dtl1_cs.c 2004-08-01 16:57:23.000000000 +0200
@@ -535,6 +535,9 @@
unsigned int iobase = info->link.io.BasePort1;
struct hci_dev *hdev = &(info->hdev);
+ if (info->link.state & DEV_CONFIG_PENDING)
+ return -ENODEV;
+
dtl1_hci_close(hdev);
spin_lock_irqsave(&(info->lock), flags);
diff -urN linux-2.4.25/drivers/bluetooth/hci_bcsp.c linux-2.4.25-mh5/drivers/bluetooth/hci_bcsp.c
--- linux-2.4.25/drivers/bluetooth/hci_bcsp.c 2003-06-13 16:51:32.000000000 +0200
+++ linux-2.4.25-mh5/drivers/bluetooth/hci_bcsp.c 2004-08-01 16:57:23.000000000 +0200
@@ -34,7 +34,6 @@
#include <linux/module.h>
#include <linux/version.h>
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
@@ -635,7 +634,8 @@
struct sk_buff *skb;
unsigned long flags;
- BT_ERR("Timeout, retransmitting %u pkts", bcsp->unack.qlen);
+ BT_DBG("hu %p retransmitting %u pkts", hu, bcsp->unack.qlen);
+
spin_lock_irqsave(&bcsp->unack.lock, flags);
while ((skb = __skb_dequeue_tail(&bcsp->unack)) != NULL) {
diff -urN linux-2.4.25/drivers/bluetooth/hci_ldisc.c linux-2.4.25-mh5/drivers/bluetooth/hci_ldisc.c
--- linux-2.4.25/drivers/bluetooth/hci_ldisc.c 2003-06-13 16:51:32.000000000 +0200
+++ linux-2.4.25-mh5/drivers/bluetooth/hci_ldisc.c 2004-08-01 16:57:22.000000000 +0200
@@ -33,7 +33,6 @@
#include <linux/module.h>
#include <linux/version.h>
-#include <linux/config.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
diff -urN linux-2.4.25/drivers/bluetooth/hci_uart.h linux-2.4.25-mh5/drivers/bluetooth/hci_uart.h
--- linux-2.4.25/drivers/bluetooth/hci_uart.h 2003-06-13 16:51:32.000000000 +0200
+++ linux-2.4.25-mh5/drivers/bluetooth/hci_uart.h 2004-08-01 16:57:22.000000000 +0200
@@ -35,11 +35,12 @@
#define HCIUARTGETPROTO _IOR('U', 201, int)
/* UART protocols */
-#define HCI_UART_MAX_PROTO 3
+#define HCI_UART_MAX_PROTO 4
#define HCI_UART_H4 0
#define HCI_UART_BCSP 1
-#define HCI_UART_NCSP 2
+#define HCI_UART_3WIRE 2
+#define HCI_UART_H4DS 3
#ifdef __KERNEL__
struct hci_uart;
diff -urN linux-2.4.25/drivers/bluetooth/hci_usb.c linux-2.4.25-mh5/drivers/bluetooth/hci_usb.c
--- linux-2.4.25/drivers/bluetooth/hci_usb.c 2004-02-18 14:36:31.000000000 +0100
+++ linux-2.4.25-mh5/drivers/bluetooth/hci_usb.c 2004-08-01 16:57:23.000000000 +0200
@@ -30,7 +30,7 @@
*
* $Id: hci_usb.c,v 1.8 2002/07/18 17:23:09 maxk Exp $
*/
-#define VERSION "2.4"
+#define VERSION "2.7"
#include <linux/config.h>
#include <linux/module.h>
@@ -70,29 +70,42 @@
static struct usb_driver hci_usb_driver;
static struct usb_device_id bluetooth_ids[] = {
- /* Digianswer device */
- { USB_DEVICE(0x08fd, 0x0001), driver_info: HCI_DIGIANSWER },
-
/* Generic Bluetooth USB device */
{ USB_DEVICE_INFO(HCI_DEV_CLASS, HCI_DEV_SUBCLASS, HCI_DEV_PROTOCOL) },
- /* Ericsson with non-standard id */
- { USB_DEVICE(0x0bdb, 0x1002) },
-
- /* ALPS Module with non-standard id */
- { USB_DEVICE(0x044e, 0x3002) },
+ /* AVM BlueFRITZ! USB v2.0 */
+ { USB_DEVICE(0x057c, 0x3800) },
/* Bluetooth Ultraport Module from IBM */
{ USB_DEVICE(0x04bf, 0x030a) },
+ /* ALPS Modules with non-standard id */
+ { USB_DEVICE(0x044e, 0x3001) },
+ { USB_DEVICE(0x044e, 0x3002) },
+
+ /* Ericsson with non-standard id */
+ { USB_DEVICE(0x0bdb, 0x1002) },
+
{ } /* Terminating entry */
};
MODULE_DEVICE_TABLE (usb, bluetooth_ids);
-static struct usb_device_id ignore_ids[] = {
+static struct usb_device_id blacklist_ids[] = {
/* Broadcom BCM2033 without firmware */
- { USB_DEVICE(0x0a5c, 0x2033) },
+ { USB_DEVICE(0x0a5c, 0x2033), driver_info: HCI_IGNORE },
+
+ /* Broadcom BCM2035 */
+ { USB_DEVICE(0x0a5c, 0x200a), driver_info: HCI_RESET },
+
+ /* ISSC Bluetooth Adapter v3.1 */
+ { USB_DEVICE(0x1131, 0x1001), driver_info: HCI_RESET },
+
+ /* Digianswer device */
+ { USB_DEVICE(0x08fd, 0x0001), driver_info: HCI_DIGIANSWER },
+
+ /* RTX Telecom based adapter with buggy SCO support */
+ { USB_DEVICE(0x0400, 0x0807), driver_info: HCI_BROKEN_ISOC },
{ } /* Terminating entry */
};
@@ -648,7 +661,7 @@
#endif
}
BT_DBG("new packet len %d", len);
-
+
skb = bluez_skb_alloc(len, GFP_ATOMIC);
if (!skb) {
BT_ERR("%s no memory for the packet", husb->hdev.name);
@@ -693,11 +706,11 @@
BT_DBG("%s urb %p type %d status %d count %d flags %x", hdev->name, urb,
_urb->type, urb->status, count, urb->transfer_flags);
- if (!test_bit(HCI_RUNNING, &hdev->flags))
- return;
-
read_lock(&husb->completion_lock);
+ if (!test_bit(HCI_RUNNING, &hdev->flags))
+ goto unlock;
+
if (urb->status || !count)
goto resubmit;
@@ -734,6 +747,8 @@
BT_DBG("%s urb %p type %d resubmit status %d", hdev->name, urb,
_urb->type, err);
}
+
+unlock:
read_unlock(&husb->completion_lock);
}
@@ -796,8 +811,14 @@
iface = &udev->actconfig->interface[0];
- /* Check our black list */
- if (usb_match_id(udev, iface, ignore_ids))
+ if (!id->driver_info) {
+ const struct usb_device_id *match;
+ match = usb_match_id(udev, iface, blacklist_ids);
+ if (match)
+ id = match;
+ }
+
+ if (id->driver_info & HCI_IGNORE)
return NULL;
/* Check number of endpoints */
@@ -864,7 +885,7 @@
}
#ifdef CONFIG_BLUEZ_HCIUSB_SCO
- if (!isoc_in_ep[1] || !isoc_out_ep[1]) {
+ if (id->driver_info & HCI_BROKEN_ISOC || !isoc_in_ep[1] || !isoc_out_ep[1]) {
BT_DBG("Isoc endpoints not found");
isoc_iface = NULL;
}
@@ -921,6 +942,9 @@
hdev->send = hci_usb_send_frame;
hdev->destruct = hci_usb_destruct;
+ if (id->driver_info & HCI_RESET)
+ set_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks);
+
if (hci_register_dev(hdev) < 0) {
BT_ERR("Can't register HCI device");
goto probe_error;
@@ -983,6 +1007,6 @@
module_init(hci_usb_init);
module_exit(hci_usb_cleanup);
-MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>");
+MODULE_AUTHOR("Maxim Krasnyansky <maxk@qualcomm.com>, Marcel Holtmann <marcel@holtmann.org>");
MODULE_DESCRIPTION("BlueZ HCI USB driver ver " VERSION);
MODULE_LICENSE("GPL");
diff -urN linux-2.4.25/drivers/bluetooth/hci_usb.h linux-2.4.25-mh5/drivers/bluetooth/hci_usb.h
--- linux-2.4.25/drivers/bluetooth/hci_usb.h 2003-11-28 19:26:20.000000000 +0100
+++ linux-2.4.25-mh5/drivers/bluetooth/hci_usb.h 2004-08-01 16:57:22.000000000 +0200
@@ -37,7 +37,10 @@
#define HCI_CTRL_REQ 0x20
#define HCI_DIGI_REQ 0x40
-#define HCI_DIGIANSWER 0x01
+#define HCI_IGNORE 0x01
+#define HCI_RESET 0x02
+#define HCI_DIGIANSWER 0x04
+#define HCI_BROKEN_ISOC 0x08
#define HCI_MAX_IFACE_NUM 3
diff -urN linux-2.4.25/drivers/bluetooth/Makefile.lib linux-2.4.25-mh5/drivers/bluetooth/Makefile.lib
--- linux-2.4.25/drivers/bluetooth/Makefile.lib 2003-11-28 19:26:19.000000000 +0100
+++ linux-2.4.25-mh5/drivers/bluetooth/Makefile.lib 2004-08-01 16:57:22.000000000 +0200
@@ -1 +1,2 @@
-obj-$(CONFIG_BLUEZ_HCIBFUSB) += firmware_class.o
+obj-$(CONFIG_BLUEZ_HCIBFUSB) += firmware_class.o
+obj-$(CONFIG_BLUEZ_HCIBT3C) += firmware_class.o
diff -urN linux-2.4.25/drivers/isdn/avmb1/capidrv.c linux-2.4.25-mh5/drivers/isdn/avmb1/capidrv.c
--- linux-2.4.25/drivers/isdn/avmb1/capidrv.c 2003-06-13 16:51:34.000000000 +0200
+++ linux-2.4.25-mh5/drivers/isdn/avmb1/capidrv.c 2004-08-01 16:57:22.000000000 +0200
@@ -523,13 +523,25 @@
static void send_message(capidrv_contr * card, _cmsg * cmsg)
{
- struct sk_buff *skb;
- size_t len;
+ struct sk_buff *skb;
+ size_t len;
+ u16 err;
+
capi_cmsg2message(cmsg, cmsg->buf);
len = CAPIMSG_LEN(cmsg->buf);
skb = alloc_skb(len, GFP_ATOMIC);
+ if(!skb) {
+ printk(KERN_ERR "no skb len(%d) memory\n", len);
+ return;
+ }
memcpy(skb_put(skb, len), cmsg->buf, len);
- (*capifuncs->capi_put_message) (global.appid, skb);
+ err = (*capifuncs->capi_put_message) (global.appid, skb);
+ if (err) {
+ printk(KERN_WARNING "%s: capi_put_message error: %04x\n",
+ __FUNCTION__, err);
+ kfree_skb(skb);
+ return;
+ }
global.nsentctlpkt++;
}
@@ -2188,10 +2200,10 @@
free_ncci(card, card->bchans[card->nbchan-1].nccip);
if (card->bchans[card->nbchan-1].plcip)
free_plci(card, card->bchans[card->nbchan-1].plcip);
- if (card->plci_list)
- printk(KERN_ERR "capidrv: bug in free_plci()\n");
card->nbchan--;
}
+ if (card->plci_list)
+ printk(KERN_ERR "capidrv: bug in free_plci()\n");
kfree(card->bchans);
card->bchans = 0;
diff -urN linux-2.4.25/drivers/isdn/avmb1/kcapi.c linux-2.4.25-mh5/drivers/isdn/avmb1/kcapi.c
--- linux-2.4.25/drivers/isdn/avmb1/kcapi.c 2003-06-13 16:51:34.000000000 +0200
+++ linux-2.4.25-mh5/drivers/isdn/avmb1/kcapi.c 2004-08-01 16:57:22.000000000 +0200
@@ -546,7 +546,13 @@
static void notify_up(__u32 contr)
{
struct capi_interface_user *p;
+ __u16 appl;
+ for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
+ if (!VALID_APPLID(appl)) continue;
+ if (APPL(appl)->releasing) continue;
+ CARD(contr)->driver->register_appl(CARD(contr), appl, &APPL(appl)->rparam);
+ }
printk(KERN_NOTICE "kcapi: notify up contr %d\n", contr);
spin_lock(&capi_users_lock);
for (p = capi_users; p; p = p->next) {
@@ -714,12 +720,16 @@
nextpp = &(*pp)->next;
}
}
- APPL(appl)->releasing--;
- if (APPL(appl)->releasing <= 0) {
- APPL(appl)->signal = 0;
- APPL_MARK_FREE(appl);
- printk(KERN_INFO "kcapi: appl %d down\n", appl);
- }
+ if (APPL(appl)->releasing) { /* only release if the application was marked for release */
+ printk(KERN_DEBUG "kcapi: appl %d releasing(%d)\n", appl, APPL(appl)->releasing);
+ APPL(appl)->releasing--;
+ if (APPL(appl)->releasing <= 0) {
+ APPL(appl)->signal = 0;
+ APPL_MARK_FREE(appl);
+ printk(KERN_INFO "kcapi: appl %d down\n", appl);
+ }
+ } else
+ printk(KERN_WARNING "kcapi: appl %d card%d released without request\n", appl, card->cnr);
}
/*
* ncci management
@@ -872,16 +882,7 @@
static void controllercb_ready(struct capi_ctr * card)
{
- __u16 appl;
-
card->cardstate = CARD_RUNNING;
-
- for (appl = 1; appl <= CAPI_MAXAPPL; appl++) {
- if (!VALID_APPLID(appl)) continue;
- if (APPL(appl)->releasing) continue;
- card->driver->register_appl(card, appl, &APPL(appl)->rparam);
- }
-
printk(KERN_NOTICE "kcapi: card %d \"%s\" ready.\n",
CARDNR(card), card->name);
diff -urN linux-2.4.25/drivers/usb/hid-core.c linux-2.4.25-mh5/drivers/usb/hid-core.c
--- linux-2.4.25/drivers/usb/hid-core.c 2004-02-18 14:36:31.000000000 +0100
+++ linux-2.4.25-mh5/drivers/usb/hid-core.c 2004-08-01 16:57:22.000000000 +0200
@@ -243,6 +243,9 @@
offset = report->size;
report->size += parser->global.report_size * parser->global.report_count;
+ if (usages < parser->global.report_count)
+ usages = parser->global.report_count;
+
if (usages == 0)
return 0; /* ignore padding fields */
@@ -254,9 +257,13 @@
field->application = hid_lookup_collection(parser, HID_COLLECTION_APPLICATION);
for (i = 0; i < usages; i++) {
- field->usage[i].hid = parser->local.usage[i];
+ int j = i;
+ /* Duplicate the last usage we parsed if we have excess values */
+ if (i >= parser->local.usage_index)
+ j = parser->local.usage_index - 1;
+ field->usage[i].hid = parser->local.usage[j];
field->usage[i].collection_index =
- parser->local.collection_index[i];
+ parser->local.collection_index[j];
}
field->maxusage = usages;
diff -urN linux-2.4.25/drivers/usb/hiddev.c linux-2.4.25-mh5/drivers/usb/hiddev.c
--- linux-2.4.25/drivers/usb/hiddev.c 2003-08-25 13:44:42.000000000 +0200
+++ linux-2.4.25-mh5/drivers/usb/hiddev.c 2004-08-01 16:57:22.000000000 +0200
@@ -396,7 +396,8 @@
struct hiddev_collection_info cinfo;
struct hiddev_report_info rinfo;
struct hiddev_field_info finfo;
- struct hiddev_usage_ref uref;
+ struct hiddev_usage_ref_multi uref_multi;
+ struct hiddev_usage_ref *uref = &uref_multi.uref;
struct hiddev_devinfo dinfo;
struct hid_report *report;
struct hid_field *field;
@@ -554,64 +555,93 @@
return copy_to_user((void *) arg, &finfo, sizeof(finfo));
case HIDIOCGUCODE:
- if (copy_from_user(&uref, (void *) arg, sizeof(uref)))
+ if (copy_from_user(uref, (void *) arg, sizeof(*uref)))
return -EFAULT;
- rinfo.report_type = uref.report_type;
- rinfo.report_id = uref.report_id;
+ rinfo.report_type = uref->report_type;
+ rinfo.report_id = uref->report_id;
if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL)
return -EINVAL;
- if (uref.field_index >= report->maxfield)
+ if (uref->field_index >= report->maxfield)
return -EINVAL;
- field = report->field[uref.field_index];
- if (uref.usage_index >= field->maxusage)
+ field = report->field[uref->field_index];
+ if (uref->usage_index >= field->maxusage)
return -EINVAL;
- uref.usage_code = field->usage[uref.usage_index].hid;
+ uref->usage_code = field->usage[uref->usage_index].hid;
- return copy_to_user((void *) arg, &uref, sizeof(uref));
+ return copy_to_user((void *) arg, uref, sizeof(*uref));
case HIDIOCGUSAGE:
case HIDIOCSUSAGE:
+ case HIDIOCGUSAGES:
+ case HIDIOCSUSAGES:
case HIDIOCGCOLLECTIONINDEX:
- if (copy_from_user(&uref, (void *) arg, sizeof(uref)))
- return -EFAULT;
+ if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
+ if (copy_from_user(&uref_multi, (void *) arg,
+ sizeof(uref_multi)))
+ return -EFAULT;
+ } else {
+ if (copy_from_user(uref, (void *) arg, sizeof(*uref)))
+ return -EFAULT;
+ }
- if (cmd == HIDIOCSUSAGE &&
- uref.report_type == HID_REPORT_TYPE_INPUT)
+ if (cmd != HIDIOCGUSAGE &&
+ cmd != HIDIOCGUSAGES &&
+ uref->report_type == HID_REPORT_TYPE_INPUT)
return -EINVAL;
- if (uref.report_id == HID_REPORT_ID_UNKNOWN) {
- field = hiddev_lookup_usage(hid, &uref);
+ if (uref->report_id == HID_REPORT_ID_UNKNOWN) {
+ field = hiddev_lookup_usage(hid, uref);
if (field == NULL)
return -EINVAL;
} else {
- rinfo.report_type = uref.report_type;
- rinfo.report_id = uref.report_id;
+ rinfo.report_type = uref->report_type;
+ rinfo.report_id = uref->report_id;
if ((report = hiddev_lookup_report(hid, &rinfo)) == NULL)
return -EINVAL;
- if (uref.field_index >= report->maxfield)
+ if (uref->field_index >= report->maxfield)
return -EINVAL;
- field = report->field[uref.field_index];
- if (uref.usage_index >= field->maxusage)
+ field = report->field[uref->field_index];
+ if (uref->usage_index >= field->maxusage)
return -EINVAL;
+
+ if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
+ if (uref_multi.num_values >= HID_MAX_USAGES ||
+ uref->usage_index >= field->maxusage ||
+ (uref->usage_index + uref_multi.num_values) >= field->maxusage)
+ return -EINVAL;
+ }
}
switch (cmd) {
case HIDIOCGUSAGE:
- uref.value = field->value[uref.usage_index];
- return copy_to_user((void *) arg, &uref, sizeof(uref));
+ uref->value = field->value[uref->usage_index];
+ return copy_to_user((void *) arg, uref, sizeof(*uref));
case HIDIOCSUSAGE:
- field->value[uref.usage_index] = uref.value;
+ field->value[uref->usage_index] = uref->value;
return 0;
case HIDIOCGCOLLECTIONINDEX:
- return field->usage[uref.usage_index].collection_index;
+ return field->usage[uref->usage_index].collection_index;
+ case HIDIOCGUSAGES:
+ for (i = 0; i < uref_multi.num_values; i++)
+ uref_multi.values[i] =
+ field->value[uref->usage_index + i];
+ if (copy_to_user((void *) arg, &uref_multi,
+ sizeof(uref_multi)))
+ return -EFAULT;
+ return 0;
+ case HIDIOCSUSAGES:
+ for (i = 0; i < uref_multi.num_values; i++)
+ field->value[uref->usage_index + i] =
+ uref_multi.values[i];
+ return 0;
}
break;
diff -urN linux-2.4.25/include/linux/hiddev.h linux-2.4.25-mh5/include/linux/hiddev.h
--- linux-2.4.25/include/linux/hiddev.h 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/include/linux/hiddev.h 2004-08-01 16:57:22.000000000 +0200
@@ -39,33 +39,33 @@
};
struct hiddev_devinfo {
- unsigned int bustype;
- unsigned int busnum;
- unsigned int devnum;
- unsigned int ifnum;
- short vendor;
- short product;
- short version;
- unsigned num_applications;
+ __u32 bustype;
+ __u32 busnum;
+ __u32 devnum;
+ __u32 ifnum;
+ __s16 vendor;
+ __s16 product;
+ __s16 version;
+ __u32 num_applications;
};
struct hiddev_collection_info {
- unsigned index;
- unsigned type;
- unsigned usage;
- unsigned level;
+ __u32 index;
+ __u32 type;
+ __u32 usage;
+ __u32 level;
};
#define HID_STRING_SIZE 256
struct hiddev_string_descriptor {
- int index;
+ __s32 index;
char value[HID_STRING_SIZE];
};
struct hiddev_report_info {
- unsigned report_type;
- unsigned report_id;
- unsigned num_fields;
+ __u32 report_type;
+ __u32 report_id;
+ __u32 num_fields;
};
/* To do a GUSAGE/SUSAGE, fill in at least usage_code, report_type and
@@ -88,20 +88,20 @@
#define HID_REPORT_TYPE_MAX 3
struct hiddev_field_info {
- unsigned report_type;
- unsigned report_id;
- unsigned field_index;
- unsigned maxusage;
- unsigned flags;
- unsigned physical; /* physical usage for this field */
- unsigned logical; /* logical usage for this field */
- unsigned application; /* application usage for this field */
+ __u32 report_type;
+ __u32 report_id;
+ __u32 field_index;
+ __u32 maxusage;
+ __u32 flags;
+ __u32 physical; /* physical usage for this field */
+ __u32 logical; /* logical usage for this field */
+ __u32 application; /* application usage for this field */
__s32 logical_minimum;
__s32 logical_maximum;
__s32 physical_minimum;
__s32 physical_maximum;
- unsigned unit_exponent;
- unsigned unit;
+ __u32 unit_exponent;
+ __u32 unit;
};
/* Fill in report_type, report_id and field_index to get the information on a
@@ -118,14 +118,22 @@
#define HID_FIELD_BUFFERED_BYTE 0x100
struct hiddev_usage_ref {
- unsigned report_type;
- unsigned report_id;
- unsigned field_index;
- unsigned usage_index;
- unsigned usage_code;
+ __u32 report_type;
+ __u32 report_id;
+ __u32 field_index;
+ __u32 usage_index;
+ __u32 usage_code;
__s32 value;
};
+/* hiddev_usage_ref_multi is used for sending multiple bytes to a control.
+ * It really manifests itself as setting the value of consecutive usages */
+struct hiddev_usage_ref_multi {
+ struct hiddev_usage_ref uref;
+ __u32 num_values;
+ __s32 values[HID_MAX_USAGES];
+};
+
/* FIELD_INDEX_NONE is returned in read() data from the kernel when flags
* is set to (HIDDEV_FLAG_UREF | HIDDEV_FLAG_REPORT) and a new report has
* been sent by the device
@@ -160,6 +168,11 @@
#define HIDIOCGCOLLECTIONINDEX _IOW('H', 0x10, struct hiddev_usage_ref)
#define HIDIOCGCOLLECTIONINFO _IOWR('H', 0x11, struct hiddev_collection_info)
+/* For writing/reading to multiple/consecutive usages */
+#define HIDIOCGUSAGES _IOWR('H', 0x12, struct hiddev_usage_ref_multi)
+#define HIDIOCSUSAGES _IOW('H', 0x13, struct hiddev_usage_ref_multi)
+
+
/*
* Flags to be used in HIDIOCSFLAG
*/
diff -urN linux-2.4.25/include/net/bluetooth/bluetooth.h linux-2.4.25-mh5/include/net/bluetooth/bluetooth.h
--- linux-2.4.25/include/net/bluetooth/bluetooth.h 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/include/net/bluetooth/bluetooth.h 2004-08-01 16:57:22.000000000 +0200
@@ -52,6 +52,7 @@
#define BTPROTO_RFCOMM 3
#define BTPROTO_BNEP 4
#define BTPROTO_CMTP 5
+#define BTPROTO_HIDP 6
#define SOL_HCI 0
#define SOL_L2CAP 6
diff -urN linux-2.4.25/include/net/bluetooth/hci_core.h linux-2.4.25-mh5/include/net/bluetooth/hci_core.h
--- linux-2.4.25/include/net/bluetooth/hci_core.h 2004-02-18 14:36:32.000000000 +0100
+++ linux-2.4.25-mh5/include/net/bluetooth/hci_core.h 2004-08-01 16:57:22.000000000 +0200
@@ -72,7 +72,9 @@
__u16 pkt_type;
__u16 link_policy;
__u16 link_mode;
-
+
+ unsigned long quirks;
+
atomic_t cmd_cnt;
unsigned int acl_cnt;
unsigned int sco_cnt;
diff -urN linux-2.4.25/include/net/bluetooth/hci.h linux-2.4.25-mh5/include/net/bluetooth/hci.h
--- linux-2.4.25/include/net/bluetooth/hci.h 2004-02-18 14:36:32.000000000 +0100
+++ linux-2.4.25-mh5/include/net/bluetooth/hci.h 2004-08-01 16:57:23.000000000 +0200
@@ -50,6 +50,11 @@
#define HCI_RS232 4
#define HCI_PCI 5
+/* HCI device quirks */
+enum {
+ HCI_QUIRK_RESET_ON_INIT
+};
+
/* HCI device flags */
enum {
HCI_UP,
@@ -469,7 +474,7 @@
__u8 pscan_period_mode;
__u8 dev_class[3];
__u16 clock_offset;
- __u8 rssi;
+ __s8 rssi;
} __attribute__ ((packed)) inquiry_info_with_rssi;
#define INQUIRY_INFO_WITH_RSSI_SIZE 14
diff -urN linux-2.4.25/include/net/bluetooth/l2cap.h linux-2.4.25-mh5/include/net/bluetooth/l2cap.h
--- linux-2.4.25/include/net/bluetooth/l2cap.h 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/include/net/bluetooth/l2cap.h 2004-08-01 16:57:23.000000000 +0200
@@ -190,6 +190,14 @@
} __attribute__ ((packed)) l2cap_info_rsp;
#define L2CAP_INFO_RSP_SIZE 4
+/* info type */
+#define L2CAP_IT_CL_MTU 0x0001
+#define L2CAP_IT_FEAT_MASK 0x0002
+
+/* info result */
+#define L2CAP_IR_SUCCESS 0x0000
+#define L2CAP_IR_NOTSUPP 0x0001
+
/* ----- L2CAP connections ----- */
struct l2cap_chan_list {
struct sock *head;
diff -urN linux-2.4.25/MAINTAINERS linux-2.4.25-mh5/MAINTAINERS
--- linux-2.4.25/MAINTAINERS 2004-02-18 14:36:30.000000000 +0100
+++ linux-2.4.25-mh5/MAINTAINERS 2004-08-01 16:57:23.000000000 +0200
@@ -328,6 +328,8 @@
M: maxk@qualcomm.com
L: bluez-devel@lists.sf.net
W: http://bluez.sf.net
+W: http://www.bluez.org
+W: http://www.holtmann.org/linux/bluetooth/
S: Maintained
BLUETOOTH RFCOMM LAYER
@@ -335,7 +337,6 @@
M: marcel@holtmann.org
P: Maxim Krasnyansky
M: maxk@qualcomm.com
-W: http://bluez.sf.net
S: Maintained
BLUETOOTH BNEP LAYER
@@ -343,65 +344,65 @@
M: marcel@holtmann.org
P: Maxim Krasnyansky
M: maxk@qualcomm.com
-W: http://bluez.sf.net
S: Maintained
BLUETOOTH CMTP LAYER
P: Marcel Holtmann
M: marcel@holtmann.org
-W: http://www.holtmann.org/linux/bluetooth/
S: Maintained
-BLUETOOTH HCI USB DRIVER
+BLUETOOTH HIDP LAYER
+P: Marcel Holtmann
+M: marcel@holtmann.org
+S: Maintained
+
+BLUETOOTH HCI UART DRIVER
P: Marcel Holtmann
M: marcel@holtmann.org
P: Maxim Krasnyansky
M: maxk@qualcomm.com
-W: http://bluez.sf.net
S: Maintained
-BLUETOOTH HCI UART DRIVER
+BLUETOOTH HCI USB DRIVER
P: Marcel Holtmann
M: marcel@holtmann.org
P: Maxim Krasnyansky
M: maxk@qualcomm.com
-W: http://bluez.sf.net
+S: Maintained
+
+BLUETOOTH HCI BCM203X DRIVER
+P: Marcel Holtmann
+M: marcel@holtmann.org
S: Maintained
BLUETOOTH HCI BFUSB DRIVER
P: Marcel Holtmann
M: marcel@holtmann.org
-W: http://www.holtmann.org/linux/bluetooth/
S: Maintained
BLUETOOTH HCI DTL1 DRIVER
P: Marcel Holtmann
M: marcel@holtmann.org
-W: http://www.holtmann.org/linux/bluetooth/
S: Maintained
BLUETOOTH HCI BLUECARD DRIVER
P: Marcel Holtmann
M: marcel@holtmann.org
-W: http://www.holtmann.org/linux/bluetooth/
S: Maintained
BLUETOOTH HCI BT3C DRIVER
P: Marcel Holtmann
M: marcel@holtmann.org
-W: http://www.holtmann.org/linux/bluetooth/
S: Maintained
BLUETOOTH HCI BTUART DRIVER
P: Marcel Holtmann
M: marcel@holtmann.org
-W: http://www.holtmann.org/linux/bluetooth/
S: Maintained
BLUETOOTH HCI VHCI DRIVER
P: Maxim Krasnyansky
M: maxk@qualcomm.com
-W: http://bluez.sf.net
S: Maintained
BONDING DRIVER
diff -urN linux-2.4.25/net/bluetooth/af_bluetooth.c linux-2.4.25-mh5/net/bluetooth/af_bluetooth.c
--- linux-2.4.25/net/bluetooth/af_bluetooth.c 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/net/bluetooth/af_bluetooth.c 2004-08-01 16:57:22.000000000 +0200
@@ -27,7 +27,7 @@
*
* $Id: af_bluetooth.c,v 1.8 2002/07/22 20:32:54 maxk Exp $
*/
-#define VERSION "2.3"
+#define VERSION "2.4"
#include <linux/config.h>
#include <linux/module.h>
@@ -57,7 +57,7 @@
#endif
/* Bluetooth sockets */
-#define BLUEZ_MAX_PROTO 6
+#define BLUEZ_MAX_PROTO 7
static struct net_proto_family *bluez_proto[BLUEZ_MAX_PROTO];
int bluez_sock_register(int proto, struct net_proto_family *ops)
@@ -221,12 +221,11 @@
unsigned int bluez_sock_poll(struct file * file, struct socket *sock, poll_table *wait)
{
struct sock *sk = sock->sk;
- unsigned int mask;
+ unsigned int mask = 0;
BT_DBG("sock %p, sk %p", sock, sk);
poll_wait(file, sk->sleep, wait);
- mask = 0;
if (sk->err || !skb_queue_empty(&sk->error_queue))
mask |= POLLERR;
@@ -242,9 +241,11 @@
if (sk->state == BT_CLOSED)
mask |= POLLHUP;
- if (sk->state == BT_CONNECT || sk->state == BT_CONNECT2)
+ if (sk->state == BT_CONNECT ||
+ sk->state == BT_CONNECT2 ||
+ sk->state == BT_CONFIG)
return mask;
-
+
if (sock_writeable(sk))
mask |= POLLOUT | POLLWRNORM | POLLWRBAND;
else
diff -urN linux-2.4.25/net/bluetooth/bnep/core.c linux-2.4.25-mh5/net/bluetooth/bnep/core.c
--- linux-2.4.25/net/bluetooth/bnep/core.c 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/net/bluetooth/bnep/core.c 2004-08-01 16:57:23.000000000 +0200
@@ -63,7 +63,7 @@
#define BT_DBG(D...)
#endif
-#define VERSION "1.1"
+#define VERSION "1.2"
static LIST_HEAD(bnep_session_list);
static DECLARE_RWSEM(bnep_session_sem);
@@ -113,13 +113,28 @@
return bnep_send(s, &rsp, sizeof(rsp));
}
+#ifdef CONFIG_BLUEZ_BNEP_PROTO_FILTER
+static inline void bnep_set_default_proto_filter(struct bnep_session *s)
+{
+ /* (IPv4, ARP) */
+ s->proto_filter[0].start = htons(0x0800);
+ s->proto_filter[0].end = htons(0x0806);
+ /* (RARP, AppleTalk) */
+ s->proto_filter[1].start = htons(0x8035);
+ s->proto_filter[1].end = htons(0x80F3);
+ /* (IPX, IPv6) */
+ s->proto_filter[2].start = htons(0x8137);
+ s->proto_filter[2].end = htons(0x86DD);
+}
+#endif
+
static int bnep_ctrl_set_netfilter(struct bnep_session *s, u16 *data, int len)
{
int n;
if (len < 2)
return -EILSEQ;
-
+
n = ntohs(get_unaligned(data));
data++; len -= 2;
@@ -141,9 +156,13 @@
BT_DBG("proto filter start %d end %d",
f[i].start, f[i].end);
}
+
if (i < BNEP_MAX_PROTO_FILTERS)
memset(f + i, 0, sizeof(*f));
+ if (n == 0)
+ bnep_set_default_proto_filter(s);
+
bnep_send_rsp(s, BNEP_FILTER_NET_TYPE_RSP, BNEP_SUCCESS);
} else {
bnep_send_rsp(s, BNEP_FILTER_NET_TYPE_RSP, BNEP_FILTER_LIMIT_REACHED);
@@ -160,7 +179,7 @@
if (len < 2)
return -EILSEQ;
-
+
n = ntohs(get_unaligned((u16 *) data));
data += 2; len -= 2;
@@ -214,7 +233,7 @@
int err = 0;
data++; len--;
-
+
switch (cmd) {
case BNEP_CMD_NOT_UNDERSTOOD:
case BNEP_SETUP_CONN_REQ:
@@ -268,13 +287,13 @@
/* Unknown extension, skip it. */
break;
}
-
+
if (!skb_pull(skb, h->len)) {
err = -EILSEQ;
break;
}
} while (!err && (h->type & BNEP_EXT_HEADER));
-
+
return err;
}
@@ -300,7 +319,7 @@
if ((type & BNEP_TYPE_MASK) > BNEP_RX_TYPES)
goto badframe;
-
+
if ((type & BNEP_TYPE_MASK) == BNEP_CONTROL) {
bnep_rx_control(s, skb->data, skb->len);
kfree_skb(skb);
@@ -326,7 +345,7 @@
goto badframe;
s->eh.h_proto = get_unaligned((u16 *) (skb->data - 2));
}
-
+
/* We have to alloc new skb and copy data here :(. Because original skb
* may not be modified and because of the alignment requirements. */
nskb = alloc_skb(2 + ETH_HLEN + skb->len, GFP_KERNEL);
@@ -342,7 +361,7 @@
case BNEP_COMPRESSED:
memcpy(__skb_put(nskb, ETH_HLEN), &s->eh, ETH_HLEN);
break;
-
+
case BNEP_COMPRESSED_SRC_ONLY:
memcpy(__skb_put(nskb, ETH_ALEN), s->eh.h_dest, ETH_ALEN);
memcpy(__skb_put(nskb, ETH_ALEN), skb->mac.raw, ETH_ALEN);
@@ -362,7 +381,7 @@
memcpy(__skb_put(nskb, skb->len), skb->data, skb->len);
kfree_skb(skb);
-
+
s->stats.rx_packets++;
nskb->dev = dev;
nskb->ip_summed = CHECKSUM_UNNECESSARY;
@@ -426,9 +445,9 @@
send:
iv[il++] = (struct iovec) { skb->data, skb->len };
len += skb->len;
-
+
/* FIXME: linearize skb */
-
+
s->msg.msg_iov = iv;
s->msg.msg_iovlen = il;
len = sock->ops->sendmsg(sock, &s->msg, len, NULL);
@@ -453,16 +472,16 @@
BT_DBG("");
- daemonize(); reparent_to_init();
+ daemonize(); reparent_to_init();
- sprintf(current->comm, "kbnepd %s", dev->name);
-
- sigfillset(¤t->blocked);
+ sprintf(current->comm, "kbnepd %s", dev->name);
+
+ sigfillset(¤t->blocked);
flush_signals(current);
current->nice = -15;
- set_fs(KERNEL_DS);
+ set_fs(KERNEL_DS);
init_waitqueue_entry(&wait, current);
add_wait_queue(sk->sleep, &wait);
@@ -477,13 +496,13 @@
if (sk->state != BT_CONNECTED)
break;
-
+
// TX
while ((skb = skb_dequeue(&sk->write_queue)))
if (bnep_tx_frame(s, skb))
break;
netif_wake_queue(dev);
-
+
schedule();
}
set_current_state(TASK_RUNNING);
@@ -547,28 +566,19 @@
s->sock = sock;
s->role = req->role;
s->state = BT_CONNECTED;
-
+
s->msg.msg_flags = MSG_NOSIGNAL;
#ifdef CONFIG_BLUEZ_BNEP_MC_FILTER
/* Set default mc filter */
set_bit(bnep_mc_hash(dev->broadcast), &s->mc_filter);
#endif
-
+
#ifdef CONFIG_BLUEZ_BNEP_PROTO_FILTER
/* Set default protocol filter */
-
- /* (IPv4, ARP) */
- s->proto_filter[0].start = htons(0x0800);
- s->proto_filter[0].end = htons(0x0806);
- /* (RARP, AppleTalk) */
- s->proto_filter[1].start = htons(0x8035);
- s->proto_filter[1].end = htons(0x80F3);
- /* (IPX, IPv6) */
- s->proto_filter[2].start = htons(0x8137);
- s->proto_filter[2].end = htons(0x86DD);
+ bnep_set_default_proto_filter(s);
#endif
-
+
dev->init = bnep_net_init;
dev->priv = s;
err = register_netdev(dev);
@@ -577,7 +587,7 @@
}
__bnep_link_session(s);
-
+
err = kernel_thread(bnep_session, s, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
if (err < 0) {
/* Session thread start failed, gotta cleanup. */
diff -urN linux-2.4.25/net/bluetooth/bnep/sock.c linux-2.4.25-mh5/net/bluetooth/bnep/sock.c
--- linux-2.4.25/net/bluetooth/bnep/sock.c 2004-02-18 14:36:32.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/bnep/sock.c 2004-08-01 16:57:22.000000000 +0200
@@ -94,8 +94,10 @@
if (!nsock)
return err;
- if (nsock->sk->state != BT_CONNECTED)
+ if (nsock->sk->state != BT_CONNECTED) {
+ fput(nsock->file);
return -EBADFD;
+ }
err = bnep_add_connection(&ca, nsock);
if (!err) {
diff -urN linux-2.4.25/net/bluetooth/cmtp/sock.c linux-2.4.25-mh5/net/bluetooth/cmtp/sock.c
--- linux-2.4.25/net/bluetooth/cmtp/sock.c 2004-02-18 14:36:32.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/cmtp/sock.c 2004-08-01 16:57:22.000000000 +0200
@@ -86,8 +86,10 @@
if (!nsock)
return err;
- if (nsock->sk->state != BT_CONNECTED)
+ if (nsock->sk->state != BT_CONNECTED) {
+ fput(nsock->file);
return -EBADFD;
+ }
err = cmtp_add_connection(&ca, nsock);
if (!err) {
diff -urN linux-2.4.25/net/bluetooth/Config.in linux-2.4.25-mh5/net/bluetooth/Config.in
--- linux-2.4.25/net/bluetooth/Config.in 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/net/bluetooth/Config.in 2004-08-01 16:57:23.000000000 +0200
@@ -14,6 +14,7 @@
source net/bluetooth/rfcomm/Config.in
source net/bluetooth/bnep/Config.in
source net/bluetooth/cmtp/Config.in
+ source net/bluetooth/hidp/Config.in
source drivers/bluetooth/Config.in
fi
diff -urN linux-2.4.25/net/bluetooth/hci_conn.c linux-2.4.25-mh5/net/bluetooth/hci_conn.c
--- linux-2.4.25/net/bluetooth/hci_conn.c 2004-02-18 14:36:32.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/hci_conn.c 2004-08-01 16:57:22.000000000 +0200
@@ -358,21 +358,24 @@
struct hci_conn_info *ci;
struct hci_dev *hdev;
struct list_head *p;
- int n = 0, size;
+ int n = 0, size, err;
if (copy_from_user(&req, (void *) arg, sizeof(req)))
return -EFAULT;
- if (!(hdev = hci_dev_get(req.dev_id)))
- return -ENODEV;
-
- size = req.conn_num * sizeof(struct hci_conn_info) + sizeof(req);
+ if (!req.conn_num || req.conn_num > (PAGE_SIZE * 2) / sizeof(*ci))
+ return -EINVAL;
- if (verify_area(VERIFY_WRITE, (void *)arg, size))
- return -EFAULT;
+ size = sizeof(req) + req.conn_num * sizeof(*ci);
if (!(cl = (void *) kmalloc(size, GFP_KERNEL)))
return -ENOMEM;
+
+ if (!(hdev = hci_dev_get(req.dev_id))) {
+ kfree(cl);
+ return -ENODEV;
+ }
+
ci = cl->conn_info;
hci_dev_lock_bh(hdev);
@@ -386,20 +389,21 @@
(ci + n)->out = c->out;
(ci + n)->state = c->state;
(ci + n)->link_mode = c->link_mode;
- n++;
+ if (++n >= req.conn_num)
+ break;
}
hci_dev_unlock_bh(hdev);
cl->dev_id = hdev->id;
cl->conn_num = n;
- size = n * sizeof(struct hci_conn_info) + sizeof(req);
+ size = sizeof(req) + n * sizeof(*ci);
hci_dev_put(hdev);
- copy_to_user((void *) arg, cl, size);
+ err = copy_to_user((void *) arg, cl, size);
kfree(cl);
- return 0;
+ return err ? -EFAULT : 0;
}
int hci_get_conn_info(struct hci_dev *hdev, unsigned long arg)
@@ -412,9 +416,6 @@
if (copy_from_user(&req, (void *) arg, sizeof(req)))
return -EFAULT;
- if (verify_area(VERIFY_WRITE, ptr, sizeof(ci)))
- return -EFAULT;
-
hci_dev_lock_bh(hdev);
conn = conn_hash_lookup_ba(hdev, req.type, &req.bdaddr);
if (conn) {
@@ -430,6 +431,5 @@
if (!conn)
return -ENOENT;
- copy_to_user(ptr, &ci, sizeof(ci));
- return 0;
+ return copy_to_user(ptr, &ci, sizeof(ci)) ? -EFAULT : 0;
}
diff -urN linux-2.4.25/net/bluetooth/hci_core.c linux-2.4.25-mh5/net/bluetooth/hci_core.c
--- linux-2.4.25/net/bluetooth/hci_core.c 2004-02-18 14:36:32.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/hci_core.c 2004-08-01 16:57:22.000000000 +0200
@@ -218,6 +218,10 @@
/* Mandatory initialization */
+ /* Reset */
+ if (test_bit(HCI_QUIRK_RESET_ON_INIT, &hdev->quirks))
+ hci_send_cmd(hdev, OGF_HOST_CTL, OCF_RESET, 0, NULL);
+
/* Read Local Supported Features */
hci_send_cmd(hdev, OGF_INFO_PARAM, OCF_READ_LOCAL_FEATURES, 0, NULL);
@@ -712,22 +716,20 @@
struct hci_dev_list_req *dl;
struct hci_dev_req *dr;
struct list_head *p;
- int n = 0, size;
+ int n = 0, size, err;
__u16 dev_num;
if (get_user(dev_num, (__u16 *) arg))
return -EFAULT;
- if (!dev_num)
+ if (!dev_num || dev_num > (PAGE_SIZE * 2) / sizeof(*dr))
return -EINVAL;
-
- size = dev_num * sizeof(*dr) + sizeof(*dl);
- if (verify_area(VERIFY_WRITE, (void *) arg, size))
- return -EFAULT;
+ size = sizeof(*dl) + dev_num * sizeof(*dr);
if (!(dl = kmalloc(size, GFP_KERNEL)))
return -ENOMEM;
+
dr = dl->dev_req;
read_lock_bh(&hdev_list_lock);
@@ -742,12 +744,12 @@
read_unlock_bh(&hdev_list_lock);
dl->dev_num = n;
- size = n * sizeof(*dr) + sizeof(*dl);
+ size = sizeof(*dl) + n * sizeof(*dr);
- copy_to_user((void *) arg, dl, size);
+ err = copy_to_user((void *) arg, dl, size);
kfree(dl);
- return 0;
+ return err ? -EFAULT : 0;
}
int hci_get_dev_info(unsigned long arg)
diff -urN linux-2.4.25/net/bluetooth/hci_event.c linux-2.4.25-mh5/net/bluetooth/hci_event.c
--- linux-2.4.25/net/bluetooth/hci_event.c 2004-02-18 14:36:32.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/hci_event.c 2004-08-01 16:57:22.000000000 +0200
@@ -320,7 +320,7 @@
status, batostr(&cc->bdaddr), conn);
if (status) {
- if (conn) {
+ if (conn && conn->state == BT_CONNECT) {
conn->state = BT_CLOSED;
hci_proto_connect_cfm(conn, status);
hci_conn_del(conn);
diff -urN linux-2.4.25/net/bluetooth/hidp/Config.in linux-2.4.25-mh5/net/bluetooth/hidp/Config.in
--- linux-2.4.25/net/bluetooth/hidp/Config.in 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/hidp/Config.in 2004-08-01 16:57:23.000000000 +0200
@@ -0,0 +1,5 @@
+#
+# Bluetooth HIDP layer configuration
+#
+
+dep_tristate 'HIDP protocol support' CONFIG_BLUEZ_HIDP $CONFIG_INPUT $CONFIG_BLUEZ_L2CAP
diff -urN linux-2.4.25/net/bluetooth/hidp/core.c linux-2.4.25-mh5/net/bluetooth/hidp/core.c
--- linux-2.4.25/net/bluetooth/hidp/core.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/hidp/core.c 2004-08-01 16:57:23.000000000 +0200
@@ -0,0 +1,655 @@
+/*
+ HIDP implementation for Linux Bluetooth stack (BlueZ).
+ Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2 as
+ published by the Free Software Foundation;
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+ CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+ COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+ SOFTWARE IS DISCLAIMED.
+*/
+
+#include <linux/config.h>
+#include <linux/module.h>
+
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/poll.h>
+#include <linux/fcntl.h>
+#include <linux/skbuff.h>
+#include <linux/socket.h>
+#include <linux/ioctl.h>
+#include <linux/file.h>
+#include <linux/init.h>
+#include <net/sock.h>
+
+#include <linux/input.h>
+
+#include <net/bluetooth/bluetooth.h>
+#include <net/bluetooth/l2cap.h>
+
+#include "hidp.h"
+
+#ifndef CONFIG_BT_HIDP_DEBUG
+#undef BT_DBG
+#define BT_DBG(D...)
+#endif
+
+#define VERSION "1.0"
+
+static DECLARE_RWSEM(hidp_session_sem);
+static LIST_HEAD(hidp_session_list);
+
+static unsigned char hidp_keycode[256] = {
+ 0, 0, 0, 0, 30, 48, 46, 32, 18, 33, 34, 35, 23, 36, 37, 38,
+ 50, 49, 24, 25, 16, 19, 31, 20, 22, 47, 17, 45, 21, 44, 2, 3,
+ 4, 5, 6, 7, 8, 9, 10, 11, 28, 1, 14, 15, 57, 12, 13, 26,
+ 27, 43, 43, 39, 40, 41, 51, 52, 53, 58, 59, 60, 61, 62, 63, 64,
+ 65, 66, 67, 68, 87, 88, 99, 70,119,110,102,104,111,107,109,106,
+ 105,108,103, 69, 98, 55, 74, 78, 96, 79, 80, 81, 75, 76, 77, 71,
+ 72, 73, 82, 83, 86,127,116,117,183,184,185,186,187,188,189,190,
+ 191,192,193,194,134,138,130,132,128,129,131,137,133,135,136,113,
+ 115,114, 0, 0, 0,121, 0, 89, 93,124, 92, 94, 95, 0, 0, 0,
+ 122,123, 90, 91, 85, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 29, 42, 56,125, 97, 54,100,126,164,166,165,163,161,115,114,113,
+ 150,158,159,128,136,177,178,176,142,152,173,140
+};
+
+static struct hidp_session *__hidp_get_session(bdaddr_t *bdaddr)
+{
+ struct hidp_session *session;
+ struct list_head *p;
+
+ BT_DBG("");
+
+ list_for_each(p, &hidp_session_list) {
+ session = list_entry(p, struct hidp_session, list);
+ if (!bacmp(bdaddr, &session->bdaddr))
+ return session;
+ }
+ return NULL;
+}
+
+static void __hidp_link_session(struct hidp_session *session)
+{
+ MOD_INC_USE_COUNT;
+ list_add(&session->list, &hidp_session_list);
+}
+
+static void __hidp_unlink_session(struct hidp_session *session)
+{
+ list_del(&session->list);
+ MOD_DEC_USE_COUNT;
+}
+
+static void __hidp_copy_session(struct hidp_session *session, struct hidp_conninfo *ci)
+{
+ bacpy(&ci->bdaddr, &session->bdaddr);
+
+ ci->flags = session->flags;
+ ci->state = session->state;
+
+ ci->vendor = 0x0000;
+ ci->product = 0x0000;
+ ci->version = 0x0000;
+ memset(ci->name, 0, 128);
+
+ if (session->input) {
+ ci->vendor = session->input->idvendor;
+ ci->product = session->input->idproduct;
+ ci->version = session->input->idversion;
+ if (session->input->name)
+ strncpy(ci->name, session->input->name, 128);
+ else
+ strncpy(ci->name, "HID Boot Device", 128);
+ }
+}
+
+static int hidp_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
+{
+ struct hidp_session *session = dev->private;
+ struct sk_buff *skb;
+ unsigned char newleds;
+
+ BT_DBG("session %p hid %p data %p size %d", session, device, data, size);
+
+ if (type != EV_LED)
+ return -1;
+
+ newleds = (!!test_bit(LED_KANA, dev->led) << 3) |
+ (!!test_bit(LED_COMPOSE, dev->led) << 3) |
+ (!!test_bit(LED_SCROLLL, dev->led) << 2) |
+ (!!test_bit(LED_CAPSL, dev->led) << 1) |
+ (!!test_bit(LED_NUML, dev->led));
+
+ if (session->leds == newleds)
+ return 0;
+
+ session->leds = newleds;
+
+ if (!(skb = alloc_skb(3, GFP_ATOMIC))) {
+ BT_ERR("Can't allocate memory for new frame");
+ return -ENOMEM;
+ }
+
+ *skb_put(skb, 1) = 0xa2;
+ *skb_put(skb, 1) = 0x01;
+ *skb_put(skb, 1) = newleds;
+
+ skb_queue_tail(&session->intr_transmit, skb);
+
+ hidp_schedule(session);
+
+ return 0;
+}
+
+static void hidp_input_report(struct hidp_session *session, struct sk_buff *skb)
+{
+ struct input_dev *dev = session->input;
+ unsigned char *keys = session->keys;
+ unsigned char *udata = skb->data + 1;
+ signed char *sdata = skb->data + 1;
+ int i, size = skb->len - 1;
+
+ switch (skb->data[0]) {
+ case 0x01: /* Keyboard report */
+ for (i = 0; i < 8; i++)
+ input_report_key(dev, hidp_keycode[i + 224], (udata[0] >> i) & 1);
+
+ for (i = 2; i < 8; i++) {
+ if (keys[i] > 3 && memscan(udata + 2, keys[i], 6) == udata + 8) {
+ if (hidp_keycode[keys[i]])
+ input_report_key(dev, hidp_keycode[keys[i]], 0);
+ else
+ BT_ERR("Unknown key (scancode %#x) released.", keys[i]);
+ }
+
+ if (udata[i] > 3 && memscan(keys + 2, udata[i], 6) == keys + 8) {
+ if (hidp_keycode[udata[i]])
+ input_report_key(dev, hidp_keycode[udata[i]], 1);
+ else
+ BT_ERR("Unknown key (scancode %#x) pressed.", udata[i]);
+ }
+ }
+
+ memcpy(keys, udata, 8);
+ break;
+
+ case 0x02: /* Mouse report */
+ input_report_key(dev, BTN_LEFT, sdata[0] & 0x01);
+ input_report_key(dev, BTN_RIGHT, sdata[0] & 0x02);
+ input_report_key(dev, BTN_MIDDLE, sdata[0] & 0x04);
+ input_report_key(dev, BTN_SIDE, sdata[0] & 0x08);
+ input_report_key(dev, BTN_EXTRA, sdata[0] & 0x10);
+
+ input_report_rel(dev, REL_X, sdata[1]);
+ input_report_rel(dev, REL_Y, sdata[2]);
+
+ if (size > 3)
+ input_report_rel(dev, REL_WHEEL, sdata[3]);
+ break;
+ }
+
+ input_event(dev, EV_RST, 0, 0);
+}
+
+static void hidp_idle_timeout(unsigned long arg)
+{
+ struct hidp_session *session = (struct hidp_session *) arg;
+
+ atomic_inc(&session->terminate);
+ hidp_schedule(session);
+}
+
+static inline void hidp_set_timer(struct hidp_session *session)
+{
+ if (session->idle_to > 0)
+ mod_timer(&session->timer, jiffies + HZ * session->idle_to);
+}
+
+static inline void hidp_del_timer(struct hidp_session *session)
+{
+ if (session->idle_to > 0)
+ del_timer(&session->timer);
+}
+
+static inline void hidp_send_message(struct hidp_session *session, unsigned char hdr)
+{
+ struct sk_buff *skb;
+
+ BT_DBG("session %p", session);
+
+ if (!(skb = alloc_skb(1, GFP_ATOMIC))) {
+ BT_ERR("Can't allocate memory for message");
+ return;
+ }
+
+ *skb_put(skb, 1) = hdr;
+
+ skb_queue_tail(&session->ctrl_transmit, skb);
+
+ hidp_schedule(session);
+}
+
+static inline int hidp_recv_frame(struct hidp_session *session, struct sk_buff *skb)
+{
+ __u8 hdr;
+
+ BT_DBG("session %p skb %p len %d", session, skb, skb->len);
+
+ hdr = skb->data[0];
+ skb_pull(skb, 1);
+
+ if (hdr == 0xa1) {
+ hidp_set_timer(session);
+
+ if (session->input)
+ hidp_input_report(session, skb);
+ } else {
+ BT_DBG("Unsupported protocol header 0x%02x", hdr);
+ }
+
+ kfree_skb(skb);
+ return 0;
+}
+
+static int hidp_send_frame(struct socket *sock, unsigned char *data, int len)
+{
+ struct iovec iv = { data, len };
+ struct msghdr msg;
+
+ BT_DBG("sock %p data %p len %d", sock, data, len);
+
+ if (!len)
+ return 0;
+
+ memset(&msg, 0, sizeof(msg));
+ msg.msg_iovlen = 1;
+ msg.msg_iov = &iv;
+
+ return sock_sendmsg(sock, &msg, len);
+}
+
+static int hidp_process_transmit(struct hidp_session *session)
+{
+ struct sk_buff *skb;
+
+ BT_DBG("session %p", session);
+
+ while ((skb = skb_dequeue(&session->ctrl_transmit))) {
+ if (hidp_send_frame(session->ctrl_sock, skb->data, skb->len) < 0) {
+ skb_queue_head(&session->ctrl_transmit, skb);
+ break;
+ }
+
+ hidp_set_timer(session);
+ kfree_skb(skb);
+ }
+
+ while ((skb = skb_dequeue(&session->intr_transmit))) {
+ if (hidp_send_frame(session->intr_sock, skb->data, skb->len) < 0) {
+ skb_queue_head(&session->intr_transmit, skb);
+ break;
+ }
+
+ hidp_set_timer(session);
+ kfree_skb(skb);
+ }
+
+ return skb_queue_len(&session->ctrl_transmit) +
+ skb_queue_len(&session->intr_transmit);
+}
+
+static int hidp_session(void *arg)
+{
+ struct hidp_session *session = arg;
+ struct sock *ctrl_sk = session->ctrl_sock->sk;
+ struct sock *intr_sk = session->intr_sock->sk;
+ struct sk_buff *skb;
+ int vendor = 0x0000, product = 0x0000;
+ wait_queue_t ctrl_wait, intr_wait;
+ unsigned long timeo = HZ;
+
+ BT_DBG("session %p", session);
+
+ if (session->input) {
+ vendor = session->input->idvendor;
+ product = session->input->idproduct;
+ }
+
+ daemonize(); reparent_to_init();
+
+ sprintf(current->comm, "khidpd_%04x%04x", vendor, product);
+
+ sigfillset(¤t->blocked);
+ flush_signals(current);
+
+ current->nice = -15;
+
+ set_fs(KERNEL_DS);
+
+ init_waitqueue_entry(&ctrl_wait, current);
+ init_waitqueue_entry(&intr_wait, current);
+ add_wait_queue(ctrl_sk->sleep, &ctrl_wait);
+ add_wait_queue(intr_sk->sleep, &intr_wait);
+ while (!atomic_read(&session->terminate)) {
+ set_current_state(TASK_INTERRUPTIBLE);
+
+ if (ctrl_sk->state != BT_CONNECTED || intr_sk->state != BT_CONNECTED)
+ break;
+
+ while ((skb = skb_dequeue(&ctrl_sk->receive_queue))) {
+ skb_orphan(skb);
+ hidp_recv_frame(session, skb);
+ }
+
+ while ((skb = skb_dequeue(&intr_sk->receive_queue))) {
+ skb_orphan(skb);
+ hidp_recv_frame(session, skb);
+ }
+
+ hidp_process_transmit(session);
+
+ schedule();
+ }
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(intr_sk->sleep, &intr_wait);
+ remove_wait_queue(ctrl_sk->sleep, &ctrl_wait);
+
+ down_write(&hidp_session_sem);
+
+ hidp_del_timer(session);
+
+ if (intr_sk->state != BT_CONNECTED) {
+ init_waitqueue_entry(&ctrl_wait, current);
+ add_wait_queue(ctrl_sk->sleep, &ctrl_wait);
+ while (timeo && ctrl_sk->state != BT_CLOSED) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ timeo = schedule_timeout(timeo);
+ }
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(ctrl_sk->sleep, &ctrl_wait);
+ timeo = HZ;
+ }
+
+ fput(session->ctrl_sock->file);
+
+ init_waitqueue_entry(&intr_wait, current);
+ add_wait_queue(intr_sk->sleep, &intr_wait);
+ while (timeo && intr_sk->state != BT_CLOSED) {
+ set_current_state(TASK_INTERRUPTIBLE);
+ timeo = schedule_timeout(timeo);
+ }
+ set_current_state(TASK_RUNNING);
+ remove_wait_queue(intr_sk->sleep, &intr_wait);
+
+ fput(session->intr_sock->file);
+
+ __hidp_unlink_session(session);
+
+ if (session->input) {
+ input_unregister_device(session->input);
+ kfree(session->input);
+ }
+
+ up_write(&hidp_session_sem);
+
+ kfree(session);
+ return 0;
+}
+
+static inline void hidp_setup_input(struct hidp_session *session, struct hidp_connadd_req *req)
+{
+ struct input_dev *input = session->input;
+ int i;
+
+ input->private = session;
+
+ input->idbus = BUS_BLUETOOTH;
+ input->idvendor = req->vendor;
+ input->idproduct = req->product;
+ input->idversion = req->version;
+
+ if (req->subclass & 0x40) {
+ set_bit(EV_KEY, input->evbit);
+ set_bit(EV_LED, input->evbit);
+ set_bit(EV_REP, input->evbit);
+
+ set_bit(LED_NUML, input->ledbit);
+ set_bit(LED_CAPSL, input->ledbit);
+ set_bit(LED_SCROLLL, input->ledbit);
+ set_bit(LED_COMPOSE, input->ledbit);
+ set_bit(LED_KANA, input->ledbit);
+
+ for (i = 0; i < sizeof(hidp_keycode); i++)
+ set_bit(hidp_keycode[i], input->keybit);
+ clear_bit(0, input->keybit);
+ }
+
+ if (req->subclass & 0x80) {
+ input->evbit[0] = BIT(EV_KEY) | BIT(EV_REL);
+ input->keybit[LONG(BTN_MOUSE)] = BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
+ input->relbit[0] = BIT(REL_X) | BIT(REL_Y);
+ input->keybit[LONG(BTN_MOUSE)] |= BIT(BTN_SIDE) | BIT(BTN_EXTRA);
+ input->relbit[0] |= BIT(REL_WHEEL);
+ }
+
+ input->event = hidp_input_event;
+
+ input_register_device(input);
+}
+
+int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock)
+{
+ struct hidp_session *session, *s;
+ int err;
+
+ BT_DBG("");
+
+ if (bacmp(&bluez_pi(ctrl_sock->sk)->src, &bluez_pi(intr_sock->sk)->src) ||
+ bacmp(&bluez_pi(ctrl_sock->sk)->dst, &bluez_pi(intr_sock->sk)->dst))
+ return -ENOTUNIQ;
+
+ session = kmalloc(sizeof(struct hidp_session), GFP_KERNEL);
+ if (!session)
+ return -ENOMEM;
+ memset(session, 0, sizeof(struct hidp_session));
+
+ session->input = kmalloc(sizeof(struct input_dev), GFP_KERNEL);
+ if (!session->input) {
+ kfree(session);
+ return -ENOMEM;
+ }
+ memset(session->input, 0, sizeof(struct input_dev));
+
+ down_write(&hidp_session_sem);
+
+ s = __hidp_get_session(&bluez_pi(ctrl_sock->sk)->dst);
+ if (s && s->state == BT_CONNECTED) {
+ err = -EEXIST;
+ goto failed;
+ }
+
+ bacpy(&session->bdaddr, &bluez_pi(ctrl_sock->sk)->dst);
+
+ session->ctrl_mtu = min_t(uint, l2cap_pi(ctrl_sock->sk)->omtu, l2cap_pi(ctrl_sock->sk)->imtu);
+ session->intr_mtu = min_t(uint, l2cap_pi(intr_sock->sk)->omtu, l2cap_pi(intr_sock->sk)->imtu);
+
+ BT_DBG("ctrl mtu %d intr mtu %d", session->ctrl_mtu, session->intr_mtu);
+
+ session->ctrl_sock = ctrl_sock;
+ session->intr_sock = intr_sock;
+ session->state = BT_CONNECTED;
+
+ init_timer(&session->timer);
+
+ session->timer.function = hidp_idle_timeout;
+ session->timer.data = (unsigned long) session;
+
+ skb_queue_head_init(&session->ctrl_transmit);
+ skb_queue_head_init(&session->intr_transmit);
+
+ session->flags = req->flags & (1 << HIDP_BLUETOOTH_VENDOR_ID);
+ session->idle_to = req->idle_to;
+
+ if (session->input)
+ hidp_setup_input(session, req);
+
+ __hidp_link_session(session);
+
+ hidp_set_timer(session);
+
+ err = kernel_thread(hidp_session, session, CLONE_FS | CLONE_FILES | CLONE_SIGHAND);
+ if (err < 0)
+ goto unlink;
+
+ if (session->input) {
+ hidp_send_message(session, 0x70);
+ session->flags |= (1 << HIDP_BOOT_PROTOCOL_MODE);
+
+ session->leds = 0xff;
+ hidp_input_event(session->input, EV_LED, 0, 0);
+ }
+
+ up_write(&hidp_session_sem);
+ return 0;
+
+unlink:
+ hidp_del_timer(session);
+
+ __hidp_unlink_session(session);
+
+ if (session->input)
+ input_unregister_device(session->input);
+
+failed:
+ up_write(&hidp_session_sem);
+
+ if (session->input)
+ kfree(session->input);
+
+ kfree(session);
+ return err;
+}
+
+int hidp_del_connection(struct hidp_conndel_req *req)
+{
+ struct hidp_session *session;
+ int err = 0;
+
+ BT_DBG("");
+
+ down_read(&hidp_session_sem);
+
+ session = __hidp_get_session(&req->bdaddr);
+ if (session) {
+ if (req->flags & (1 << HIDP_VIRTUAL_CABLE_UNPLUG)) {
+ hidp_send_message(session, 0x15);
+ } else {
+ /* Flush the transmit queues */
+ skb_queue_purge(&session->ctrl_transmit);
+ skb_queue_purge(&session->intr_transmit);
+
+ /* Kill session thread */
+ atomic_inc(&session->terminate);
+ hidp_schedule(session);
+ }
+ } else
+ err = -ENOENT;
+
+ up_read(&hidp_session_sem);
+ return err;
+}
+
+int hidp_get_connlist(struct hidp_connlist_req *req)
+{
+ struct list_head *p;
+ int err = 0, n = 0;
+
+ BT_DBG("");
+
+ down_read(&hidp_session_sem);
+
+ list_for_each(p, &hidp_session_list) {
+ struct hidp_session *session;
+ struct hidp_conninfo ci;
+
+ session = list_entry(p, struct hidp_session, list);
+
+ __hidp_copy_session(session, &ci);
+
+ if (copy_to_user(req->ci, &ci, sizeof(ci))) {
+ err = -EFAULT;
+ break;
+ }
+
+ if (++n >= req->cnum)
+ break;
+
+ req->ci++;
+ }
+ req->cnum = n;
+
+ up_read(&hidp_session_sem);
+ return err;
+}
+
+int hidp_get_conninfo(struct hidp_conninfo *ci)
+{
+ struct hidp_session *session;
+ int err = 0;
+
+ down_read(&hidp_session_sem);
+
+ session = __hidp_get_session(&ci->bdaddr);
+ if (session)
+ __hidp_copy_session(session, ci);
+ else
+ err = -ENOENT;
+
+ up_read(&hidp_session_sem);
+ return err;
+}
+
+static int __init hidp_init(void)
+{
+ l2cap_load();
+
+ hidp_init_sockets();
+
+ BT_INFO("BlueZ HIDP ver %s", VERSION);
+ BT_INFO("Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>");
+
+ return 0;
+}
+
+static void __exit hidp_exit(void)
+{
+ hidp_cleanup_sockets();
+}
+
+module_init(hidp_init);
+module_exit(hidp_exit);
+
+MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
+MODULE_DESCRIPTION("Bluetooth HIDP ver " VERSION);
+MODULE_LICENSE("GPL");
diff -urN linux-2.4.25/net/bluetooth/hidp/hidp.h linux-2.4.25-mh5/net/bluetooth/hidp/hidp.h
--- linux-2.4.25/net/bluetooth/hidp/hidp.h 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/hidp/hidp.h 2004-08-01 16:57:23.000000000 +0200
@@ -0,0 +1,122 @@
+/*
+ HIDP implementation for Linux Bluetooth stack (BlueZ).
+ Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2 as
+ published by the Free Software Foundation;
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+ CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+ COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+ SOFTWARE IS DISCLAIMED.
+*/
+
+#ifndef __HIDP_H
+#define __HIDP_H
+
+#include <linux/types.h>
+#include <net/bluetooth/bluetooth.h>
+
+/* HIDP ioctl defines */
+#define HIDPCONNADD _IOW('H', 200, int)
+#define HIDPCONNDEL _IOW('H', 201, int)
+#define HIDPGETCONNLIST _IOR('H', 210, int)
+#define HIDPGETCONNINFO _IOR('H', 211, int)
+
+#define HIDP_VIRTUAL_CABLE_UNPLUG 0
+#define HIDP_BOOT_PROTOCOL_MODE 1
+#define HIDP_BLUETOOTH_VENDOR_ID 9
+
+struct hidp_connadd_req {
+ int ctrl_sock; // Connected control socket
+ int intr_sock; // Connteted interrupt socket
+ __u16 parser;
+ __u16 rd_size;
+ __u8 *rd_data;
+ __u8 country;
+ __u8 subclass;
+ __u16 vendor;
+ __u16 product;
+ __u16 version;
+ __u32 flags;
+ __u32 idle_to;
+ char name[128];
+};
+
+struct hidp_conndel_req {
+ bdaddr_t bdaddr;
+ __u32 flags;
+};
+
+struct hidp_conninfo {
+ bdaddr_t bdaddr;
+ __u32 flags;
+ __u16 state;
+ __u16 vendor;
+ __u16 product;
+ __u16 version;
+ char name[128];
+};
+
+struct hidp_connlist_req {
+ __u32 cnum;
+ struct hidp_conninfo *ci;
+};
+
+int hidp_add_connection(struct hidp_connadd_req *req, struct socket *ctrl_sock, struct socket *intr_sock);
+int hidp_del_connection(struct hidp_conndel_req *req);
+int hidp_get_connlist(struct hidp_connlist_req *req);
+int hidp_get_conninfo(struct hidp_conninfo *ci);
+
+/* HIDP session defines */
+struct hidp_session {
+ struct list_head list;
+
+ struct socket *ctrl_sock;
+ struct socket *intr_sock;
+
+ bdaddr_t bdaddr;
+
+ unsigned long state;
+ unsigned long flags;
+ unsigned long idle_to;
+
+ uint ctrl_mtu;
+ uint intr_mtu;
+
+ atomic_t terminate;
+
+ unsigned char keys[8];
+ unsigned char leds;
+
+ struct input_dev *input;
+
+ struct timer_list timer;
+
+ struct sk_buff_head ctrl_transmit;
+ struct sk_buff_head intr_transmit;
+};
+
+static inline void hidp_schedule(struct hidp_session *session)
+{
+ struct sock *ctrl_sk = session->ctrl_sock->sk;
+ struct sock *intr_sk = session->intr_sock->sk;
+
+ wake_up_interruptible(ctrl_sk->sleep);
+ wake_up_interruptible(intr_sk->sleep);
+}
+
+/* HIDP init defines */
+extern int __init hidp_init_sockets(void);
+extern void __exit hidp_cleanup_sockets(void);
+
+#endif /* __HIDP_H */
diff -urN linux-2.4.25/net/bluetooth/hidp/Makefile linux-2.4.25-mh5/net/bluetooth/hidp/Makefile
--- linux-2.4.25/net/bluetooth/hidp/Makefile 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/hidp/Makefile 2004-08-01 16:57:23.000000000 +0200
@@ -0,0 +1,10 @@
+#
+# Makefile for the Linux Bluetooth HIDP layer
+#
+
+O_TARGET := hidp.o
+
+obj-y := core.o sock.o
+obj-m += $(O_TARGET)
+
+include $(TOPDIR)/Rules.make
diff -urN linux-2.4.25/net/bluetooth/hidp/sock.c linux-2.4.25-mh5/net/bluetooth/hidp/sock.c
--- linux-2.4.25/net/bluetooth/hidp/sock.c 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/hidp/sock.c 2004-08-01 16:57:23.000000000 +0200
@@ -0,0 +1,212 @@
+/*
+ HIDP implementation for Linux Bluetooth stack (BlueZ).
+ Copyright (C) 2003-2004 Marcel Holtmann <marcel@holtmann.org>
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License version 2 as
+ published by the Free Software Foundation;
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD PARTY RIGHTS.
+ IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) AND AUTHOR(S) BE LIABLE FOR ANY
+ CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
+ WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+
+ ALL LIABILITY, INCLUDING LIABILITY FOR INFRINGEMENT OF ANY PATENTS,
+ COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS, RELATING TO USE OF THIS
+ SOFTWARE IS DISCLAIMED.
+*/
+
+#include <linux/config.h>
+#include <linux/module.h>
+
+#include <linux/types.h>
+#include <linux/errno.h>
+#include <linux/kernel.h>
+#include <linux/major.h>
+#include <linux/sched.h>
+#include <linux/slab.h>
+#include <linux/poll.h>
+#include <linux/fcntl.h>
+#include <linux/skbuff.h>
+#include <linux/socket.h>
+#include <linux/ioctl.h>
+#include <linux/file.h>
+#include <linux/init.h>
+#include <net/sock.h>
+
+#include "hidp.h"
+
+#ifndef CONFIG_BT_HIDP_DEBUG
+#undef BT_DBG
+#define BT_DBG(D...)
+#endif
+
+static int hidp_sock_release(struct socket *sock)
+{
+ struct sock *sk = sock->sk;
+
+ BT_DBG("sock %p sk %p", sock, sk);
+
+ if (!sk)
+ return 0;
+
+ sock_orphan(sk);
+ sock_put(sk);
+
+ MOD_DEC_USE_COUNT;
+ return 0;
+}
+
+static int hidp_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
+{
+ struct hidp_connadd_req ca;
+ struct hidp_conndel_req cd;
+ struct hidp_connlist_req cl;
+ struct hidp_conninfo ci;
+ struct socket *csock;
+ struct socket *isock;
+ int err;
+
+ BT_DBG("cmd %x arg %lx", cmd, arg);
+
+ switch (cmd) {
+ case HIDPCONNADD:
+ if (!capable(CAP_NET_ADMIN))
+ return -EACCES;
+
+ if (copy_from_user(&ca, (void *) arg, sizeof(ca)))
+ return -EFAULT;
+
+ csock = sockfd_lookup(ca.ctrl_sock, &err);
+ if (!csock)
+ return err;
+
+ isock = sockfd_lookup(ca.intr_sock, &err);
+ if (!isock) {
+ fput(csock->file);
+ return err;
+ }
+
+ if (csock->sk->state != BT_CONNECTED || isock->sk->state != BT_CONNECTED) {
+ fput(csock->file);
+ fput(isock->file);
+ return -EBADFD;
+ }
+
+ err = hidp_add_connection(&ca, csock, isock);
+ if (!err) {
+ if (copy_to_user((void *) arg, &ca, sizeof(ca)))
+ err = -EFAULT;
+ } else {
+ fput(csock->file);
+ fput(isock->file);
+ }
+
+ return err;
+
+ case HIDPCONNDEL:
+ if (!capable(CAP_NET_ADMIN))
+ return -EACCES;
+
+ if (copy_from_user(&cd, (void *) arg, sizeof(cd)))
+ return -EFAULT;
+
+ return hidp_del_connection(&cd);
+
+ case HIDPGETCONNLIST:
+ if (copy_from_user(&cl, (void *) arg, sizeof(cl)))
+ return -EFAULT;
+
+ if (cl.cnum <= 0)
+ return -EINVAL;
+
+ err = hidp_get_connlist(&cl);
+ if (!err && copy_to_user((void *) arg, &cl, sizeof(cl)))
+ return -EFAULT;
+
+ return err;
+
+ case HIDPGETCONNINFO:
+ if (copy_from_user(&ci, (void *) arg, sizeof(ci)))
+ return -EFAULT;
+
+ err = hidp_get_conninfo(&ci);
+ if (!err && copy_to_user((void *) arg, &ci, sizeof(ci)))
+ return -EFAULT;
+
+ return err;
+ }
+
+ return -EINVAL;
+}
+
+static struct proto_ops hidp_sock_ops = {
+ family: PF_BLUETOOTH,
+ release: hidp_sock_release,
+ ioctl: hidp_sock_ioctl,
+ bind: sock_no_bind,
+ getname: sock_no_getname,
+ sendmsg: sock_no_sendmsg,
+ recvmsg: sock_no_recvmsg,
+ poll: sock_no_poll,
+ listen: sock_no_listen,
+ shutdown: sock_no_shutdown,
+ setsockopt: sock_no_setsockopt,
+ getsockopt: sock_no_getsockopt,
+ connect: sock_no_connect,
+ socketpair: sock_no_socketpair,
+ accept: sock_no_accept,
+ mmap: sock_no_mmap
+};
+
+static int hidp_sock_create(struct socket *sock, int protocol)
+{
+ struct sock *sk;
+
+ BT_DBG("sock %p", sock);
+
+ if (sock->type != SOCK_RAW)
+ return -ESOCKTNOSUPPORT;
+
+ sock->ops = &hidp_sock_ops;
+
+ if (!(sk = sk_alloc(PF_BLUETOOTH, GFP_KERNEL, 1)))
+ return -ENOMEM;
+
+ MOD_INC_USE_COUNT;
+
+ sock->state = SS_UNCONNECTED;
+ sock_init_data(sock, sk);
+
+ sk->destruct = NULL;
+ sk->protocol = protocol;
+
+ return 0;
+}
+
+static struct net_proto_family hidp_sock_family_ops = {
+ family: PF_BLUETOOTH,
+ create: hidp_sock_create
+};
+
+int __init hidp_init_sockets(void)
+{
+ int err;
+
+ if ((err = bluez_sock_register(BTPROTO_HIDP, &hidp_sock_family_ops)))
+ BT_ERR("Can't register HIDP socket layer (%d)", err);
+
+ return err;
+}
+
+void __exit hidp_cleanup_sockets(void)
+{
+ int err;
+
+ if ((err = bluez_sock_unregister(BTPROTO_HIDP)))
+ BT_ERR("Can't unregister HIDP socket layer (%d)", err);
+}
diff -urN linux-2.4.25/net/bluetooth/l2cap.c linux-2.4.25-mh5/net/bluetooth/l2cap.c
--- linux-2.4.25/net/bluetooth/l2cap.c 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/net/bluetooth/l2cap.c 2004-08-01 16:57:23.000000000 +0200
@@ -1642,6 +1642,35 @@
return 0;
}
+static inline int l2cap_information_req(struct l2cap_conn *conn, l2cap_cmd_hdr *cmd, u8 *data)
+{
+ l2cap_info_req *req = (l2cap_info_req *) data;
+ l2cap_info_rsp rsp;
+ u16 type;
+
+ type = __le16_to_cpu(req->type);
+
+ BT_DBG("type 0x%4.4x", type);
+
+ rsp.type = __cpu_to_le16(type);
+ rsp.result = __cpu_to_le16(L2CAP_IR_NOTSUPP);
+ l2cap_send_rsp(conn, cmd->ident, L2CAP_INFO_RSP, sizeof(rsp), &rsp);
+ return 0;
+}
+
+static inline int l2cap_information_rsp(struct l2cap_conn *conn, l2cap_cmd_hdr *cmd, u8 *data)
+{
+ l2cap_info_rsp *rsp = (l2cap_info_rsp *) data;
+ u16 type, result;
+
+ type = __le16_to_cpu(rsp->type);
+ result = __le16_to_cpu(rsp->result);
+
+ BT_DBG("type 0x%4.4x result 0x%2.2x", type, result);
+
+ return 0;
+}
+
static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb)
{
__u8 *data = skb->data;
@@ -1649,6 +1678,8 @@
l2cap_cmd_hdr cmd;
int err = 0;
+ l2cap_raw_recv(conn, skb);
+
while (len >= L2CAP_CMD_HDR_SIZE) {
memcpy(&cmd, data, L2CAP_CMD_HDR_SIZE);
data += L2CAP_CMD_HDR_SIZE;
@@ -1664,6 +1695,10 @@
}
switch (cmd.code) {
+ case L2CAP_COMMAND_REJ:
+ /* FIXME: We should process this */
+ break;
+
case L2CAP_CONN_REQ:
err = l2cap_connect_req(conn, &cmd, data);
break;
@@ -1688,23 +1723,23 @@
err = l2cap_disconnect_rsp(conn, &cmd, data);
break;
- case L2CAP_COMMAND_REJ:
- /* FIXME: We should process this */
- l2cap_raw_recv(conn, skb);
- break;
-
case L2CAP_ECHO_REQ:
l2cap_send_rsp(conn, cmd.ident, L2CAP_ECHO_RSP, cmd.len, data);
break;
case L2CAP_ECHO_RSP:
+ break;
+
case L2CAP_INFO_REQ:
+ err = l2cap_information_req(conn, &cmd, data);
+ break;
+
case L2CAP_INFO_RSP:
- l2cap_raw_recv(conn, skb);
+ err = l2cap_information_rsp(conn, &cmd, data);
break;
default:
- BT_ERR("Uknown signaling command 0x%2.2x", cmd.code);
+ BT_ERR("Unknown signaling command 0x%2.2x", cmd.code);
err = -EINVAL;
break;
};
@@ -1713,7 +1748,7 @@
l2cap_cmd_rej rej;
BT_DBG("error %d", err);
- /* FIXME: Map err to a valid reason. */
+ /* FIXME: Map err to a valid reason */
rej.reason = __cpu_to_le16(0);
l2cap_send_rsp(conn, cmd.ident, L2CAP_COMMAND_REJ, L2CAP_CMD_REJ_SIZE, &rej);
}
diff -urN linux-2.4.25/net/bluetooth/Makefile linux-2.4.25-mh5/net/bluetooth/Makefile
--- linux-2.4.25/net/bluetooth/Makefile 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/net/bluetooth/Makefile 2004-08-01 16:57:23.000000000 +0200
@@ -16,6 +16,7 @@
subdir-$(CONFIG_BLUEZ_RFCOMM) += rfcomm
subdir-$(CONFIG_BLUEZ_BNEP) += bnep
subdir-$(CONFIG_BLUEZ_CMTP) += cmtp
+subdir-$(CONFIG_BLUEZ_HIDP) += hidp
ifeq ($(CONFIG_BLUEZ_RFCOMM),y)
obj-y += rfcomm/rfcomm.o
@@ -25,6 +26,14 @@
obj-y += bnep/bnep.o
endif
+ifeq ($(CONFIG_BLUEZ_CMTP),y)
+obj-y += cmtp/cmtp.o
+endif
+
+ifeq ($(CONFIG_BLUEZ_HIDP),y)
+obj-y += hidp/hidp.o
+endif
+
include $(TOPDIR)/Rules.make
bluez.o: $(bluez-objs)
diff -urN linux-2.4.25/net/bluetooth/rfcomm/core.c linux-2.4.25-mh5/net/bluetooth/rfcomm/core.c
--- linux-2.4.25/net/bluetooth/rfcomm/core.c 2003-11-28 19:26:21.000000000 +0100
+++ linux-2.4.25-mh5/net/bluetooth/rfcomm/core.c 2004-08-01 16:57:22.000000000 +0200
@@ -1654,9 +1654,10 @@
nsock->sk->state_change = rfcomm_l2state_change;
s = rfcomm_session_add(nsock, BT_OPEN);
- if (s)
+ if (s) {
rfcomm_session_hold(s);
- else
+ rfcomm_schedule(RFCOMM_SCHED_RX);
+ } else
sock_release(nsock);
}
diff -urN linux-2.4.25/net/bluetooth/rfcomm/tty.c linux-2.4.25-mh5/net/bluetooth/rfcomm/tty.c
--- linux-2.4.25/net/bluetooth/rfcomm/tty.c 2003-08-25 13:44:44.000000000 +0200
+++ linux-2.4.25-mh5/net/bluetooth/rfcomm/tty.c 2004-08-01 16:57:22.000000000 +0200
@@ -109,6 +109,13 @@
static inline void rfcomm_dev_put(struct rfcomm_dev *dev)
{
+ /* The reason this isn't actually a race, as you no
+ doubt have a little voice screaming at you in your
+ head, is that the refcount should never actually
+ reach zero unless the device has already been taken
+ off the list, in rfcomm_dev_del(). And if that's not
+ true, we'll hit the BUG() in rfcomm_dev_destruct()
+ anyway. */
if (atomic_dec_and_test(&dev->refcnt))
rfcomm_dev_destruct(dev);
}
@@ -132,10 +139,13 @@
struct rfcomm_dev *dev;
read_lock(&rfcomm_dev_lock);
+
dev = __rfcomm_dev_get(id);
+ if (dev)
+ rfcomm_dev_hold(dev);
+
read_unlock(&rfcomm_dev_lock);
- if (dev) rfcomm_dev_hold(dev);
return dev;
}
@@ -328,12 +338,14 @@
BT_DBG("dev_id %id flags 0x%x", req.dev_id, req.flags);
- if (!capable(CAP_NET_ADMIN))
- return -EPERM;
-
if (!(dev = rfcomm_dev_get(req.dev_id)))
return -ENODEV;
+ if (dev->flags != NOCAP_FLAGS && !capable(CAP_NET_ADMIN)) {
+ rfcomm_dev_put(dev);
+ return -EPERM;
+ }
+
if (req.flags & (1 << RFCOMM_HANGUP_NOW))
rfcomm_dlc_close(dev->dlc, 0);
@@ -347,7 +359,7 @@
struct rfcomm_dev_list_req *dl;
struct rfcomm_dev_info *di;
struct list_head *p;
- int n = 0, size;
+ int n = 0, size, err;
u16 dev_num;
BT_DBG("");
@@ -355,14 +367,11 @@
if (get_user(dev_num, (u16 *) arg))
return -EFAULT;
- if (!dev_num)
+ if (!dev_num || dev_num > (PAGE_SIZE * 4) / sizeof(*di))
return -EINVAL;
size = sizeof(*dl) + dev_num * sizeof(*di);
- if (verify_area(VERIFY_WRITE, (void *)arg, size))
- return -EFAULT;
-
if (!(dl = kmalloc(size, GFP_KERNEL)))
return -ENOMEM;
@@ -387,9 +396,10 @@
dl->dev_num = n;
size = sizeof(*dl) + n * sizeof(*di);
- copy_to_user((void *) arg, dl, size);
+ err = copy_to_user((void *) arg, dl, size);
kfree(dl);
- return 0;
+
+ return err ? -EFAULT : 0;
}
static int rfcomm_get_dev_info(unsigned long arg)
@@ -486,7 +496,8 @@
rfcomm_dev_del(dev);
/* We have to drop DLC lock here, otherwise
- * rfcomm_dev_put() will dead lock if it's the last refference */
+ rfcomm_dev_put() will dead lock if it's
+ the last reference. */
rfcomm_dlc_unlock(dlc);
rfcomm_dev_put(dev);
rfcomm_dlc_lock(dlc);
@@ -541,6 +552,10 @@
BT_DBG("tty %p id %d", tty, id);
+ /* We don't leak this refcount. For reasons which are not entirely
+ clear, the TTY layer will call our ->close() method even if the
+ open fails. We decrease the refcount there, and decreasing it
+ here too would cause breakage. */
dev = rfcomm_dev_get(id);
if (!dev)
return -ENODEV;
|