]> git.ipfire.org Git - ipfire-2.x.git/blob - src/hwinfo/src/hd/adb.c
Kleiner netter neuer Versuch.
[ipfire-2.x.git] / src / hwinfo / src / hd / adb.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <unistd.h>
5 #include <fcntl.h>
6 #include <errno.h>
7 #include <termios.h>
8 #include <sys/stat.h>
9 #include <sys/types.h>
10 #include <sys/time.h>
11 #include <sys/ioctl.h>
12
13 #include "hd.h"
14 #include "hd_int.h"
15 #include "adb.h"
16
17 /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
18 * adb info
19 *
20 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
21 */
22
23 #ifdef __PPC__
24
25 void hd_scan_adb(hd_data_t *hd_data)
26 {
27 int i;
28 unsigned u, adr = 0;
29 hd_t *hd;
30 str_list_t *sl;
31
32 if(!hd_probe_feature(hd_data, pr_adb)) return;
33
34 hd_data->module = mod_adb;
35
36 /* some clean-up */
37 remove_hd_entries(hd_data);
38
39 PROGRESS(1, 0, "get info");
40
41 for(sl = hd_data->klog; sl; sl = sl->next) {
42 if(sscanf(sl->str, "<4>ADB mouse at %u, %*[a-z ] %i", &u, &i) == 2 && u < 32) {
43 /* u: max 15 actually, but who cares... */
44 if(!(adr & (1 << u))) {
45 adr |= 1 << u;
46 hd = add_hd_entry(hd_data, __LINE__, 0);
47 hd->base_class.id = bc_mouse;
48 hd->sub_class.id = sc_mou_bus;
49 hd->bus.id = bus_adb;
50 hd->slot = u;
51 // hd->func = i;
52 hd->unix_dev_name = new_str(DEV_MICE);
53
54 hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x0100);
55 hd->device.id = MAKE_ID(TAG_SPECIAL, 0x0300 + i);
56 }
57 }
58
59 if(sscanf(sl->str, "<4>ADB keyboard at %u, %*[a-z ] %i", &u, &i) == 2 && u < 32) {
60 /* u: max 15 actually, but who cares... */
61 if(!(adr & (1 << u))) {
62 adr |= 1 << u;
63 hd = add_hd_entry(hd_data, __LINE__, 0);
64 hd->base_class.id = bc_keyboard;
65 hd->sub_class.id = 0;
66 hd->bus.id = bus_adb;
67 hd->slot = u;
68 // hd->func = i;
69 // hd->unix_dev_name = new_str(DEV_ADBMOUSE);
70
71 hd->vendor.id = MAKE_ID(TAG_SPECIAL, 0x0100);
72 hd->device.id = MAKE_ID(TAG_SPECIAL, 0x0200+i);
73 }
74 }
75 }
76 }
77
78 #endif /* __PPC__ */