/usr/include/hd.h is in libhd-dev 21.38-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 | #ifndef _HD_H
#define _HD_H
/**
* @defgroup libhdPublic Public interface
* @{
*/
#ifdef __cplusplus
extern "C" {
#endif
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* libhd data structures
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
/** Interface version */
#define HD_VERSION 21
#define HD_MINOR_VERSION 38
#define HD_FULL_VERSION (HD_VERSION * 1000 + HD_MINOR_VERSION)
/**
* @defgroup DEBUGpub Debug flags
* @ingroup libhdPublic
* hd_data_t debug flags
* @see hd_data_t::debug
* @{
*/
#define HD_DEB_SHOW_LOG (1 << 0)
#define HD_DEB_PROGRESS (1 << 1)
#define HD_DEB_CREATION (1 << 2)
#define HD_DEB_DRIVER_INFO (1 << 3)
#define HD_DEB_PCI (1 << 4)
#define HD_DEB_ISAPNP (1 << 5)
#define HD_DEB_CDROM (1 << 6)
#define HD_DEB_NET (1 << 7)
#define HD_DEB_FLOPPY (1 << 8)
#define HD_DEB_MISC (1 << 9)
#define HD_DEB_SERIAL (1 << 10)
#define HD_DEB_MONITOR (1 << 11)
#define HD_DEB_CPU (1 << 12)
#define HD_DEB_BIOS (1 << 13)
#define HD_DEB_MOUSE (1 << 14)
#define HD_DEB_IDE (1 << 15)
#define HD_DEB_SCSI (1 << 16)
#define HD_DEB_USB (1 << 17)
#define HD_DEB_ADB (1 << 18)
#define HD_DEB_MODEM (1 << 19)
#define HD_DEB_PARALLEL (1 << 20)
#define HD_DEB_ISA (1 << 21)
#define HD_DEB_BOOT (1 << 22)
#define HD_DEB_HDDB (1 << 23)
/** @} */
#include <stdio.h>
#include <inttypes.h>
#include <termios.h>
#include <sys/types.h>
//typedef struct vm_s vm_t;
/**
* libhd's directory
*/
#define HARDWARE_DIR "/var/lib/hardware"
/**
* \defgroup idmacros ID macros
* Macros to handle device and vendor ids.
*
* Example: to check if an id is a pci id and get its value,
* do something like this:
* \code
* if(ID_TAG(hd->dev) == TAG_PCI) {
* pci_id = ID_VALUE(hd->dev)
* }
* \endcode
*@{
*/
#define TAG_PCI 1 /**< PCI ids. */
#define TAG_EISA 2 /**< EISA ids (monitors, ISA-PnP, modems, mice etc). */
#define TAG_USB 3 /**< USB ids. */
#define TAG_SPECIAL 4 /**< Internally used ids. */
#define TAG_PCMCIA 5 /**< PCMCIA ids. */
#define TAG_SDIO 6 /**< SDIO ids. */
/**
* Get the real id value.
*/
#define ID_VALUE(id) ((id) & 0xffff)
/**
* Get the tag value.
*/
#define ID_TAG(id) (((id) >> 16) & 0xf)
/**
* Combine tag and id value.
*/
#define MAKE_ID(tag, id_val) ((tag << 16) | (id_val))
/*@}*/
/**
* flags to control the probing.
*/
typedef enum probe_feature {
pr_memory = 1, pr_pci, pr_isapnp, pr_net, pr_floppy, pr_misc,
pr_misc_serial, pr_misc_par, pr_misc_floppy, pr_serial, pr_cpu, pr_bios,
pr_monitor, pr_mouse, pr_scsi, pr_usb, pr_usb_mods, pr_adb, pr_modem,
pr_modem_usb, pr_parallel, pr_parallel_lp, pr_parallel_zip, pr_isa,
pr_isa_isdn, pr_isdn, pr_kbd, pr_prom, pr_sbus, pr_int, pr_braille,
pr_braille_alva, pr_braille_fhp, pr_braille_ht, pr_ignx11, pr_sys,
pr_bios_vbe, pr_isapnp_old, pr_isapnp_new, pr_isapnp_mod, pr_braille_baum,
pr_manual, pr_fb, pr_veth, pr_pppoe, pr_scan, pr_pcmcia, pr_fork,
pr_parallel_imm, pr_s390, pr_cpuemu, pr_sysfs, pr_s390disks, pr_udev,
pr_block, pr_block_cdrom, pr_block_part, pr_edd, pr_edd_mod, pr_bios_ddc,
pr_bios_fb, pr_bios_mode, pr_input, pr_block_mods, pr_bios_vesa,
pr_cpuemu_debug, pr_scsi_noserial, pr_wlan, pr_bios_crc, pr_hal,
pr_bios_vram, pr_bios_acpi, pr_bios_ddc_ports, pr_modules_pata,
pr_net_eeprom, pr_x86emu,
pr_max, pr_lxrc, pr_default,
pr_all /**< pr_all must be last */
} hd_probe_feature_t;
/**
* list types for hd_list()
*
* if you want to modify this: cf. manual.c::hw_items[]
*
* Note: hw_tv _must_ be < hw_display!
* Sync with check_hd and convert_hd!
*/
typedef enum hw_item {
hw_none = 0, hw_sys, hw_cpu, hw_keyboard, hw_braille, hw_mouse,
hw_joystick, hw_printer, hw_scanner, hw_chipcard, hw_monitor, hw_tv,
hw_display, hw_framebuffer, hw_camera, hw_sound, hw_storage_ctrl,
hw_network_ctrl, hw_isdn, hw_modem, hw_network, hw_disk, hw_partition,
hw_cdrom, hw_floppy, hw_manual, hw_usb_ctrl, hw_usb, hw_bios, hw_pci,
hw_isapnp, hw_bridge, hw_hub, hw_scsi, hw_ide, hw_memory, hw_dvb,
hw_pcmcia, hw_pcmcia_ctrl, hw_ieee1394, hw_ieee1394_ctrl, hw_hotplug,
hw_hotplug_ctrl, hw_zip, hw_pppoe, hw_wlan, hw_redasd, hw_dsl, hw_block,
hw_tape, hw_vbe, hw_bluetooth, hw_fingerprint, hw_mmc_ctrl,
/** append new entries here */
hw_unknown, hw_all /**< hw_all must be last */
} hd_hw_item_t;
/**
* @defgroup DEVCLASSpub Device class enums
* Device base classes and bus types
* @{
*/
/** base class values (superset of PCI classes) */
typedef enum base_classes {
// these *must* match standard PCI class numbers
bc_none, bc_storage, bc_network, bc_display, bc_multimedia,
bc_memory, bc_bridge, bc_comm, bc_system, bc_input, bc_docking,
bc_processor, bc_serial, bc_wireless, bc_i2o, bc_other = 0xff,
// add our own classes here (starting at 0x100 as PCI values are 8 bit)
bc_monitor = 0x100, bc_internal, bc_modem, bc_isdn, bc_ps2, bc_mouse,
bc_storage_device, bc_network_interface, bc_keyboard, bc_printer,
bc_hub, bc_braille, bc_scanner, bc_joystick, bc_chipcard, bc_camera,
bc_framebuffer, bc_dvb, bc_tv, bc_partition, bc_dsl, bc_bluetooth, bc_fingerprint,
bc_mmc_ctrl
} hd_base_classes_t;
/** subclass values of bc_monitor */
typedef enum sc_monitor {
sc_mon_other, sc_mon_crt, sc_mon_lcd
} hd_sc_monitor_t;
/** subclass values of bc_storage */
typedef enum sc_storage {
sc_sto_scsi, sc_sto_ide, sc_sto_floppy, sc_sto_ipi, sc_sto_raid,
sc_sto_other = 0x80
} hd_sc_storage_t;
/** subclass values of bc_display */
typedef enum sc_display {
sc_dis_vga, sc_dis_xga, sc_dis_other = 0x80
} hd_sc_display_t;
/** subclass values of bc_framebuffer */
typedef enum sc_framebuffer {
sc_fb_vesa = 1
} hd_sc_framebuffer_t;
/** subclass values of bc_bridge */
typedef enum sc_bridge {
sc_bridge_host, sc_bridge_isa, sc_bridge_eisa, sc_bridge_mc,
sc_bridge_pci, sc_bridge_pcmcia, sc_bridge_nubus, sc_bridge_cardbus,
sc_bridge_other = 0x80
} hd_sc_bridge_t;
/** subclass values of bc_comm */
typedef enum sc_comm {
sc_com_ser, sc_com_par, sc_com_multi, sc_com_modem, sc_com_other = 0x80
} hd_sc_comm_t;
/** subclass values of bc_system */
typedef enum sc_system {
sc_sys_pic, sc_sys_dma, sc_sys_timer, sc_sys_rtc, sc_sys_other = 0x80
} hd_sc_system_t;
/** subclass values of bc_input */
typedef enum sc_input {
sc_inp_keyb, sc_inp_digit, sc_inp_mouse, sc_inp_other = 0x80
} hd_sc_input_t;
/** subclass values of bc_serial */
typedef enum sc_serial {
sc_ser_fire, sc_ser_access, sc_ser_ssa, sc_ser_usb, sc_ser_fiber,
sc_ser_smbus, sc_ser_infiniband, sc_ser_other = 0x80
} hd_sc_serial_t;
/** internal sub class values (bc_internal) */
typedef enum sc_internal {
sc_int_none, sc_int_isapnp_if, sc_int_main_mem, sc_int_cpu, sc_int_fpu,
sc_int_bios, sc_int_prom, sc_int_sys
} hd_sc_internal_t;
/** subclass values of bc_mouse */
typedef enum sc_mouse {
sc_mou_ps2, sc_mou_ser, sc_mou_bus, sc_mou_usb, sc_mou_sun,
sc_mou_other = 0x80
} hd_sc_mouse_t;
/** subclass values of bc_storage_device */
typedef enum sc_std {
sc_sdev_disk, sc_sdev_tape, sc_sdev_cdrom, sc_sdev_floppy, sc_sdev_scanner,
sc_sdev_other = 0x80
} hd_sc_std_t;
/** subclass values of bc_network_interface */
typedef enum sc_net_if {
sc_nif_loopback, sc_nif_ethernet, sc_nif_tokenring, sc_nif_fddi,
sc_nif_ctc, sc_nif_iucv, sc_nif_hsi, sc_nif_qeth,
sc_nif_escon, sc_nif_myrinet, sc_nif_wlan, sc_nif_xp,
sc_nif_usb, sc_nif_other = 0x80, sc_nif_sit
} hd_sc_net_if_t;
/** subclass values of bc_multimedia */
typedef enum sc_multimedia {
sc_multi_video, sc_multi_audio, sc_multi_other
} hd_sc_multimedia_t;
/** subclass values of bc_keyboard */
typedef enum sc_keyboard {
sc_keyboard_kbd, sc_keyboard_console
} hd_sc_keyboard_t;
/** subclass values of bc_hub */
typedef enum sc_hub {
sc_hub_other, sc_hub_usb
} hd_sc_hub_t;
/** subclass values of bc_camera */
typedef enum sc_camera {
sc_camera_webcam, sc_camera_digital
} hd_sc_camera_t;
/** subclass values of bc_modem */
typedef enum sc_modem {
sc_mod_at, sc_mod_win1, sc_mod_win2, sc_mod_win3, sc_mod_win4
} hd_sc_modem_t;
/** subclass values of bc_dsl */
typedef enum sc_dsl {
sc_dsl_unknown, sc_dsl_pppoe, sc_dsl_capi, sc_dsl_capiisdn
} hd_sc_dsl_t;
/** prog_if's of sc_ser_usb */
typedef enum pif_usb_e {
pif_usb_uhci = 0, pif_usb_ohci = 0x10, pif_usb_ehci = 0x20,
pif_usb_other = 0x80, pif_usb_device = 0xfe
} hd_pif_usb_t;
/** CD-ROM prog_if values */
typedef enum pif_cdrom {
pif_cdrom, pif_cdr, pif_cdrw, pif_dvd, pif_dvdr, pif_dvdram
} hd_pif_cdrom_t ;
/** S/390 disk prog_if values */
typedef enum pif_s390disk {
pif_scsi, pif_dasd, pif_dasd_fba
} hd_pif_s390disk_t;
/** bus type values similar to PCI bridge subclasses */
typedef enum bus_types {
bus_none, bus_isa, bus_eisa, bus_mc, bus_pci, bus_pcmcia, bus_nubus,
bus_cardbus, bus_other,
/** outside the range of the PCI values */
bus_ps2 = 0x80, bus_serial, bus_parallel, bus_floppy, bus_scsi, bus_ide, bus_usb,
bus_adb, bus_raid, bus_sbus, bus_i2o, bus_vio, bus_ccw, bus_iucv, bus_ps3_system_bus,
bus_virtio, bus_ibmebus, bus_gameport, bus_uisvirtpci, bus_mmc, bus_sdio, bus_nd
} hd_bus_types_t;
/** @} */
/**
* Hardware status.
* The status is stored in /var/lib/hardware/unique-keys/ and used
* to detect if the hardware is new and has to be configured by some
* hardware %config tool.
*/
typedef struct {
/**
* Status fields are invalid.
*/
unsigned invalid:1;
/**
* Hardware should be reconfigured.
* Either \ref hd_status_t::status_yes or \ref hd_status_t::status_no.
* A hardware must be reconfigured if it is in state
* \ref hd_status_t::available == \ref hd_status_t::status_no and
* \ref hd_status_t::needed == \ref hd_status_t::status_yes.
* In other words, if a hardware that was
* needed to run the system is gone.
*/
unsigned reconfig:3;
/**
* Hardware %config status.
* Set to \ref hd_status_t::status_yes if the hardware has been configured, otherwise
* \ref hd_status_t::status_no.
*/
unsigned configured:3;
/**
* Hardware availability.
* Set to \ref hd_status_t::status_yes if the hardware has been detected or
* \ref hd_status_t::status_no if the hardware has not been found. You can set
* it to \ref hd_status_t::status_unknown to indicate that this hardware cannot
* be automatically detected (say, ISA cards).
* \note You can simulate all kinds of hardware on your system by
* creating entries in /var/lib/hardware/unique-keys/ that have
* \ref hd_status_t::available set to \ref hd_status_t::status_unknown.
*/
unsigned available:3;
/**
* Hardware is needed.
* Set to \ref hd_status_t::status_yes if this hardware is really necessary to run
* your computer. The effect will be that some hardware %config dialog
* is run if the hardware item is not found.
* Typical examples are graphics cards and mice.
*/
unsigned needed:3;
/**
* (Internal) original value of \ref available;
* This is used to keep track of the original value of the \ref hd_status_t::available
* state as it was stored in /var/lib/hardware/unique-keys/. (\ref hd_status_t::available
* is automatically updated during the detection process.)
*/
unsigned available_orig:3;
/**
* Hardware is active.
*/
unsigned active:3;
} hd_status_t;
/** hardware config status values */
typedef enum {
status_no = 1, status_yes, status_unknown, status_new
} hd_status_value_t;
/**
* Various types of hotplug devices.
*/
typedef enum {
hp_none, /**< Not a hotpluggable %device. */
hp_pcmcia, /**< PCMCIA %device. */
hp_cardbus, /**< Cardbus %device. */
hp_pci, /**< PCI hotplug %device. */
hp_usb, /**< USB %device. */
hp_ieee1394 /**< IEEE 1394 (FireWire) %device */
} hd_hotplug_t;
/**
* @defgroup HDDATATYPEpub General data types
* @brief General types used all over the library
* @{
*/
/**
* Holds ID + name pairs.
* Used for bus, class, vendor, %device and such.
*/
typedef struct {
unsigned id; /**< Numeric id. */
char *name; /**< Name (if any) that corresponds to \ref hd_id_t::id. */
} hd_id_t;
/**
* String list type.
* Used whenever we create a list of strings (e.g. file read).
*/
typedef struct s_str_list_t {
struct s_str_list_t *next; /**< Link to next member. */
char *str; /**< Some string data. */
} str_list_t;
/**
* Bitmap data type
*/
typedef struct {
unsigned char bitmap[16]; /**< large enough for all uses */
unsigned bits; /**< real bitmap length in bits */
unsigned not_empty:1; /**< at least 1 bit is set */
str_list_t *str; /**< interpreted bitmask */
} hd_bitmap_t;
/** @} */
/**
* @defgroup DEVINFOpub Device information structs
* @brief Standard device structs, compared to @ref HWDETAILpub
*/
/**
* @addtogroup DEVINFOpub
* @{
*/
/**
* for memory areas
*/
typedef struct {
unsigned start, size; /**< base address & size */
unsigned char *data; /**< actual data */
} memory_range_t;
/**
* smp info according to Intel smp spec (ia32)
*/
typedef struct {
unsigned ok:1; /**< data are valid */
unsigned rev; /**< MP spec revision */
unsigned mpfp; /**< MP Floating Pointer struct */
unsigned mpconfig_ok:1; /**< MP config table valid */
unsigned mpconfig; /**< MP config table */
unsigned mpconfig_size; /**< dto, size */
unsigned char feature[5]; /**< MP feature info */
char oem_id[9]; /**< oem id */
char prod_id[13]; /**< product id */
unsigned cpus, cpus_en; /**< number of cpus & ennabled cpus */
} smp_info_t;
/**
* VESA BIOS mode information item
*/
typedef struct vbe_mode_info_s {
unsigned number; /**< mode number */
unsigned attributes; /**< mode attributes */
unsigned width, height; /**< mode size */
unsigned bytes_p_line; /**< line length */
unsigned pixel_size; /**< bits per pixel */
unsigned fb_start; /**< frame buffer start address (if any) */
unsigned win_A_start; /**< window A start address */
unsigned win_A_attr; /**< window A attributes */
unsigned win_B_start; /**< window B start address */
unsigned win_B_attr; /**< window B attributes */
unsigned win_size; /**< window size in bytes */
unsigned win_gran; /**< window granularity in bytes */
unsigned pixel_clock; /**< maximum pixel clock */
} vbe_mode_info_t;
/**
* @brief VESA BIOS extensions information
* Also includes a VESA mode list
* @see vbe_mode_info_t
*/
typedef struct {
unsigned ok:1; /**< data are valid */
unsigned version; /**< vbe version */
unsigned oem_version; /**< oem version info */
unsigned memory; /**< in bytes */
unsigned fb_start; /**< != 0 if framebuffer is supported */
char *oem_name; /**< oem name */
char *vendor_name; /**< vendor name */
char *product_name; /**< product name */
char *product_revision; /**< product revision */
unsigned modes; /**< number of supported video modes */
vbe_mode_info_t *mode; /**< video mode list */
unsigned current_mode; /**< current video mode */
unsigned ddc_ports; /**< max ports to probe */
unsigned char ddc_port[4][0x80]; /**< ddc monitor info per port */
} vbe_info_t;
/**
* Compaq Controller Order EV (CQHORD) definition
*/
typedef struct {
unsigned id;
unsigned char slot;
unsigned char bus;
unsigned char devfn;
unsigned char misc;
} cpq_ctlorder_t;
typedef struct {
unsigned ok:1; /**< data are valid */
unsigned entry; /**< entry point */
unsigned compaq:1; /**< is compaq system */
cpq_ctlorder_t cpq_ctrl[32]; /**< 32 == MAX_CONTROLLERS */
} bios32_info_t;
/** @} */
/**
* @defgroup SMBIOSpub SMBIOS structures
* Structures holding decoded SMBIOS information
* @{
*/
/** smbios entries */
typedef enum {
sm_biosinfo, sm_sysinfo, sm_boardinfo, sm_chassis,
sm_processor, sm_memctrl, sm_memmodule, sm_cache,
sm_connect, sm_slot, sm_onboard, sm_oem,
sm_config, sm_lang, sm_group, sm_eventlog,
sm_memarray, sm_memdevice, sm_memerror, sm_memarraymap,
sm_memdevicemap, sm_mouse, sm_battery, sm_reset,
sm_secure, sm_power, sm_voltage, sm_cool,
sm_temperature, sm_current, sm_outofband, sm_bis,
sm_boot, sm_mem64error, sm_mandev, sm_mandevcomp,
sm_mdtd, sm_inactive = 126, sm_end = 127
} hd_smbios_type_t;
/** common part of all smbios_* types */
typedef struct {
union u_hd_smbios_t *next; /**< link to next entry */
hd_smbios_type_t type; /**< BIOS info type */
int data_len; /**< formatted section length */
unsigned char *data; /**< formatted section */
str_list_t *strings; /**< strings taken from the unformed section */
int handle; /**< handle, unique 16 bit number */
} smbios_any_t;
/** BIOS related information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *vendor; /**< vendor name */
char *version; /**< version (free form) */
char *date; /**< date mm/dd/yyyy (old: yy) */
hd_bitmap_t feature; /**< BIOS characteristics */
unsigned start; /**< start address */
unsigned rom_size; /**< ROM size (in bytes) */
} smbios_biosinfo_t;
/** overall system related information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *manuf; /**< manufacturer */
char *product; /**< product name */
char *version; /**< version */
char *serial; /**< serial number */
unsigned char uuid[16]; /**< universal unique id; all 0x00: undef, all 0xff: undef but settable */
hd_id_t wake_up; /**< wake-up type */
} smbios_sysinfo_t;
/** motherboard related information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *manuf; /**< manufacturer */
char *product; /**< product name */
char *version; /**< version */
char *serial; /**< serial number */
char *asset; /**< asset tag */
hd_id_t board_type; /**< board type */
hd_bitmap_t feature; /**< board features */
char *location; /**< location in chassis */
int chassis; /**< handle of chassis */
int objects_len; /**< number of contained objects */
int *objects; /**< array of object handles */
} smbios_boardinfo_t;
/** chassis information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *manuf; /**< manufacturer */
char *version; /**< version */
char *serial; /**< serial number */
char *asset; /**< asset tag */
hd_id_t ch_type; /**< chassis type */
unsigned lock; /**< 1: lock present, 0: not present or unknown */
hd_id_t bootup; /**< bootup state */
hd_id_t power; /**< power supply state (at last boot) */
hd_id_t thermal; /**< thermal state (at last boot) */
hd_id_t security; /**< security state (at last boot) */
unsigned oem; /**< OEM-specific information */
} smbios_chassis_t;
/** processor information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *socket; /**< socket */
hd_id_t upgrade; /**< socket type */
char *manuf; /**< manufacturer */
char *version; /**< version */
char *serial; /**< serial number */
char *asset; /**< asset tag */
char *part; /**< part number */
hd_id_t pr_type; /**< processor type */
hd_id_t family; /**< processor family */
uint64_t cpu_id; /**< processor id */
unsigned voltage; /**< in 0.1 V */
unsigned ext_clock; /**< MHz */
unsigned max_speed; /**< MHz */
unsigned current_speed; /**< MHz */
unsigned sock_status; /**< socket status (1: populated, 0: empty */
hd_id_t cpu_status; /**< cpu status */
int l1_cache; /**< handle of L1 cache */
int l2_cache; /**< handle of L2 cache */
int l3_cache; /**< handle of L3 cache */
} smbios_processor_t;
/** cache information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *socket; /**< socket designation */
unsigned max_size; /**< max cache size in kbytes */
unsigned current_size; /**< current size in kbytes */
unsigned speed; /**< cache speed in nanoseconds */
hd_id_t mode; /**< operational mode */
unsigned state; /**< 0/1: disabled/enabled */
hd_id_t location; /**< cache location */
unsigned socketed; /**< 0/1: not socketed/socketed */
unsigned level; /**< cache level (0 = L1, 1 = L2, ...) */
hd_id_t ecc; /**< error correction type */
hd_id_t cache_type; /**< logical cache type */
hd_id_t assoc; /**< cache associativity */
hd_bitmap_t supp_sram; /**< supported SRAM types */
hd_bitmap_t sram; /**< current SRAM type */
} smbios_cache_t;
/** port connector information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
hd_id_t port_type; /**< port type */
char *i_des; /**< internal reference designator */
hd_id_t i_type; /**< internal connector type */
char *x_des; /**< external reference designator */
hd_id_t x_type; /**< external connector type */
} smbios_connect_t;
/** system slot information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *desig; /**< slot designation */
hd_id_t slot_type; /**< slot type */
hd_id_t bus_width; /**< data bus width */
hd_id_t usage; /**< current usage */
hd_id_t length; /**< slot length */
unsigned id; /**< slot id */
hd_bitmap_t feature; /**< slot characteristics */
} smbios_slot_t;
/** on board devices information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
unsigned dev_len; /**< device list length */
struct {
char *name; /**< device name */
hd_id_t type; /**< device type */
unsigned status; /**< 0: disabled, 1: enabled */
} *dev; /**< device list */
} smbios_onboard_t;
/** OEM information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
str_list_t *oem_strings; /**< OEM strings */
} smbios_oem_t;
/** system config options */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
str_list_t *options; /**< system config options */
} smbios_config_t;
/** language information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings; /**< list of languages */
int handle;
char *current; /**< current language */
} smbios_lang_t;
/** group associations */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *name; /**< group name */
int items_len; /**< number of items in this group */
int *item_handles; /**< array of item handles */
} smbios_group_t;
/** physical memory array (consists of several memory devices) */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
hd_id_t location; /**< memory device location */
hd_id_t use; /**< memory usage */
hd_id_t ecc; /**< ECC types */
unsigned max_size; /**< maximum memory size in kB */
int error_handle; /**< points to error info record; 0xfffe: not supported, 0xffff: no error */
unsigned slots; /**< slots or sockets for this device */
} smbios_memarray_t;
/** memory device */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
char *location; /**< device location */
char *bank; /**< bank location */
char *manuf; /**< manufacturer */
char *serial; /**< serial number */
char *asset; /**< asset tag */
char *part; /**< part number */
int array_handle; /**< memory array this device belongs to */
int error_handle; /**< points to error info record; 0xfffe: not supported, 0xffff: no error */
unsigned width; /**< data width in bits */
unsigned eccbits; /**< ecc bits */
unsigned size; /**< kB */
hd_id_t form; /**< form factor */
unsigned set; /**< 0: does not belong to a set; 1-0xfe: set number; 0xff: unknown */
hd_id_t mem_type; /**< memory type */
hd_bitmap_t type_detail; /**< memory type details */
unsigned speed; /**< in MHz */
} smbios_memdevice_t;
/** 32-bit memory error information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
hd_id_t err_type; /**< error type memory */
hd_id_t granularity; /**< memory array or memory partition */
hd_id_t operation; /**< mem operation causing the error */
unsigned syndrome; /**< vendor-specific ECC syndrome; 0: unknown */
unsigned array_addr; /**< fault address rel. to mem array; 0x80000000: unknown */
unsigned device_addr; /**< fault address rel to mem device; 0x80000000: unknown */
unsigned range; /**< range, within which the error can be determined; 0x80000000: unknown */
} smbios_memerror_t;
/** memory array mapped address */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
int array_handle; /**< memory array this mapping belongs to */
uint64_t start_addr; /**< memory range start address */
uint64_t end_addr; /**< end address */
unsigned part_width; /**< number of memory devices */
} smbios_memarraymap_t;
/** memory device mapped address */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
int memdevice_handle; /**< memory device handle */
int arraymap_handle; /**< memory array mapping handle */
uint64_t start_addr; /**< memory range start address */
uint64_t end_addr; /**< end address */
unsigned row_pos; /**< position of the referenced memory device in a row of the address partition */
unsigned interleave_pos; /**< dto, in an interleave */
unsigned interleave_depth; /**< number of consecutive rows */
} smbios_memdevicemap_t;
/** pointing device (aka 'mouse') information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
hd_id_t mtype; /**< mouse type */
hd_id_t interface; /**< interface type */
unsigned buttons; /**< number of buttons */
} smbios_mouse_t;
/** hardware security */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
hd_id_t power; /**< power-on password status */
hd_id_t keyboard; /**< keyboard password status */
hd_id_t admin; /**< admin password status */
hd_id_t reset; /**< front panel reset status */
} smbios_secure_t;
/** system power controls */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
unsigned month; /**< next scheduled power-on month */
unsigned day; /**< dto, day */
unsigned hour; /**< dto, hour */
unsigned minute; /**< dto, minute */
unsigned second; /**< dto, second */
} smbios_power_t;
/** 64-bit memory error information */
typedef struct {
union u_hd_smbios_t *next;
hd_smbios_type_t type;
int data_len;
unsigned char *data;
str_list_t *strings;
int handle;
hd_id_t err_type; /**< error type memory */
hd_id_t granularity; /**< memory array or memory partition */
hd_id_t operation; /**< mem operation causing the error */
unsigned syndrome; /**< vendor-specific ECC syndrome; 0: unknown */
uint64_t array_addr; /**< fault address rel. to mem array; 0x80000000: unknown */
uint64_t device_addr; /**< fault address rel to mem device; 0x80000000: unknown */
unsigned range; /**< range, within which the error can be determined; 0x80000000: unknown */
} smbios_mem64error_t;
/** SMBIOS list item */
typedef union u_hd_smbios_t {
union u_hd_smbios_t *next;
smbios_any_t any;
smbios_biosinfo_t biosinfo;
smbios_sysinfo_t sysinfo;
smbios_boardinfo_t boardinfo;
smbios_chassis_t chassis;
smbios_processor_t processor;
smbios_cache_t cache;
smbios_connect_t connect;
smbios_slot_t slot;
smbios_onboard_t onboard;
smbios_oem_t oem;
smbios_config_t config;
smbios_lang_t lang;
smbios_group_t group;
smbios_memarray_t memarray;
smbios_memdevice_t memdevice;
smbios_memerror_t memerror;
smbios_memarraymap_t memarraymap;
smbios_memdevicemap_t memdevicemap;
smbios_mouse_t mouse;
smbios_secure_t secure;
smbios_power_t power;
smbios_mem64error_t mem64error;
} hd_smbios_t;
/** @} */
/**
* udev database info
*/
typedef struct s_udevinfo_t {
struct s_udevinfo_t *next;
char *sysfs;
char *name;
str_list_t *links;
} hd_udevinfo_t;
/**
* sysfs driver info
*/
typedef struct s_sysfsdrv_t {
struct s_sysfsdrv_t *next;
char *driver;
char *device;
char *module;
} hd_sysfsdrv_t;
/**
* device number; type is either 0 or 'b' or 'c'.
*
* range: number of nodes
*/
typedef struct {
int type;
unsigned major, minor, range;
} hd_dev_num_t;
/**
* @defgroup HWDETAILpub Hardware information
*
* Some hardware doesn't fit into the hd_t scheme or there is info we
* gathered during the scan process but that no-one really cares about. Such
* stuff is stored in hd_detail_t.
*
* @{
*/
/**
* @brief structure holding the (raw) PCI data
*/
typedef struct s_pci_t {
struct s_pci_t *next; /**< linked list */
unsigned data_len; /**< the actual length of the data field */
unsigned data_ext_len; /**< max. accessed config byte; see code */
unsigned char data[256]; /**< the PCI data */
char *log; /**< log messages */
unsigned flags, /**< various info, see enum pci_flags */
cmd, /**< PCI_COMMAND */
hdr_type, /**< PCI_HEADER_TYPE */
secondary_bus; /**< > 0 for PCI & CB bridges */
unsigned bus, /**< PCI bus #, *nothing* to do with hw_t.bus */
slot, func; /**< slot & function */
unsigned base_class, sub_class, prog_if; /**< PCI device classes */
unsigned dev, vend, sub_dev, sub_vend, rev; /**< vendor & device ids */
unsigned irq; /**< used irq, if any */
uint64_t base_addr[7]; /**< I/O or memory base */
uint64_t base_len[7]; /**< I/O or memory ranges */
unsigned addr_flags[7]; /**< I/O or memory address flags */
uint64_t rom_base_addr; /**< memory base for card ROM */
uint64_t rom_base_len; /**< memory range for card ROM */
char *sysfs_id; /**< sysfs path */
char *sysfs_bus_id; /**< sysfs bus id */
char *modalias; /**< module alias */
char *label; /**< Consistant Device Name (CDN), pci firmware spec 3.1, chapter 4.6.7 */
unsigned edid_len[6]; /**< edid record length */
unsigned char edid_data[6][0x80]; /**< edid record */
} pci_t;
/**
* @brief pci related flags
* cf. (pci_t).flags
*/
typedef enum pci_flags {
pci_flag_ok, pci_flag_pm, pci_flag_agp
} hd_pci_flags_t;
/**
* @brief raw USB data
* @see Linux USB docs
*/
typedef struct usb_s {
struct usb_s *next;
unsigned hd_idx;
unsigned hd_base_idx;
str_list_t *c, *d, *e, *i, *p, *s, *t;
struct usb_s *cloned;
int bus, dev_nr, lev, parent, port, count, conns, used_conns, ifdescr;
unsigned speed;
unsigned vendor, device, rev;
char *manufact, *product, *serial;
char *driver;
memory_range_t raw_descr;
int d_cls, d_sub, d_prot;
int i_alt, i_cls, i_sub, i_prot;
unsigned country;
} usb_t;
/**
* @brief ISA-PnP resource
*/
typedef struct {
int len;
int type;
unsigned char *data;
} isapnp_res_t;
/**
* @brief ISA-PnP card information (raw)
*/
typedef struct {
int csn;
int log_devs;
unsigned char *serial;
unsigned char *card_regs;
unsigned char (*ldev_regs)[0xd0];
int res_len;
unsigned broken:1; /**< mark a broken card */
isapnp_res_t *res;
} isapnp_card_t;
/**
* ISA-PnP collected card information struct
*/
typedef struct {
int read_port;
int cards;
isapnp_card_t *card;
} isapnp_t;
/**
* @brief ISA-PnP device information struct
*/
typedef struct {
isapnp_card_t *card;
int dev;
unsigned flags; /**< cf. enum isapnp_flags */
unsigned ref:1; /**< internally used flag */
} isapnp_dev_t;
/**
* @brief ISA-PnP related flags
* cf. (isapnp_dev_t).flags
*/
typedef enum isapnp_flags {
isapnp_flag_act
} hd_isapnp_flags_t;
/**
* @brief raw SCSI data
*/
typedef struct scsi_s {
struct scsi_s *next;
unsigned deleted:1;
unsigned generic:1;
unsigned fake:1;
unsigned wwpn_ok:1;
unsigned fcp_lun_ok:1;
char *dev_name;
char *guessed_dev_name;
int generic_dev;
unsigned host, channel, id, lun;
char *vendor, *model, *rev, *type_str, *serial;
int type;
unsigned inode_low;
char *proc_dir, *driver;
unsigned unique;
char *info;
unsigned lgeo_c, lgeo_h, lgeo_s;
unsigned pgeo_c, pgeo_h, pgeo_s;
uint64_t size;
unsigned sec_size;
unsigned cache;
str_list_t *host_info;
char *usb_guid;
unsigned pci_info;
unsigned pci_bus;
unsigned pci_slot;
unsigned pci_func;
uint64_t wwpn;
uint64_t fcp_lun;
char *controller_id;
} scsi_t;
/**
* @brief PROM tree on PPC
*/
typedef struct devtree_s {
struct devtree_s *next;
struct devtree_s *parent;
unsigned idx;
char *path, *filename;
unsigned pci:1;
char *name, *model, *device_type, *compatible;
char *ccin, *fru_number, *loc_code, *serial_number, *part_number;
char *description;
int class_code; /**< class : sub_class : prog-if */
int vendor_id, device_id, subvendor_id, subdevice_id;
int revision_id, interrupt;
unsigned char *edid; /**< 128 bytes */
} devtree_t;
enum pmac_model {
AAPL_3400,
AAPL_3500,
AAPL_7200,
AAPL_7300,
AAPL_7500,
AAPL_8500,
AAPL_9500,
AAPL_Gossamer,
AAPL_PowerBook1998,
AAPL_PowerMac_G3,
AAPL_ShinerESB,
AAPL_e407,
AAPL_e411,
PowerBook1_1,
PowerBook2_1,
PowerBook2_2,
PowerBook3_1,
PowerBook3_2,
PowerBook3_3,
PowerBook3_4,
PowerBook3_5,
PowerBook4_1,
PowerBook4_2,
PowerBook4_3,
PowerBook5_1,
PowerBook5_2,
PowerBook5_3,
PowerBook5_4,
PowerBook5_5,
PowerBook5_6,
PowerBook5_7,
PowerBook5_8,
PowerBook5_9,
PowerBook6_1,
PowerBook6_2,
PowerBook6_3,
PowerBook6_4,
PowerBook6_5,
PowerBook6_7,
PowerBook6_8,
PowerMac1_1,
PowerMac1_2,
PowerMac10_1,
PowerMac11_2,
PowerMac12_1,
PowerMac2_1,
PowerMac2_2,
PowerMac3_1,
PowerMac3_2,
PowerMac3_3,
PowerMac3_4,
PowerMac3_5,
PowerMac3_6,
PowerMac4_1,
PowerMac4_2,
PowerMac4_4,
PowerMac5_1,
PowerMac6_1,
PowerMac6_3,
PowerMac6_4,
PowerMac7_2,
PowerMac7_3,
PowerMac8_1,
PowerMac9_1,
RackMac1_1,
RackMac1_2,
RackMac3_1,
iMac_1,
};
/**
* @brief PowerMac model matching
*/
struct pmac_mb_def {
enum pmac_model model;
const char *string;
};
/**
* @brief Device/CU model numbers for S/390
*/
typedef struct ccw_s {
unsigned char lcss;
unsigned char cu_model;
unsigned char dev_model;
} ccw_t;
/**
* @brief Joystick details
*/
typedef struct joystick_s {
unsigned char buttons;
unsigned char axes;
} joystick_t;
/**
* @brief special CDROM entry
*/
typedef struct cdrom_info_s {
struct cdrom_info_s *next;
char *name;
unsigned speed;
unsigned cdr:1, cdrw:1, dvd:1, dvdr:1, dvdram:1;
unsigned cdrom:1; /**< cdrom in drive */
struct {
unsigned ok:1;
char *volume, *publisher, *preparer, *application, *creation_date;
} iso9660;
struct {
unsigned ok:1;
unsigned platform;
char *id_string;
unsigned bootable:1;
unsigned media_type; /**< boot emulation type */
unsigned load_address;
unsigned load_count; /**< sectors to load */
unsigned start; /**< start sector */
unsigned catalog; /**< boot catalog start */
struct {
unsigned c, h, s;
unsigned size;
} geo;
char *label;
} el_torito;
} cdrom_info_t;
/**
* @brief Floppy information
* note: obsolete, will be removed
* @deprecated
*/
typedef struct {
unsigned char block0[512];
} floppy_info_t;
/**
* @brief bios data (ix86)
*/
typedef struct {
unsigned apm_supported:1;
unsigned apm_enabled:1;
unsigned apm_ver, apm_subver;
unsigned apm_bios_flags;
unsigned vbe_ver;
unsigned vbe_video_mem;
unsigned ser_port0, ser_port1, ser_port2, ser_port3;
unsigned par_port0, par_port1, par_port2;
/** The id is still in big endian format! */
unsigned is_pnp_bios:1;
unsigned pnp_id;
unsigned lba_support:1;
unsigned low_mem_size;
smp_info_t smp;
vbe_info_t vbe;
unsigned smbios_ver;
struct {
unsigned width;
unsigned height;
unsigned xsize;
unsigned ysize;
char *vendor;
char *name;
} lcd;
struct {
char *vendor;
char *type;
unsigned bus;
unsigned compat_vend;
unsigned compat_dev;
} mouse;
struct {
unsigned ok:1;
unsigned scroll_lock:1;
unsigned num_lock:1;
unsigned caps_lock:1;
} led;
bios32_info_t bios32;
} bios_info_t;
/**
* @brief prom data (ppc, sparc)
*/
typedef struct {
unsigned has_color:1;
unsigned color;
} prom_info_t;
/**
* @brief general system data
*/
typedef struct {
char *system_type;
char *generation;
char *vendor;
char *model;
char *serial;
char *lang;
char *formfactor;
} sys_info_t;
/**
* @brief monitor (DDC) data
*/
typedef struct {
unsigned manu_year;
unsigned manu_week;
unsigned min_vsync, max_vsync; /**< vsync range */
unsigned min_hsync, max_hsync; /**< hsync range */
unsigned clock; /**< pixel clock in kHz */
unsigned width, height; /**< display size */
unsigned width_mm, height_mm; /**< dto, in mm */
unsigned hdisp, hsyncstart, hsyncend, htotal; /**< h_timings */
unsigned vdisp, vsyncstart, vsyncend, vtotal; /**< v_timings */
char hflag,vflag; /**< h/v flags */
char *vendor;
char *name;
char *serial;
} monitor_info_t;
/** @} */
/**
* @brief CPU architecture
*/
typedef enum cpu_arch {
arch_unknown = 0,
arch_intel,
arch_alpha,
arch_sparc, arch_sparc64,
arch_ppc, arch_ppc64,
arch_68k,
arch_ia64,
arch_s390, arch_s390x,
arch_arm,
arch_mips,
arch_x86_64,
arch_aarch64
} hd_cpu_arch_t;
/**
* @todo drop boot_arch at all?
*/
typedef enum boot_arch {
boot_unknown = 0,
boot_lilo, boot_milo, boot_aboot, boot_silo, boot_ppc, boot_elilo, boot_s390,
boot_mips, boot_grub, boot_uboot,
} hd_boot_arch_t;
/**
* @addtogroup HWDETAILpub
* @{
*/
/**
* @brief special cpu entry
*/
typedef struct {
enum cpu_arch architecture;
unsigned family; /**< axp: cpu variation */
unsigned model; /**< axp: cpu revision */
unsigned stepping;
unsigned cache;
unsigned clock;
unsigned units; /**< >1 "hyperthreading" */
char *vend_name; /**< axp: system type */
char *model_name; /**< axp: cpu model */
char *platform; /**< x86: NULL */
str_list_t *features; /**< x86: flags */
double bogo; /**< bogo mips */
} cpu_info_t;
/**
* @brief enhanced disk data
* (cf. edd.c)
*/
typedef struct {
uint64_t sectors;
struct {
unsigned cyls, heads, sectors;
} edd;
struct {
unsigned cyls, heads, sectors;
} legacy;
unsigned ext_fixed_disk:1;
unsigned ext_lock_eject:1;
unsigned ext_edd:1;
unsigned ext_64bit:1;
unsigned assigned:1;
unsigned valid:1;
unsigned ext_fibre:1;
unsigned ext_net:1;
char *sysfs_id;
unsigned hd_idx;
unsigned signature;
} edd_info_t;
/** @} */
/**
* Hardware DB (v1) data
*/
typedef struct {
unsigned data_len, data_max;
unsigned *data;
unsigned names_len, names_max;
char *names;
} hddb_data_t;
/**
* Hardware DB item entry mask
*/
typedef uint32_t hddb_entry_mask_t;
/**
* Hardware DB list item
*/
typedef struct hddb_list_s {
hddb_entry_mask_t key_mask;
hddb_entry_mask_t value_mask;
unsigned key;
unsigned value;
} hddb_list_t;
/**
* Hardware DB (v2) data
*/
typedef struct {
unsigned list_len, list_max;
hddb_list_t *list;
unsigned ids_len, ids_max;
unsigned *ids;
unsigned strings_len, strings_max;
char *strings;
} hddb2_data_t;
/**
* module information type
*/
typedef enum modinfo_type_e { mi_none = 0, mi_pci, mi_other } modinfo_type_t;
/**
* module.alias information
*/
typedef struct {
char *module;
char *alias;
modinfo_type_t type;
union {
struct {
struct {
unsigned vendor:1;
unsigned device:1;
unsigned sub_vendor:1;
unsigned sub_device:1;
unsigned base_class:1;
unsigned sub_class:1;
unsigned prog_if:1;
} has;
unsigned vendor;
unsigned device;
unsigned sub_vendor;
unsigned sub_device;
unsigned base_class;
unsigned sub_class;
unsigned prog_if;
} pci;
struct {
struct {
unsigned vendor:1;
unsigned product:1;
unsigned device_class:1;
unsigned device_subclass:1;
} has;
unsigned vendor;
unsigned product;
unsigned device_class;
unsigned device_subclass;
} usb;
};
} modinfo_t;
/**
* HAL device property types
*/
typedef enum {
p_invalid, p_string, p_int32, p_uint64, p_double, p_bool, p_list
} hal_prop_type_t;
/**
* HAL device properties
*/
typedef struct hal_prop_s {
struct hal_prop_s *next;
hal_prop_type_t type;
char *key;
union {
char *str;
int32_t int32;
uint64_t uint64;
double d;
int b;
str_list_t *list;
} val;
} hal_prop_t;
/**
* HAL device
*/
typedef struct hal_device_s {
struct hal_device_s *next, *parent;
char *udi;
unsigned used:1;
hal_prop_t *prop;
} hal_device_t;
/**
* resource types: see @ref RESOURCEpub
*/
typedef enum resource_types {
res_any, res_phys_mem, res_mem, res_io, res_irq, res_dma, res_monitor,
res_size, res_disk_geo, res_cache, res_baud, res_init_strings, res_pppd_option,
res_framebuffer, res_hwaddr, res_link, res_wlan, res_fc, res_phwaddr
} hd_resource_types_t;
/**
* size units (cf. (res_size_t).unit)
*/
typedef enum size_units {
size_unit_cm, size_unit_cinch, size_unit_byte, size_unit_sectors,
size_unit_kbyte, size_unit_mbyte, size_unit_gbyte, size_unit_mm
} hd_size_units_t;
/**
* access types for I/O and memory resources
*/
typedef enum access_flags {
acc_unknown, /**< unknown */
acc_ro, /**< read only */
acc_wo, /**< write only */
acc_rw /**< read/write */
} hd_access_flags_t;
typedef enum yes_no_flag {
flag_unknown, /**< unknown */
flag_no, /**< no */
flag_yes /**< yes */
} hd_yes_no_flag_t;
typedef enum geo_types {
geo_physical = 0,
geo_logical,
geo_bios_edd,
geo_bios_legacy
} hd_geo_types_t;
/**
* @defgroup RESOURCEpub Resource structures
* definitions for the various resource types
* @{
*/
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
} res_any_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
uint64_t base, range;
unsigned
enabled:1, /**< 0: disabled, 1 enabled */
access:2, /**< enum access_flags */
prefetch:2; /**< enum yes_no_flag */
} res_mem_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
uint64_t range;
} res_phys_mem_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
uint64_t base, range;
unsigned
enabled:1, /**< 0: disabled, 1 enabled */
access:2; /**< enum access_flags */
} res_io_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned base;
unsigned triggered; /**< # of interrupts */
unsigned enabled:1; /**< 0: disabled, 1 enabled */
} res_irq_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned base;
unsigned enabled:1; /**< 0: disabled, 1 enabled */
} res_dma_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
enum size_units unit;
uint64_t val1, val2; /**< to allow for 2D values */
} res_size_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned speed;
unsigned bits, stopbits;
char parity; /**< n, e, o, s, m */
char handshake; /**< -, h, s */
} res_baud_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned size; /**< in kbyte */
} res_cache_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned cyls, heads, sectors;
uint64_t size;
enum geo_types geotype; /**< 0-3: physical/logical/bios edd/bios legacy */
} res_disk_geo_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned width, height; /**< in pixel */
unsigned vfreq; /**< in Hz */
unsigned interlaced:1; /**< 0/1 */
} res_monitor_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
char *init1;
char *init2;
} res_init_strings_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
char *option;
} res_pppd_option_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned width, height; /**< in pixel */
unsigned bytes_p_line; /**< line length in bytes (do not confuse with 'width') */
unsigned colorbits; /**< 4, 8, 15, 16, 24, 32 */
unsigned mode; /**< mode number for kernel */
} res_framebuffer_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
char *addr;
} res_hwaddr_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned state:1; /**< network link state: 0 - not connected, 1 - connected */
} res_link_t;
/** wlan capabilities */
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
str_list_t *channels;
str_list_t *frequencies; /**< in GHz units */
str_list_t *bitrates; /**< in Mbps units */
str_list_t *auth_modes; /**< open, sharedkey, wpa-psk, wpa-eap, wpa-leap */
str_list_t *enc_modes; /**< WEP40, WEP104, WEP128, WEP232, TKIP, CCMP */
} res_wlan_t;
typedef struct {
union u_hd_res_t *next;
enum resource_types type;
unsigned wwpn_ok:1;
unsigned fcp_lun_ok:1;
unsigned port_id_ok:1;
uint64_t wwpn;
uint64_t fcp_lun;
unsigned port_id;
char *controller_id;
} res_fc_t;
/** libhd resource union */
typedef union u_hd_res_t {
union u_hd_res_t *next;
res_any_t any;
res_io_t io;
res_mem_t mem;
res_phys_mem_t phys_mem;
res_irq_t irq;
res_dma_t dma;
res_size_t size;
res_cache_t cache;
res_baud_t baud;
res_disk_geo_t disk_geo;
res_monitor_t monitor;
res_init_strings_t init_strings;
res_pppd_option_t pppd_option;
res_framebuffer_t framebuffer;
res_hwaddr_t hwaddr;
res_link_t link;
res_wlan_t wlan;
res_fc_t fc;
} hd_res_t;
/** @} */
/**
* @defgroup MISCpub Misc resource data
* data gathered by the misc module; basically resources from /proc
* @{
*/
typedef struct {
uint64_t addr, size;
char *dev;
unsigned tag;
} misc_io_t;
typedef struct {
unsigned channel;
char *dev;
unsigned tag;
} misc_dma_t;
typedef struct {
unsigned irq, events;
int devs;
char **dev;
unsigned tag;
} misc_irq_t;
typedef struct {
unsigned io_len, dma_len, irq_len;
misc_io_t *io;
misc_dma_t *dma;
misc_irq_t *irq;
str_list_t *proc_io, *proc_dma, *proc_irq;
} misc_t;
/** @} */
/**
* Serial device resource and hardware information
*/
typedef struct s_serial_t {
struct s_serial_t *next;
char *name;
char *device;
unsigned line, port, irq, baud;
} serial_t;
/**
* Serial device configuration information
*/
typedef struct s_ser_device_t {
struct s_ser_device_t *next;
unsigned hd_idx;
char *dev_name;
str_list_t *at_resp;
int fd;
struct termios tio;
unsigned max_baud, cur_baud;
unsigned is_mouse:1;
unsigned is_modem:1;
unsigned do_io:1;
unsigned char buf[0x1000];
int buf_len;
int garbage, non_pnp, pnp;
unsigned char pnp_id[8];
char *serial, *class_name, *dev_id, *user_name, *vend, *init_string1, *init_string2, *pppd_option;
unsigned pnp_rev;
unsigned bits;
} ser_device_t;
/**
* @defgroup DRVINFO Driver information
* @brief Driver information structures and union
* @{
*/
/**
* @brief ISDN configuration parameter
* Notes on isdn_parm_t:
* - def_value is only relevant of alt_values != 0
* - def_value should be a value out of alt_value[]
* - see libihw docu for the meaning of name,type,flags,def_value
*/
typedef struct isdn_parm_s {
struct isdn_parm_s *next;
char *name; /**< parameter name */
unsigned valid:1; /**< 1: entry is valid, 0: some inconsistencies */
unsigned conflict:1; /**< 1: ressource conflict (eg. no free irq) */
uint64_t value; /**< value of the parameter */
unsigned type; /**< CDBISDN type (P_...) */
unsigned flags; /**< CDBISDN flags (P_...) */
unsigned def_value; /**< default value */
int alt_values; /**< length of alt_value[] */
unsigned *alt_value; /**< possible values */
} isdn_parm_t;
/** device driver info types */
typedef enum driver_info_type {
di_any, di_display, di_module, di_mouse, di_x11, di_isdn, di_kbd, di_dsl
} hd_driver_info_t;
/** unspecific info */
typedef struct {
union driver_info_u *next;
enum driver_info_type type; /**< driver info type */
str_list_t *hddb0, *hddb1; /**< the actual driver database entries */
} driver_info_any_t;
/** display (monitor) info */
typedef struct {
union driver_info_u *next;
enum driver_info_type type; /**< driver info type */
str_list_t *hddb0, *hddb1; /**< the actual driver database entries */
unsigned width, height; /**< max. useful display geometry */
unsigned min_vsync, max_vsync; /**< vsync range */
unsigned min_hsync, max_hsync; /**< hsync range */
unsigned bandwidth; /** max. pixel clock */
unsigned hdisp, hsyncstart, hsyncend, htotal; /** h_timings */
unsigned vdisp, vsyncstart, vsyncend, vtotal; /** v_timings */
char hflag,vflag; /** h/v flags */
} driver_info_display_t;
/** module info */
typedef struct {
union driver_info_u *next;
enum driver_info_type type; /**< driver info type */
str_list_t *hddb0, *hddb1; /**< the actual driver database entries */
unsigned active:1; /**< if module is currently active */
unsigned modprobe:1; /**< modprobe or insmod */
str_list_t *names; /**< (ordered) list of module names */
str_list_t *mod_args; /**< list of module args (corresponds to the module name list) */
char *conf; /**< conf.modules entry, if any (e.g. for sb.o) */
} driver_info_module_t;
/** mouse protocol info */
typedef struct {
union driver_info_u *next;
enum driver_info_type type; /**< driver info type */
str_list_t *hddb0, *hddb1; /**< the actual driver database entries */
char *xf86; /**< the XF86 protocol name */
char *gpm; /**< dto, gpm */
int buttons; /**< number of buttons, -1 --> unknown */
int wheels; /**< dto, wheels */
} driver_info_mouse_t;
/** X11 server info */
typedef struct {
union driver_info_u *next;
enum driver_info_type type; /**< driver info type */
str_list_t *hddb0, *hddb1; /**< the actual driver database entries */
char *server; /**< the server/module name */
char *xf86_ver; /**< XFree86 version (3 or 4) */
unsigned x3d:1; /**< has 3D support */
struct {
unsigned all:5; /**< the next 5 entries combined */
unsigned c8:1, c15:1, c16:1, c24:1, c32:1;
} colors; /**< supported color depths */
unsigned dacspeed; /**< max. ramdac clock */
str_list_t *extensions; /**< additional X extensions to load ('Module' section) */
str_list_t *options; /**< special server options */
str_list_t *raw; /**< extra info to add to XF86Config */
char *script; /**< 3d script to run */
} driver_info_x11_t;
/** isdn info */
typedef struct {
union driver_info_u *next;
enum driver_info_type type; /**< driver info type */
str_list_t *hddb0, *hddb1; /**< the actual driver database entries */
int i4l_type, i4l_subtype; /**< I4L types */
char *i4l_name; /**< I4L card name */
isdn_parm_t *params; /**< isdn parameters */
} driver_info_isdn_t;
/** dsl info */
typedef struct {
union driver_info_u *next;
enum driver_info_type type; /**< driver info type */
str_list_t *hddb0, *hddb1; /**< the actual driver database entries */
char *mode; /**< DSL driver types */
char *name; /**< DSL driver name */
} driver_info_dsl_t;
/** keyboard info */
typedef struct {
union driver_info_u *next;
enum driver_info_type type; /**< driver info type */
str_list_t *hddb0, *hddb1; /**< the actual driver database entries */
char *XkbRules; /**< XF86Config entries */
char *XkbModel;
char *XkbLayout;
char *keymap; /**< console keymap */
} driver_info_kbd_t;
/*
* holds device driver info
*/
typedef union driver_info_u {
union driver_info_u *next;
driver_info_any_t any;
driver_info_module_t module;
driver_info_mouse_t mouse;
driver_info_x11_t x11;
driver_info_display_t display;
driver_info_isdn_t isdn;
driver_info_dsl_t dsl;
driver_info_kbd_t kbd;
} driver_info_t;
/** @} */
/**
* @ingroup HWDETAILpub
* @{
*/
/**
* Hardware detail information type
*/
typedef enum hd_detail_type {
hd_detail_pci, hd_detail_usb, hd_detail_isapnp, hd_detail_cdrom,
hd_detail_floppy, hd_detail_bios, hd_detail_cpu, hd_detail_prom,
hd_detail_monitor, hd_detail_sys, hd_detail_scsi, hd_detail_devtree,
hd_detail_ccw, hd_detail_joystick
} hd_detail_type_t;
typedef struct {
enum hd_detail_type type;
pci_t *data;
} hd_detail_pci_t;
typedef struct {
enum hd_detail_type type;
usb_t *data;
} hd_detail_usb_t;
typedef struct {
enum hd_detail_type type;
isapnp_dev_t *data;
} hd_detail_isapnp_t;
typedef struct {
enum hd_detail_type type;
cdrom_info_t *data;
} hd_detail_cdrom_t;
typedef struct {
enum hd_detail_type type;
floppy_info_t *data;
} hd_detail_floppy_t;
typedef struct {
enum hd_detail_type type;
bios_info_t *data;
} hd_detail_bios_t;
typedef struct {
enum hd_detail_type type;
cpu_info_t *data;
} hd_detail_cpu_t;
typedef struct {
enum hd_detail_type type;
prom_info_t *data;
} hd_detail_prom_t;
typedef struct hd_detail_monitor_s {
enum hd_detail_type type;
monitor_info_t *data;
struct hd_detail_monitor_s *next;
} hd_detail_monitor_t;
typedef struct {
enum hd_detail_type type;
sys_info_t *data;
} hd_detail_sys_t;
typedef struct {
enum hd_detail_type type;
scsi_t *data;
} hd_detail_scsi_t;
typedef struct {
enum hd_detail_type type;
devtree_t *data;
} hd_detail_devtree_t;
typedef struct {
enum hd_detail_type type;
ccw_t *data;
} hd_detail_ccw_t;
typedef struct {
enum hd_detail_type type;
joystick_t *data;
} hd_detail_joystick_t;
typedef union {
enum hd_detail_type type;
hd_detail_pci_t pci;
hd_detail_usb_t usb;
hd_detail_isapnp_t isapnp;
hd_detail_cdrom_t cdrom;
hd_detail_floppy_t floppy;
hd_detail_bios_t bios;
hd_detail_cpu_t cpu;
hd_detail_prom_t prom;
hd_detail_monitor_t monitor;
hd_detail_sys_t sys;
hd_detail_scsi_t scsi;
hd_detail_devtree_t devtree;
hd_detail_ccw_t ccw;
hd_detail_joystick_t joystick;
} hd_detail_t;
/** @} */
/**
* @defgroup MANUALpub Manual hardware configuration
* @brief Handle manually configured hardware (in /var/lib/hardware/)
* @ingroup libhdPublic
*/
/**
* @brief Manually configured hardware information
* @ingroup MANUALpub
*/
typedef struct hd_manual_s {
struct hd_manual_s *next;
char *unique_id;
char *parent_id;
char *child_ids;
unsigned hw_class;
char *model;
hd_status_t status;
char *config_string;
/* More or less free-form key, value pairs.
* key should not contain '=', however.
*/
str_list_t *key;
str_list_t *value;
} hd_manual_t;
/**
* Individual hardware item.
* Every hardware component gets an \ref hd_t entry. A list of all hardware
* items is in \ref hd_data_t::hd.
*/
typedef struct s_hd_t {
struct s_hd_t *next; /**< Link to next hardware item. */
/**
* Unique index, starting at 1.
* Use \ref hd_get_device_by_idx() to look up an hardware entry by index. And don't
* free the result!
*/
unsigned idx;
/**
* Hardware appears to be broken in some way.
* This was used to indicate broken framebuffer support of some graphics cards.
* Currently unused.
*/
unsigned broken:1;
/**
* Bus type (id and name).
*/
hd_id_t bus;
/**
* Slot and bus number.
* Bits 0-7: slot number, 8-31 bus number.
*/
unsigned slot;
/**
* (PCI) function.
*/
unsigned func;
/**
* Base class (id and name).
*/
hd_id_t base_class;
/**
* Sub class (id and name).
*/
hd_id_t sub_class;
/**
* (PCI) programming interface (id and name).
*/
hd_id_t prog_if;
/**
* Vendor id and name.
* Id is actually a combination of some tag to differentiate the
* various id types and the real id. Use the \ref ID_VALUE macro to
* get e.g. the real PCI id value for a PCI %device.
*/
hd_id_t vendor;
/**
* Device id and name.
* Id is actually a combination of some tag to differentiate the
* various id types and the real id. Use the \ref ID_VALUE macro to
* get e.g. the real PCI id value for a PCI %device.
* \note If you're looking or something printable, you might want to use \ref hd_t::model
* instead.
*/
hd_id_t device;
/**
* Subvendor id and name.
* Id is actually a combination of some tag to differentiate the
* various id types and the real id. Use the \ref ID_VALUE macro to
* get e.g. the real PCI id value for a PCI %device.
*/
hd_id_t sub_vendor;
/**
* Subdevice id and name.
* Id is actually a combination of some tag to differentiate the
* various id types and the real id. Use the \ref ID_VALUE macro to
* get e.g. the real PCI id value for a PCI %device.
*/
hd_id_t sub_device;
/**
* Revision id or string.
* If revision is numerical (e.g. PCI) \ref hd_id_t::id is used.
* If revision is some char data (e.g. disk drives) it is stored in \ref hd_id_t::name.
*/
hd_id_t revision;
/**
* Serial id.
*/
char *serial;
/**
* Vendor id and name of some compatible hardware.
* Used mainly for ISA-PnP devices.
*/
hd_id_t compat_vendor;
/**
* Device id and name of some compatible hardware.
* Used mainly for ISA-PnP devices.
*/
hd_id_t compat_device;
/**
* Hardware class.
* Not to confuse with \ref base_class!
*/
hd_hw_item_t hw_class;
/**
* Hardware class list.
* A device may belong to more than one hardware class.
*/
unsigned char hw_class_list[(hw_all + 7) / 8]; /**< (Internal) bitmask of hw classes. */
/**
* Model name.
* This is a combination of vendor and %device names. Some heuristics is used
* to make it more presentable. Use this instead of \ref hd_t::vendor and
* \ref hd_t::device.
*/
char *model;
/**
* Device this hardware is attached to.
* Link to some 'parent' %device. Use \ref hd_get_device_by_idx() to get
* the corresponding hardware entry.
*/
unsigned attached_to;
/**
* sysfs entry for this hardware, if any.
*/
char *sysfs_id;
/**
* sysfs bus id for this hardware, if any.
*/
char *sysfs_bus_id;
/**
* sysfs device link.
*/
char *sysfs_device_link;
/**
* Special %device file.
* Device file name to access this hardware. Normally something below /dev.
* For network interfaces this is the interface name.
*/
char *unix_dev_name;
/**
* Device type & number according to sysfs.
*/
hd_dev_num_t unix_dev_num;
/**
* List of %device names.
* Device file names to access this hardware. Normally something below /dev.
* They should be all equivalent. The preferred name however is
* \ref hd_t::unix_dev_name.
*/
str_list_t *unix_dev_names;
/**
* Special %device file.
* Device file name to access this hardware. Most hardware only has one
* %device name stored in \ref hd_t::unix_dev_name. But in some cases
* there's an alternative name.
*/
char *unix_dev_name2;
/**
* Device type & number according to sysfs.
*/
hd_dev_num_t unix_dev_num2;
/**
* BIOS/PROM id.
* Where appropriate, this is a special BIOS/PROM id (e.g. "0x80" for
* the first harddisk on Intel-PCs).
* CHPID for s390.
*/
char *rom_id;
/**
* HAL udi.
*/
char *udi;
/**
* \ref udi of parent (\ref attached_to).
*/
char *parent_udi;
/**
* Unique id for this hardware.
* A unique string identifying this hardware. The string consists
* of two parts separated by a dot ("."). The part before the dot
* describes the location (where the hardware is attached in the system).
* The part after the dot identifies the hardware itself. The string
* must not contain slashes ("/") because we're going to create files
* with this id as name. Apart from this there are no restrictions on
* the form of this string.
*/
char *unique_id;
/** List of ids. */
str_list_t *unique_ids;
/**
* (Internal) Probing module that created this entry.
*/
unsigned module;
/**
* (Internal) Source code line where this entry was created.
*/
unsigned line;
/**
* (Internal) Counter, used in combination with \ref hd_t::module and \ref hd_t::line.
*/
unsigned count;
/**
* Device resources.
*/
hd_res_t *res;
/**
* Special info associated with this hardware.
* \note This is going to change!
*/
hd_detail_t *detail;
/**
* (Internal) Unspecific text info.
* It is used to track IDE interfaces and assign them to the correct
* IDE controllers.
*/
str_list_t *extra_info;
/**
* Hardware status (if available).
* The status is stored in files below /var/lib/hardware/unique-keys/. Every
* hardware item gets a file there with its unique id as file name.
*/
hd_status_t status;
/**
* Some %config info.
* Every hardware item may get some string assigned. This string is stored
* in files below /var/lib/hardware/unique-keys/. There is no meaning
* associated with this string.
*/
char *config_string;
/**
* Hotplug controller for this %device.
* It indicates what kind of hotplug %device (if any) this is.
*/
hd_hotplug_t hotplug;
/**
* Slot the hotplug device is connected to (e.g. PCMCIA socket).
* \note \ref hotplug_slot counts 1-based (0: no information available).
*/
unsigned hotplug_slot;
struct is_s {
unsigned agp:1; /**< AGP device */
unsigned isapnp:1; /**< ISA-PnP device */
unsigned notready:1; /**< block devices: no medium, other: device not configured */
unsigned manual:1; /**< undetectable, manually configured hardware */
unsigned softraiddisk:1; /**< disk belongs to some soft raid array */
unsigned zip:1; /**< zip floppy */
unsigned cdr:1; /**< CD-R */
unsigned cdrw:1; /**< CD-RW */
unsigned dvd:1; /**< DVD */
unsigned dvdr:1; /**< DVD-R */
unsigned dvdrw:1; /**< DVD-RW */
unsigned dvdrdl:1; /**< DVD-R DL */
unsigned dvdpr:1; /**< DVD+R */
unsigned dvdprw:1; /**< DVD+RW */
unsigned dvdprdl:1; /**< DVD+R DL */
unsigned dvdprwdl:1; /**< DVD+RW DL */
unsigned bd:1; /**< BD */
unsigned bdr:1; /**< BD-R */
unsigned bdre:1; /**< BD-RE */
unsigned hd:1; /**< HD */
unsigned hdr:1; /**< HD-R */
unsigned hdrw:1; /**< HD-RW */
unsigned dvdram:1; /**< DVDRAM */
unsigned mo:1; /**< MO */
unsigned mrw:1; /**< MRW */
unsigned mrww:1; /**< MRW-W */
unsigned pppoe:1; /**< PPPOE modem connected */
unsigned wlan:1; /**< WLAN card */
unsigned with_acpi:1; /**< acpi works fine */
unsigned hotpluggable:1; /**< hotpluggable storage device */
unsigned dualport:1; /**< OSA Express device with two ports (S/390) */
unsigned fcoe:1; /**< fcoe device */
unsigned fcoe_offload:2; /**< fcoe offload capable device */
unsigned iscsi_offload:2; /**< iscsi offload capable device */
unsigned storage_only:2; /**< storage only network interface */
} is;
struct tag_s { /**< this struct is for internal purposes only */
unsigned remove:1; /**< schedule for removal */
unsigned freeit:1; /**< for internal memory management */
unsigned fixed:1; /**< fixed, do no longer modify this entry */
unsigned skip_mouse:1; /**< if serial line, don't scan for mice */
unsigned skip_modem:1; /**< if serial line, don't scan for modems */
unsigned skip_braille:1; /**< if serial line, don't scan for braille devices */
unsigned ser_device:2; /**< if != 0: info about attached serial device; see serial.c */
} tag;
/**
* (Internal) First 512 bytes of block devices.
* To check accessibility of block devices we read the first block. The data
* is used to identify the boot %device.
*/
unsigned char *block0;
/**
* Currently active driver.
*/
char *driver;
/**
* Currently active driver module (if any).
*/
char *driver_module;
/**
* List of currently active drivers.
*/
str_list_t *drivers;
/**
* List of currently active driver modules.
*/
str_list_t *driver_modules;
/**
* Old \ref unique_id for compatibility.
* The calculation of unique ids has changed in libhd v3.17. Basically
* we no longer use the vendor/%device names if there are vendor/%device
* ids. (Otherwise a simple %device name database update would change the id,
* which is really not what you want.)
*/
char *old_unique_id;
/**
* \ref unique_id of parent (\ref attached_to).
* \note Please do not use it for now.
*
*/
char *parent_id;
/**
* \ref unique_ids of children (\ref parent_id).
* \note Please do not use it for now.
*
*/
str_list_t *child_ids;
/**
* (Internal) location independent \ref unique_id part.
* The speed up some internal searches, we store it here separately.
*/
char *unique_id1;
/**
* USB Global Unique Identifier.
* Available for USB devices. This may even be set if \ref hd_t::bus is not
* \ref bus_usb (e.g. USB storage devices will have \ref hd_t::bus set to
* \ref bus_scsi due to SCSI emulation).
*/
char *usb_guid;
driver_info_t *driver_info; /**< device driver info */
str_list_t *requires; /**< packages/programs required for this hardware */
hal_prop_t *hal_prop; /**< hal property list */
hal_prop_t *persistent_prop; /**< persistent property list */
char *modalias; /**< module alias */
char *label; /**< Consistent Device Name (CDN), pci firmware spec 3.1, chapter 4.6.7 */
/*
* These are used internally for memory management.
* Do not even _think_ of modifying these!
*/
unsigned ref_cnt; /**< (Internal) memory reference count. */
struct s_hd_t *ref; /**< (Internal) if set, this is only a reference. */
} hd_t;
/**
* Holds all data accumulated during hardware probing.
*/
typedef struct {
/**
* @brief Current hardware list.
* The list of all currently probed hardware. This is not identical with
* the result of \ref hd_list(). (But a superset of it.)
*/
hd_t *hd;
/**
* @brief A progress indicator.
* If this callback function is not NULL, it is called at various points and can
* be used to give some user feedback what we are actually doing.
* If the debug flag HD_DEB_PROGRESS is set, progress messages are logged.
* \param pos Indicates where we are.
* \param msg Indicates what we are going to do.
*/
void (*progress)(char *pos, char *msg);
/**
* @brief Log messages.
* All messages logged during hardware probing accumulate here.
*/
char *log;
/**
* @brief Debug flags.
* Although there exist some debug flag defines this scheme is currently
* not followed consistently. It is guaranteed however that -1 will give
* the most log messages and 0 the least.
* @see DEBUGpub
*/
unsigned debug;
/**
* @brief Special flags.
* Influence hardware probing in some strange ways with these. You normally
* do not want to use them.
*/
struct flag_struct {
unsigned internal:1; /**< \ref hd_scan() has been called internally. */
unsigned dformat:2; /**< Alternative output format. */
unsigned no_parport:1; /**< Don't do parport probing: parport modules (used to) crash pmacs. */
unsigned iseries:1; /**< Set if we are on an iSeries machine. */
unsigned list_all:1; /**< Return even devices with status 'not available'. */
unsigned fast:1; /**< Don't check tricky hardware. */
unsigned list_md:1; /**< Report md & lvm devices from /proc/partitions */
unsigned nofork:1; /**< don't run potentially hanging code in a subprocess */
unsigned nosysfs:1; /**< don't ask sysfs */
unsigned forked:1; /**< we're running in a subprocess */
unsigned cpuemu:1; /**< use CPU emulation to run BIOS code (i386 only) */
unsigned udev:1; /**< return first udev symlink as device name */
unsigned edd_used:1; /**< internal: edd info has been used */
unsigned keep_kmods:2; /**< internal: don't reread kmods */
unsigned nobioscrc:1; /**< internal: don't check VBIOS crc */
unsigned biosvram:1; /**< internal: map Video BIOS RAM (128k at 0xa0000) */
unsigned nowpa:1; /**< no longer used */
unsigned pata:1; /**< use new libata modules instead of classical ide modules */
unsigned vbox:1; /**< running in virtual box */
unsigned vmware:1; /**< running in vmware */
unsigned vmware_mouse:1; /**< has vmware mouse */
} flags;
/**
* @brief Concentrate on these devices.
* List of sysfs ids for devices to look for.
*/
str_list_t *only;
/*
* The following entries should *not* be accessed outside of libhd!
*/
unsigned char probe[(pr_all + 7) / 8]; /**< (Internal) bitmask of probing features. */
unsigned char probe_set[(pr_all + 7) / 8]; /**< (Iternal) bitmask of probing features that will always be set. */
unsigned char probe_clr[(pr_all + 7) / 8]; /**< (Internal) bitmask of probing features that will always be reset. */
hal_prop_t *probe_val; /**< (Internal) probing features with arbitrary values */
unsigned last_idx; /**< (Internal) index of the last hd entry generated */
unsigned module; /**< (Internal) the current probing module we are in */
enum boot_arch boot; /**< (Internal) boot method */
hd_t *old_hd; /**< (Internal) old (outdated) entries (if you scan more than once) */
pci_t *pci; /**< (Internal) raw PCI data */
isapnp_t *isapnp; /**< (Internal) raw ISA-PnP data */
cdrom_info_t *cdrom; /**< (Internal) CDROM devs from PROC_CDROM_INFO */
str_list_t *net; /**< (Internal) list of network interfaces */
str_list_t *floppy; /**< (Internal) contents of PROC_NVRAM, used by the floppy module */
misc_t *misc; /**< (Internal) data gathered in the misc module */
serial_t *serial; /**< (Internal) /proc's serial info */
scsi_t *scsi; /**< (Internal) raw SCSI data */
ser_device_t *ser_mouse; /**< (Internal) info about serial mice */
ser_device_t *ser_modem; /**< (Internal) info about serial modems */
str_list_t *cpu; /**< (Internal) /proc/cpuinfo */
str_list_t *klog; /**< (Internal) kernel log */
str_list_t *proc_usb; /**< (Internal) /proc/bus/usb info */
usb_t *usb; /**< (Internal) usb info */
modinfo_t *modinfo_ext; /**< (Internal) external module info */
modinfo_t *modinfo; /**< (Internal) module info */
hddb2_data_t *hddb2[2]; /**< (Internal) hardware database */
str_list_t *kmods; /**< (Internal) list of active kernel modules */
uint64_t used_irqs; /**< (Internal) irq usage */
uint64_t assigned_irqs; /**< (Internal) irqs automatically assigned by libhd (for driver info) */
memory_range_t bios_rom; /**< (Internal) BIOS 0xc0000 - 0xfffff */
memory_range_t bios_ram; /**< (Internal) BIOS 0x00400 - 0x004ff */
memory_range_t bios_ebda; /**< (Internal) EBDA */
unsigned display; /**< (Internal) hd_idx of the active (vga) display */
unsigned color_code; /**< (Internal) color, if any */
char *cmd_line; /**< (Internal) kernel command line */
str_list_t *xtra_hd; /**< (Internal) fake hd entries (for testing) */
devtree_t *devtree; /**< (Internal) prom device tree on ppc */
unsigned kernel_version; /**< (Internal) kernel version */
hd_t *manual; /**< (Internal) hardware config info */
str_list_t *disks; /**< (Internal) disks according to /proc/partitions */
str_list_t *partitions; /**< (Internal) dto, partitions */
str_list_t *cdroms; /**< (Internal) cdroms according to PROC_CDROM_INFO */
hd_smbios_t *smbios; /**< (Internal) smbios data */
struct {
unsigned ok:1;
unsigned size;
unsigned used;
void *data;
int id;
int updated;
} shm; /**< (Internal) our shm segment */
unsigned pci_config_type; /**< (Internal) PCI config type (1 or 2), 0: unknown */
hd_udevinfo_t *udevinfo; /**< (Internal) udev info */
hd_sysfsdrv_t *sysfsdrv; /**< (Internal) sysfs driver info */
uint64_t sysfsdrv_id; /**< (Internal) sysfs driver info id */
str_list_t *scanner_db; /**< (Internal) list of scanner modules */
edd_info_t edd[0x80]; /**< (Internal) enhanced disk drive data */
hal_device_t *hal; /**< (Internal) HAL data (if any) */
str_list_t *lsscsi; /**< (Internal) lsscsi result (if any) */
struct vm_s *vm; /**< (Internal) x86emu vm */
size_t log_size; /**< (Internal) current log size (including final 0) */
size_t log_max; /**< (Internal) log buffer size */
str_list_t *klog_raw; /**< (Internal) unmodified kernel log */
} hd_data_t;
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*
* libhd interface functions
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
/* implemented in hd.c */
/** the actual hardware scan */
void hd_scan(hd_data_t *hd_data);
//! Free all data.
hd_data_t *hd_free_hd_data(hd_data_t *hd_data);
//! Free hardware items returned by e.g. \ref hd_list().
hd_t *hd_free_hd_list(hd_t *hd);
void hd_set_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
void hd_clear_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
int hd_probe_feature(hd_data_t *hd_data, enum probe_feature feature);
void hd_set_probe_feature_hw(hd_data_t *hd_data, hd_hw_item_t item);
enum probe_feature hd_probe_feature_by_name(char *name);
char *hd_probe_feature_by_value(enum probe_feature feature);
int hd_module_is_active(hd_data_t *hd_data, char *mod);
hd_t *hd_base_class_list(hd_data_t *hd_data, unsigned base_class);
hd_t *hd_sub_class_list(hd_data_t *hd_data, unsigned base_class, unsigned sub_class);
hd_t *hd_bus_list(hd_data_t *hd_data, unsigned bus);
const char* hd_busid_to_hwcfg(int busid);
hd_t *hd_list(hd_data_t *hd_data, hd_hw_item_t item, int rescan, hd_t *hd_old);
hd_t *hd_list_with_status(hd_data_t *hd_data, hd_hw_item_t item, hd_status_t status);
hd_t *hd_list2(hd_data_t *hd_data, hd_hw_item_t *items, int rescan);
hd_t *hd_list_with_status2(hd_data_t *hd_data, hd_hw_item_t *items, hd_status_t status);
void hd_add_driver_data(hd_data_t *hd_data, hd_t *hd);
int hd_has_pcmcia(hd_data_t *hd_data);
#if 0
/**
* will be gone soon
* @deprecated
*/
int hd_apm_enabled(hd_data_t *hd_data);
#endif
int hd_usb_support(hd_data_t *hd_data);
int hd_smp_support(hd_data_t *hd_data);
int hd_mac_color(hd_data_t *hd_data);
int hd_color(hd_data_t *hd_data);
int hd_is_uml(hd_data_t *hd_data);
int hd_is_xen(hd_data_t *hd_data);
unsigned hd_display_adapter(hd_data_t *hd_data);
unsigned hd_boot_disk(hd_data_t *hd_data, int *matches);
enum cpu_arch hd_cpu_arch(hd_data_t *hd_data);
enum boot_arch hd_boot_arch(hd_data_t *hd_data);
hd_t *hd_get_device_by_idx(hd_data_t *hd_data, unsigned idx);
void hd_set_hw_class(hd_t *hd, hd_hw_item_t hw_class);
int hd_is_hw_class(hd_t *hd, hd_hw_item_t hw_class);
int hd_is_sgi_altix(hd_data_t *hd_data);
char *hd_version(void);
hal_prop_t *hd_free_hal_properties(hal_prop_t *prop);
hal_prop_t *hd_read_properties(const char *udi);
int hd_write_properties(const char *udi, hal_prop_t *prop);
int hd_change_status(const char *id, hd_status_t status, const char *config_string);
int hd_change_config_status(hd_data_t *hd_data, const char *id, hd_status_t status, const char *config_string);
int hd_read_mmap(hd_data_t *hd_data, char *name, unsigned char *buf, off_t start, unsigned size);
/* implemented in hddb.c */
/**
* @todo implement in hddb.c
*/
str_list_t *hddb_get_packages(hd_data_t *hd_data);
void hddb_add_info(hd_data_t *hd_data, hd_t *hd);
void hddb_dump_raw(hddb2_data_t *hddb, FILE *f);
void hddb_dump(hddb2_data_t *hddb, FILE *f);
/* implemented in hdp.c */
void hd_dump_entry(hd_data_t *hd_data, hd_t *hd, FILE *f);
/* implemented in cdrom.c */
cdrom_info_t *hd_read_cdrom_info(hd_data_t *hd_data, hd_t *hd);
/**
* @ingroup MANUALpub
* @brief Manually configured devices
* implemented in manual.c
* @{
*/
hd_manual_t *hd_manual_read_entry(hd_data_t *hd_data, const char *id);
int hd_manual_write_entry(hd_data_t *hd_data, hd_manual_t *entry);
hd_manual_t *hd_free_manual(hd_manual_t *manual);
hd_t *hd_read_config(hd_data_t *hd_data, const char *id);
int hd_write_config(hd_data_t *hd_data, hd_t *hd);
char *hd_hw_item_name(hd_hw_item_t item);
hd_hw_item_t hd_hw_item_type(char *name);
char *hd_status_value_name(hd_status_value_t status);
/** @} */
/**
* @defgroup CDB ISDN interface
* @author (C) 2003 kkeil@suse.de
* @brief Handle ISDN devices
* @{
*/
#define CDBISDN_VERSION 0x0101
#ifndef PCI_ANY_ID
#define PCI_ANY_ID 0xffff
#endif
#define CDBISDN_P_NONE 0x0
#define CDBISDN_P_IRQ 0x1
#define CDBISDN_P_MEM 0x2
#define CDBISDN_P_IO 0x3
/** vendor info */
typedef struct {
char *name;
char *shortname;
int vnr;
int refcnt;
} cdb_isdn_vendor;
typedef struct {
int handle; /**< internal identifier idx in database */
int vhandle; /**< internal identifier to vendor database */
char *name; /**< cardname */
char *lname; /**< vendor short name + cardname */
char *Class; /**< CLASS of the card */
char *bus; /**< bus type */
int revision; /**< revision used with USB */
int vendor; /**< Vendor ID for ISAPNP and PCI cards */
int device; /**< Device ID for ISAPNP and PCI cards */
int subvendor; /**< Subvendor ID for PCI cards */
/**< A value of 0xffff is ANY_ID */
int subdevice; /**< Subdevice ID for PCI cards */
/**< A value of 0xffff is ANY_ID */
unsigned int features; /**< feature flags */
int line_cnt; /**< count of ISDN ports */
int vario_cnt; /**< count of driver varios */
int vario; /**< referenz to driver vario record */
} cdb_isdn_card;
typedef struct {
int handle; /**< idx in database */
int next_vario; /**< link to alternate vario */
int drvid; /**< unique id of the driver vario */
int typ; /**< Type to identify the driver */
int subtyp; /**< Subtype of the driver type */
int smp; /**< SMP supported ? */
char *mod_name; /**< name of the driver module */
char *para_str; /**< optional parameter string */
char *mod_preload; /**< optional modules to preload */
char *cfg_prog; /**< optional cfg prog */
char *firmware; /**< optional firmware to load */
char *description; /**< optional description */
char *need_pkg; /**< list of packages needed for function */
char *info; /**< optional additional info */
char *protocol; /**< supported D-channel protocols */
char *interface; /**< supported API interfaces */
char *io; /**< possible IO ports with legacy ISA cards */
char *irq; /**< possible interrupts with legacy ISA cards */
char *membase; /**< possible membase with legacy ISA cards */
char *features; /**< optional features*/
int card_ref; /**< reference to a card */
char *name; /**< driver name */
} cdb_isdn_vario;
extern cdb_isdn_vendor *hd_cdbisdn_get_vendor(int);
extern cdb_isdn_card *hd_cdbisdn_get_card(int);
extern cdb_isdn_vario *hd_cdbisdn_get_vario_from_type(int, int);
extern cdb_isdn_card *hd_cdbisdn_get_card_from_type(int, int);
extern cdb_isdn_card *hd_cdbisdn_get_card_from_id(int, int, int, int);
extern cdb_isdn_vario *hd_cdbisdn_get_vario(int);
extern int hd_cdbisdn_get_version(void);
extern int hd_cdbisdn_get_db_version(void);
extern char *hd_cdbisdn_get_db_date(void);
/**
* CDB ISDN interface end
* @}
*/
#ifdef __cplusplus
}
#endif
/** @} */
#endif /* _HD_H */
|