Merge lp:~cjcurran/indicator-session/udev-beginnings into lp:indicator-session/0.1
- udev-beginnings
- Merge into trunk
Proposed by
Conor Curran
Status: | Superseded |
---|---|
Proposed branch: | lp:~cjcurran/indicator-session/udev-beginnings |
Merge into: | lp:indicator-session/0.1 |
Diff against target: |
1490 lines (+1286/-28) 7 files modified
configure.ac (+2/-0) src/Makefile.am (+2/-1) src/device-menu-mgr.c (+57/-13) src/sane-rules.h (+778/-0) src/udev-mgr.c (+416/-6) src/udev-mgr.h (+15/-4) src/user-menu-mgr.c (+16/-4) |
To merge this branch: | bzr merge lp:~cjcurran/indicator-session/udev-beginnings |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Neil J. Patel (community) | Needs Fixing | ||
Review via email: mp+70534@code.launchpad.net |
This proposal has been superseded by a proposal from 2011-08-09.
Commit message
Description of the change
backend for scanners and webcams in place
To post a comment you must log in.
- 189. By Conor Curran
-
fixed memory leaks
- 190. By Conor Curran
-
segfault found and fixed
Unmerged revisions
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'configure.ac' | |||
2 | --- configure.ac 2011-07-22 17:15:55 +0000 | |||
3 | +++ configure.ac 2011-08-09 11:36:39 +0000 | |||
4 | @@ -58,12 +58,14 @@ | |||
5 | 58 | [PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION | 58 | [PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION |
6 | 59 | dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION | 59 | dbusmenu-gtk3-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION |
7 | 60 | dbus-glib-1 | 60 | dbus-glib-1 |
8 | 61 | gudev-1.0 | ||
9 | 61 | gio-unix-2.0 | 62 | gio-unix-2.0 |
10 | 62 | indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION) | 63 | indicator3-0.4 >= $INDICATOR_REQUIRED_VERSION) |
11 | 63 | ], | 64 | ], |
12 | 64 | [test "x$with_gtk" = x2], | 65 | [test "x$with_gtk" = x2], |
13 | 65 | [PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION | 66 | [PKG_CHECK_MODULES(SESSIONSERVICE, dbusmenu-glib-0.4 >= $DBUSMENUGLIB_REQUIRED_VERSION |
14 | 66 | dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION | 67 | dbusmenu-gtk-0.4 >= $DBUSMENUGTK_REQUIRED_VERSION |
15 | 68 | gudev-1.0 | ||
16 | 67 | dbus-glib-1 | 69 | dbus-glib-1 |
17 | 68 | gio-unix-2.0 | 70 | gio-unix-2.0 |
18 | 69 | indicator-0.4 >= $INDICATOR_REQUIRED_VERSION) | 71 | indicator-0.4 >= $INDICATOR_REQUIRED_VERSION) |
19 | 70 | 72 | ||
20 | === modified file 'src/Makefile.am' | |||
21 | --- src/Makefile.am 2011-07-21 15:38:44 +0000 | |||
22 | +++ src/Makefile.am 2011-08-09 11:36:39 +0000 | |||
23 | @@ -101,7 +101,8 @@ | |||
24 | 101 | apt-transaction.h \ | 101 | apt-transaction.h \ |
25 | 102 | apt-transaction.c \ | 102 | apt-transaction.c \ |
26 | 103 | udev-mgr.h \ | 103 | udev-mgr.h \ |
28 | 104 | udev-mgr.c | 104 | udev-mgr.c \ |
29 | 105 | sane-rules.h | ||
30 | 105 | indicator_session_service_CFLAGS = \ | 106 | indicator_session_service_CFLAGS = \ |
31 | 106 | $(SESSIONSERVICE_CFLAGS) \ | 107 | $(SESSIONSERVICE_CFLAGS) \ |
32 | 107 | $(GCONF_CFLAGS) \ | 108 | $(GCONF_CFLAGS) \ |
33 | 108 | 109 | ||
34 | === modified file 'src/device-menu-mgr.c' | |||
35 | --- src/device-menu-mgr.c 2011-07-22 14:36:59 +0000 | |||
36 | +++ src/device-menu-mgr.c 2011-08-09 11:36:39 +0000 | |||
37 | @@ -27,7 +27,7 @@ | |||
38 | 27 | #include "lock-helper.h" | 27 | #include "lock-helper.h" |
39 | 28 | #include "upower-client.h" | 28 | #include "upower-client.h" |
40 | 29 | #include "apt-watcher.h" | 29 | #include "apt-watcher.h" |
42 | 30 | 30 | #include "udev-mgr.h" | |
43 | 31 | 31 | ||
44 | 32 | #define UP_ADDRESS "org.freedesktop.UPower" | 32 | #define UP_ADDRESS "org.freedesktop.UPower" |
45 | 33 | #define UP_OBJECT "/org/freedesktop/UPower" | 33 | #define UP_OBJECT "/org/freedesktop/UPower" |
46 | @@ -41,6 +41,7 @@ | |||
47 | 41 | DbusmenuMenuitem* root_item; | 41 | DbusmenuMenuitem* root_item; |
48 | 42 | SessionDbus* session_dbus_interface; | 42 | SessionDbus* session_dbus_interface; |
49 | 43 | AptWatcher* apt_watcher; | 43 | AptWatcher* apt_watcher; |
50 | 44 | UdevMgr* udev_mgr; | ||
51 | 44 | }; | 45 | }; |
52 | 45 | 46 | ||
53 | 46 | static GConfClient *gconf_client = NULL; | 47 | static GConfClient *gconf_client = NULL; |
54 | @@ -80,8 +81,15 @@ | |||
55 | 80 | gchar* type); | 81 | gchar* type); |
56 | 81 | static void show_system_settings_with_context (DbusmenuMenuitem * mi, | 82 | static void show_system_settings_with_context (DbusmenuMenuitem * mi, |
57 | 82 | guint timestamp, | 83 | guint timestamp, |
60 | 83 | gchar * type); | 84 | gchar * type); |
61 | 84 | 85 | ||
62 | 86 | static void device_menu_mgr_show_simple_scan (DbusmenuMenuitem * mi, | ||
63 | 87 | guint timestamp, | ||
64 | 88 | gchar * type); | ||
65 | 89 | static void device_menu_mgr_show_cheese (DbusmenuMenuitem * mi, | ||
66 | 90 | guint timestamp, | ||
67 | 91 | gchar * type); | ||
68 | 92 | |||
69 | 85 | static void | 93 | static void |
70 | 86 | machine_sleep_from_hibernate (DbusmenuMenuitem * mi, | 94 | machine_sleep_from_hibernate (DbusmenuMenuitem * mi, |
71 | 87 | guint timestamp, | 95 | guint timestamp, |
72 | @@ -214,7 +222,6 @@ | |||
73 | 214 | 222 | ||
74 | 215 | screensaver_throttle(type); | 223 | screensaver_throttle(type); |
75 | 216 | lock_if_possible (self); | 224 | lock_if_possible (self); |
76 | 217 | |||
77 | 218 | dbus_g_proxy_begin_call(up_main_proxy, | 225 | dbus_g_proxy_begin_call(up_main_proxy, |
78 | 219 | type, | 226 | type, |
79 | 220 | sleep_response, | 227 | sleep_response, |
80 | @@ -460,6 +467,43 @@ | |||
81 | 460 | g_free(control_centre_command); | 467 | g_free(control_centre_command); |
82 | 461 | } | 468 | } |
83 | 462 | 469 | ||
84 | 470 | // TODO: refactor both of these down to the one method. | ||
85 | 471 | static void device_menu_mgr_show_simple_scan (DbusmenuMenuitem * mi, | ||
86 | 472 | guint timestamp, | ||
87 | 473 | gchar * type) | ||
88 | 474 | { | ||
89 | 475 | GError * error = NULL; | ||
90 | 476 | if (!g_spawn_command_line_async("simple-scan", &error)) | ||
91 | 477 | { | ||
92 | 478 | g_warning("Unable to launch simple-scan: %s", error->message); | ||
93 | 479 | g_error_free(error); | ||
94 | 480 | if (!g_spawn_command_line_async("software-center simple-scan", &error)) | ||
95 | 481 | { | ||
96 | 482 | g_warning ("Unable to launch software-centre simple-scan: %s", | ||
97 | 483 | error->message); | ||
98 | 484 | g_error_free(error); | ||
99 | 485 | } | ||
100 | 486 | } | ||
101 | 487 | } | ||
102 | 488 | |||
103 | 489 | static void device_menu_mgr_show_cheese (DbusmenuMenuitem * mi, | ||
104 | 490 | guint timestamp, | ||
105 | 491 | gchar * type) | ||
106 | 492 | { | ||
107 | 493 | GError * error = NULL; | ||
108 | 494 | if (!g_spawn_command_line_async("cheese", &error)) | ||
109 | 495 | { | ||
110 | 496 | g_warning("Unable to launch cheese: %s", error->message); | ||
111 | 497 | g_error_free(error); | ||
112 | 498 | if (!g_spawn_command_line_async("software-center cheese", &error)) | ||
113 | 499 | { | ||
114 | 500 | g_warning ("Unable to launch software-centre cheese: %s", | ||
115 | 501 | error->message); | ||
116 | 502 | g_error_free(error); | ||
117 | 503 | } | ||
118 | 504 | } | ||
119 | 505 | } | ||
120 | 506 | |||
121 | 463 | static void | 507 | static void |
122 | 464 | device_menu_mgr_build_static_items (DeviceMenuMgr* self) | 508 | device_menu_mgr_build_static_items (DeviceMenuMgr* self) |
123 | 465 | { | 509 | { |
124 | @@ -547,15 +591,14 @@ | |||
125 | 547 | scanners_menuitem = dbusmenu_menuitem_new(); | 591 | scanners_menuitem = dbusmenu_menuitem_new(); |
126 | 548 | dbusmenu_menuitem_property_set (scanners_menuitem, | 592 | dbusmenu_menuitem_property_set (scanners_menuitem, |
127 | 549 | DBUSMENU_MENUITEM_PROP_LABEL, | 593 | DBUSMENU_MENUITEM_PROP_LABEL, |
129 | 550 | _("HP Scanners")); | 594 | _("Scanners")); |
130 | 551 | g_signal_connect (G_OBJECT(scanners_menuitem), | 595 | g_signal_connect (G_OBJECT(scanners_menuitem), |
131 | 552 | DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, | 596 | DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
134 | 553 | G_CALLBACK(show_system_settings_with_context), | 597 | G_CALLBACK(device_menu_mgr_show_simple_scan), |
135 | 554 | "scanners"); | 598 | NULL); |
136 | 555 | dbusmenu_menuitem_child_add_position (self->root_item, | 599 | dbusmenu_menuitem_child_add_position (self->root_item, |
137 | 556 | scanners_menuitem, | 600 | scanners_menuitem, |
138 | 557 | 8); | 601 | 8); |
139 | 558 | //tmp | ||
140 | 559 | dbusmenu_menuitem_property_set_bool (scanners_menuitem, | 602 | dbusmenu_menuitem_property_set_bool (scanners_menuitem, |
141 | 560 | DBUSMENU_MENUITEM_PROP_VISIBLE, | 603 | DBUSMENU_MENUITEM_PROP_VISIBLE, |
142 | 561 | FALSE); | 604 | FALSE); |
143 | @@ -563,15 +606,14 @@ | |||
144 | 563 | webcam_menuitem = dbusmenu_menuitem_new(); | 606 | webcam_menuitem = dbusmenu_menuitem_new(); |
145 | 564 | dbusmenu_menuitem_property_set (webcam_menuitem, | 607 | dbusmenu_menuitem_property_set (webcam_menuitem, |
146 | 565 | DBUSMENU_MENUITEM_PROP_LABEL, | 608 | DBUSMENU_MENUITEM_PROP_LABEL, |
148 | 566 | _("HP Webcam")); | 609 | _("Webcam")); |
149 | 567 | g_signal_connect (G_OBJECT(webcam_menuitem), | 610 | g_signal_connect (G_OBJECT(webcam_menuitem), |
150 | 568 | DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, | 611 | DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED, |
153 | 569 | G_CALLBACK(show_system_settings_with_context), | 612 | G_CALLBACK(device_menu_mgr_show_cheese), |
154 | 570 | "HP Webcam"); | 613 | NULL); |
155 | 571 | dbusmenu_menuitem_child_add_position (self->root_item, | 614 | dbusmenu_menuitem_child_add_position (self->root_item, |
156 | 572 | webcam_menuitem, | 615 | webcam_menuitem, |
157 | 573 | 10); | 616 | 10); |
158 | 574 | //tmp | ||
159 | 575 | dbusmenu_menuitem_property_set_bool (webcam_menuitem, | 617 | dbusmenu_menuitem_property_set_bool (webcam_menuitem, |
160 | 576 | DBUSMENU_MENUITEM_PROP_VISIBLE, | 618 | DBUSMENU_MENUITEM_PROP_VISIBLE, |
161 | 577 | FALSE); | 619 | FALSE); |
162 | @@ -681,7 +723,9 @@ | |||
163 | 681 | restart_shutdown_logout_mi->logout_mi = logout_mi; | 723 | restart_shutdown_logout_mi->logout_mi = logout_mi; |
164 | 682 | restart_shutdown_logout_mi->shutdown_mi = shutdown_mi; | 724 | restart_shutdown_logout_mi->shutdown_mi = shutdown_mi; |
165 | 683 | 725 | ||
167 | 684 | update_menu_entries(restart_shutdown_logout_mi); | 726 | update_menu_entries(restart_shutdown_logout_mi); |
168 | 727 | // Time to create the udev mgr and hand it the static relevant items. | ||
169 | 728 | self->udev_mgr = udev_mgr_new (scanners_menuitem, webcam_menuitem); | ||
170 | 685 | } | 729 | } |
171 | 686 | 730 | ||
172 | 687 | 731 | ||
173 | 688 | 732 | ||
174 | === added file 'src/sane-rules.h' | |||
175 | --- src/sane-rules.h 1970-01-01 00:00:00 +0000 | |||
176 | +++ src/sane-rules.h 2011-08-09 11:36:39 +0000 | |||
177 | @@ -0,0 +1,778 @@ | |||
178 | 1 | void populate_scsi_scanners (GHashTable* scanners) | ||
179 | 2 | { | ||
180 | 3 | GList* epson = NULL; | ||
181 | 4 | epson = g_list_append (epson, g_strdup ("GT-9700")); | ||
182 | 5 | epson = g_list_append (epson, g_strdup ("GT-9800")); | ||
183 | 6 | epson = g_list_append (epson, g_strdup ("Perfection1200")); | ||
184 | 7 | epson = g_list_append (epson, g_strdup ("Perfection636")); | ||
185 | 8 | epson = g_list_append (epson, g_strdup ("SCANNER GT-7000")); | ||
186 | 9 | g_hash_table_insert (scanners, | ||
187 | 10 | g_strdup("EPSON"), | ||
188 | 11 | epson); | ||
189 | 12 | |||
190 | 13 | |||
191 | 14 | GList* hp = NULL; | ||
192 | 15 | hp = g_list_append (hp, g_strdup ("C1130A")); | ||
193 | 16 | hp = g_list_append (hp, g_strdup ("C1750A")); | ||
194 | 17 | hp = g_list_append (hp, g_strdup ("C1790A")); | ||
195 | 18 | hp = g_list_append (hp, g_strdup ("C2500A")); | ||
196 | 19 | hp = g_list_append (hp, g_strdup ("C2520A")); | ||
197 | 20 | hp = g_list_append (hp, g_strdup ("C5110A")); | ||
198 | 21 | hp = g_list_append (hp, g_strdup ("C6270A")); | ||
199 | 22 | hp = g_list_append (hp, g_strdup ("C7670A")); | ||
200 | 23 | g_hash_table_insert (scanners, | ||
201 | 24 | g_strdup("HP"), | ||
202 | 25 | hp); | ||
203 | 26 | } | ||
204 | 27 | |||
205 | 28 | |||
206 | 29 | |||
207 | 30 | void populate_usb_scanners (GHashTable* scanners) | ||
208 | 31 | { | ||
209 | 32 | GList* hp = NULL; | ||
210 | 33 | |||
211 | 34 | hp = g_list_append (hp, g_strdup ("0101")); | ||
212 | 35 | hp = g_list_append (hp, g_strdup ("0105")); | ||
213 | 36 | hp = g_list_append (hp, g_strdup ("0201")); | ||
214 | 37 | hp = g_list_append (hp, g_strdup ("0205")); | ||
215 | 38 | hp = g_list_append (hp, g_strdup ("0305")); | ||
216 | 39 | hp = g_list_append (hp, g_strdup ("0401")); | ||
217 | 40 | hp = g_list_append (hp, g_strdup ("0405")); | ||
218 | 41 | hp = g_list_append (hp, g_strdup ("0505")); | ||
219 | 42 | hp = g_list_append (hp, g_strdup ("0601")); | ||
220 | 43 | hp = g_list_append (hp, g_strdup ("0605")); | ||
221 | 44 | hp = g_list_append (hp, g_strdup ("0701")); | ||
222 | 45 | hp = g_list_append (hp, g_strdup ("0705")); | ||
223 | 46 | hp = g_list_append (hp, g_strdup ("0801")); | ||
224 | 47 | hp = g_list_append (hp, g_strdup ("0805")); | ||
225 | 48 | hp = g_list_append (hp, g_strdup ("0901")); | ||
226 | 49 | hp = g_list_append (hp, g_strdup ("0a01")); | ||
227 | 50 | hp = g_list_append (hp, g_strdup ("0b01")); | ||
228 | 51 | hp = g_list_append (hp, g_strdup ("1005")); | ||
229 | 52 | hp = g_list_append (hp, g_strdup ("1105")); | ||
230 | 53 | hp = g_list_append (hp, g_strdup ("1205")); | ||
231 | 54 | hp = g_list_append (hp, g_strdup ("1305")); | ||
232 | 55 | hp = g_list_append (hp, g_strdup ("1405")); | ||
233 | 56 | hp = g_list_append (hp, g_strdup ("1705")); | ||
234 | 57 | hp = g_list_append (hp, g_strdup ("1805")); | ||
235 | 58 | hp = g_list_append (hp, g_strdup ("2005")); | ||
236 | 59 | hp = g_list_append (hp, g_strdup ("2205")); | ||
237 | 60 | hp = g_list_append (hp, g_strdup ("2305")); | ||
238 | 61 | hp = g_list_append (hp, g_strdup ("2405")); | ||
239 | 62 | hp = g_list_append (hp, g_strdup ("2605")); | ||
240 | 63 | hp = g_list_append (hp, g_strdup ("2805")); | ||
241 | 64 | hp = g_list_append (hp, g_strdup ("3805")); | ||
242 | 65 | hp = g_list_append (hp, g_strdup ("3905")); | ||
243 | 66 | hp = g_list_append (hp, g_strdup ("3B17")); | ||
244 | 67 | hp = g_list_append (hp, g_strdup ("4105")); | ||
245 | 68 | hp = g_list_append (hp, g_strdup ("4205")); | ||
246 | 69 | hp = g_list_append (hp, g_strdup ("4305")); | ||
247 | 70 | hp = g_list_append (hp, g_strdup ("4505")); | ||
248 | 71 | hp = g_list_append (hp, g_strdup ("4605")); | ||
249 | 72 | hp = g_list_append (hp, g_strdup ("5617")); | ||
250 | 73 | hp = g_list_append (hp, g_strdup ("5717")); | ||
251 | 74 | |||
252 | 75 | g_hash_table_insert (scanners, | ||
253 | 76 | g_strdup("03f0"), | ||
254 | 77 | hp); | ||
255 | 78 | |||
256 | 79 | GList* mustek_2 = NULL; | ||
257 | 80 | mustek_2 = g_list_append (mustek_2, g_strdup ("1000")); | ||
258 | 81 | mustek_2 = g_list_append (mustek_2, g_strdup ("1001")); | ||
259 | 82 | g_hash_table_insert (scanners, | ||
260 | 83 | g_strdup("0400"), | ||
261 | 84 | mustek_2); | ||
262 | 85 | |||
263 | 86 | GList* kodak = NULL; | ||
264 | 87 | kodak = g_list_append (kodak, g_strdup ("6001")); | ||
265 | 88 | kodak = g_list_append (kodak, g_strdup ("6002")); | ||
266 | 89 | kodak = g_list_append (kodak, g_strdup ("6003")); | ||
267 | 90 | kodak = g_list_append (kodak, g_strdup ("6004")); | ||
268 | 91 | kodak = g_list_append (kodak, g_strdup ("6005")); | ||
269 | 92 | g_hash_table_insert (scanners, | ||
270 | 93 | g_strdup("040a"), | ||
271 | 94 | kodak); | ||
272 | 95 | |||
273 | 96 | GList* creative = NULL; | ||
274 | 97 | |||
275 | 98 | creative = g_list_append (creative, g_strdup ("4007")); | ||
276 | 99 | |||
277 | 100 | g_hash_table_insert (scanners, | ||
278 | 101 | g_strdup("041e"), | ||
279 | 102 | creative); | ||
280 | 103 | |||
281 | 104 | GList* lexmark = NULL; | ||
282 | 105 | |||
283 | 106 | lexmark = g_list_append (lexmark, g_strdup("002d")); | ||
284 | 107 | lexmark = g_list_append (lexmark, g_strdup("0060")); | ||
285 | 108 | lexmark = g_list_append (lexmark, g_strdup("007c")); | ||
286 | 109 | lexmark = g_list_append (lexmark, g_strdup("007d")); | ||
287 | 110 | |||
288 | 111 | g_hash_table_insert (scanners, | ||
289 | 112 | g_strdup("043d"), | ||
290 | 113 | lexmark); | ||
291 | 114 | |||
292 | 115 | |||
293 | 116 | GList* genius = NULL; | ||
294 | 117 | genius = g_list_append (genius, g_strdup("2004")); | ||
295 | 118 | genius = g_list_append (genius, g_strdup("2007")); | ||
296 | 119 | genius = g_list_append (genius, g_strdup("2008")); | ||
297 | 120 | genius = g_list_append (genius, g_strdup("2009")); | ||
298 | 121 | genius = g_list_append (genius, g_strdup("2011")); | ||
299 | 122 | genius = g_list_append (genius, g_strdup("2013")); | ||
300 | 123 | genius = g_list_append (genius, g_strdup("2014")); | ||
301 | 124 | genius = g_list_append (genius, g_strdup("2015")); | ||
302 | 125 | genius = g_list_append (genius, g_strdup("2016")); | ||
303 | 126 | genius = g_list_append (genius, g_strdup("2017")); | ||
304 | 127 | genius = g_list_append (genius, g_strdup("201a")); | ||
305 | 128 | genius = g_list_append (genius, g_strdup("201b")); | ||
306 | 129 | genius = g_list_append (genius, g_strdup("201d")); | ||
307 | 130 | genius = g_list_append (genius, g_strdup("201e")); | ||
308 | 131 | genius = g_list_append (genius, g_strdup("201f")); | ||
309 | 132 | genius = g_list_append (genius, g_strdup("20c1")); | ||
310 | 133 | g_hash_table_insert (scanners, | ||
311 | 134 | g_strdup("0458"), | ||
312 | 135 | genius); | ||
313 | 136 | |||
314 | 137 | GList* medion = NULL; | ||
315 | 138 | medion = g_list_append (medion, g_strdup("0377")); | ||
316 | 139 | g_hash_table_insert (scanners, | ||
317 | 140 | g_strdup("0461"), | ||
318 | 141 | medion); | ||
319 | 142 | |||
320 | 143 | GList* trust = NULL; | ||
321 | 144 | trust = g_list_append (trust, g_strdup("1000")); | ||
322 | 145 | trust = g_list_append (trust, g_strdup("1002")); | ||
323 | 146 | g_hash_table_insert (scanners, | ||
324 | 147 | g_strdup("047b"), | ||
325 | 148 | trust); | ||
326 | 149 | |||
327 | 150 | GList* kyocera = NULL; | ||
328 | 151 | kyocera = g_list_append (kyocera, g_strdup("0335")); | ||
329 | 152 | g_hash_table_insert (scanners, | ||
330 | 153 | g_strdup("0482"), | ||
331 | 154 | kyocera); | ||
332 | 155 | |||
333 | 156 | GList* compaq = NULL; | ||
334 | 157 | compaq = g_list_append (compaq, g_strdup("001a")); | ||
335 | 158 | g_hash_table_insert (scanners, | ||
336 | 159 | g_strdup("049f"), | ||
337 | 160 | compaq); | ||
338 | 161 | GList* benq = NULL; | ||
339 | 162 | benq = g_list_append (benq, g_strdup("1a20")); | ||
340 | 163 | benq = g_list_append (benq, g_strdup("1a2a")); | ||
341 | 164 | benq = g_list_append (benq, g_strdup("2022")); | ||
342 | 165 | benq = g_list_append (benq, g_strdup("2040")); | ||
343 | 166 | benq = g_list_append (benq, g_strdup("2060")); | ||
344 | 167 | benq = g_list_append (benq, g_strdup("207e")); | ||
345 | 168 | benq = g_list_append (benq, g_strdup("20b0")); | ||
346 | 169 | benq = g_list_append (benq, g_strdup("20be")); | ||
347 | 170 | benq = g_list_append (benq, g_strdup("20c0")); | ||
348 | 171 | benq = g_list_append (benq, g_strdup("20de")); | ||
349 | 172 | benq = g_list_append (benq, g_strdup("20f8")); | ||
350 | 173 | benq = g_list_append (benq, g_strdup("20fc")); | ||
351 | 174 | benq = g_list_append (benq, g_strdup("20fe")); | ||
352 | 175 | benq = g_list_append (benq, g_strdup("2137")); | ||
353 | 176 | benq = g_list_append (benq, g_strdup("2211")); | ||
354 | 177 | g_hash_table_insert (scanners, | ||
355 | 178 | g_strdup("04a5"), | ||
356 | 179 | benq); | ||
357 | 180 | |||
358 | 181 | GList* visioneer = NULL; | ||
359 | 182 | visioneer = g_list_append (visioneer, g_strdup("0229")); | ||
360 | 183 | visioneer = g_list_append (visioneer, g_strdup("0390")); | ||
361 | 184 | visioneer = g_list_append (visioneer, g_strdup("0420")); | ||
362 | 185 | visioneer = g_list_append (visioneer, g_strdup("0421")); | ||
363 | 186 | visioneer = g_list_append (visioneer, g_strdup("0422")); | ||
364 | 187 | visioneer = g_list_append (visioneer, g_strdup("0423")); | ||
365 | 188 | visioneer = g_list_append (visioneer, g_strdup("0424")); | ||
366 | 189 | visioneer = g_list_append (visioneer, g_strdup("0426")); | ||
367 | 190 | visioneer = g_list_append (visioneer, g_strdup("0427")); | ||
368 | 191 | visioneer = g_list_append (visioneer, g_strdup("0444")); | ||
369 | 192 | visioneer = g_list_append (visioneer, g_strdup("0446")); | ||
370 | 193 | visioneer = g_list_append (visioneer, g_strdup("0447")); | ||
371 | 194 | visioneer = g_list_append (visioneer, g_strdup("0448")); | ||
372 | 195 | visioneer = g_list_append (visioneer, g_strdup("0449")); | ||
373 | 196 | visioneer = g_list_append (visioneer, g_strdup("044c")); | ||
374 | 197 | visioneer = g_list_append (visioneer, g_strdup("0474")); | ||
375 | 198 | visioneer = g_list_append (visioneer, g_strdup("0475")); | ||
376 | 199 | visioneer = g_list_append (visioneer, g_strdup("0477")); | ||
377 | 200 | visioneer = g_list_append (visioneer, g_strdup("0478")); | ||
378 | 201 | visioneer = g_list_append (visioneer, g_strdup("0479")); | ||
379 | 202 | visioneer = g_list_append (visioneer, g_strdup("047a")); | ||
380 | 203 | visioneer = g_list_append (visioneer, g_strdup("047b")); | ||
381 | 204 | visioneer = g_list_append (visioneer, g_strdup("047c")); | ||
382 | 205 | visioneer = g_list_append (visioneer, g_strdup("048c")); | ||
383 | 206 | visioneer = g_list_append (visioneer, g_strdup("048d")); | ||
384 | 207 | visioneer = g_list_append (visioneer, g_strdup("048e")); | ||
385 | 208 | visioneer = g_list_append (visioneer, g_strdup("048f")); | ||
386 | 209 | visioneer = g_list_append (visioneer, g_strdup("0490")); | ||
387 | 210 | visioneer = g_list_append (visioneer, g_strdup("0491")); | ||
388 | 211 | visioneer = g_list_append (visioneer, g_strdup("0492")); | ||
389 | 212 | visioneer = g_list_append (visioneer, g_strdup("0493")); | ||
390 | 213 | visioneer = g_list_append (visioneer, g_strdup("0494")); | ||
391 | 214 | visioneer = g_list_append (visioneer, g_strdup("0495")); | ||
392 | 215 | visioneer = g_list_append (visioneer, g_strdup("0497")); | ||
393 | 216 | visioneer = g_list_append (visioneer, g_strdup("0498")); | ||
394 | 217 | visioneer = g_list_append (visioneer, g_strdup("0499")); | ||
395 | 218 | visioneer = g_list_append (visioneer, g_strdup("049a")); | ||
396 | 219 | visioneer = g_list_append (visioneer, g_strdup("049b")); | ||
397 | 220 | visioneer = g_list_append (visioneer, g_strdup("049c")); | ||
398 | 221 | visioneer = g_list_append (visioneer, g_strdup("049d")); | ||
399 | 222 | visioneer = g_list_append (visioneer, g_strdup("04a7")); | ||
400 | 223 | visioneer = g_list_append (visioneer, g_strdup("04ac")); | ||
401 | 224 | g_hash_table_insert (scanners, | ||
402 | 225 | g_strdup("04a7"), | ||
403 | 226 | visioneer); | ||
404 | 227 | GList* canon = NULL; | ||
405 | 228 | canon = g_list_append (canon, g_strdup("1601")); | ||
406 | 229 | canon = g_list_append (canon, g_strdup("1602")); | ||
407 | 230 | canon = g_list_append (canon, g_strdup("1603")); | ||
408 | 231 | canon = g_list_append (canon, g_strdup("1604")); | ||
409 | 232 | canon = g_list_append (canon, g_strdup("1606")); | ||
410 | 233 | canon = g_list_append (canon, g_strdup("1607")); | ||
411 | 234 | canon = g_list_append (canon, g_strdup("1608")); | ||
412 | 235 | canon = g_list_append (canon, g_strdup("1609")); | ||
413 | 236 | canon = g_list_append (canon, g_strdup("160a")); | ||
414 | 237 | canon = g_list_append (canon, g_strdup("160b")); | ||
415 | 238 | canon = g_list_append (canon, g_strdup("1706")); | ||
416 | 239 | canon = g_list_append (canon, g_strdup("1707")); | ||
417 | 240 | canon = g_list_append (canon, g_strdup("1708")); | ||
418 | 241 | canon = g_list_append (canon, g_strdup("1709")); | ||
419 | 242 | canon = g_list_append (canon, g_strdup("170a")); | ||
420 | 243 | canon = g_list_append (canon, g_strdup("170b")); | ||
421 | 244 | canon = g_list_append (canon, g_strdup("170c")); | ||
422 | 245 | canon = g_list_append (canon, g_strdup("170d")); | ||
423 | 246 | canon = g_list_append (canon, g_strdup("170e")); | ||
424 | 247 | canon = g_list_append (canon, g_strdup("1712")); | ||
425 | 248 | canon = g_list_append (canon, g_strdup("1713")); | ||
426 | 249 | canon = g_list_append (canon, g_strdup("1714")); | ||
427 | 250 | canon = g_list_append (canon, g_strdup("1715")); | ||
428 | 251 | canon = g_list_append (canon, g_strdup("1716")); | ||
429 | 252 | canon = g_list_append (canon, g_strdup("1717")); | ||
430 | 253 | canon = g_list_append (canon, g_strdup("1718")); | ||
431 | 254 | canon = g_list_append (canon, g_strdup("1719")); | ||
432 | 255 | canon = g_list_append (canon, g_strdup("171a")); | ||
433 | 256 | canon = g_list_append (canon, g_strdup("171b")); | ||
434 | 257 | canon = g_list_append (canon, g_strdup("171c")); | ||
435 | 258 | canon = g_list_append (canon, g_strdup("1721")); | ||
436 | 259 | canon = g_list_append (canon, g_strdup("1722")); | ||
437 | 260 | canon = g_list_append (canon, g_strdup("1723")); | ||
438 | 261 | canon = g_list_append (canon, g_strdup("1724")); | ||
439 | 262 | canon = g_list_append (canon, g_strdup("1725")); | ||
440 | 263 | canon = g_list_append (canon, g_strdup("1726")); | ||
441 | 264 | canon = g_list_append (canon, g_strdup("1727")); | ||
442 | 265 | canon = g_list_append (canon, g_strdup("1728")); | ||
443 | 266 | canon = g_list_append (canon, g_strdup("1729")); | ||
444 | 267 | canon = g_list_append (canon, g_strdup("172b")); | ||
445 | 268 | canon = g_list_append (canon, g_strdup("172c")); | ||
446 | 269 | canon = g_list_append (canon, g_strdup("172d")); | ||
447 | 270 | canon = g_list_append (canon, g_strdup("172e")); | ||
448 | 271 | canon = g_list_append (canon, g_strdup("172f")); | ||
449 | 272 | canon = g_list_append (canon, g_strdup("1730")); | ||
450 | 273 | canon = g_list_append (canon, g_strdup("1731")); | ||
451 | 274 | canon = g_list_append (canon, g_strdup("1732")); | ||
452 | 275 | canon = g_list_append (canon, g_strdup("1733")); | ||
453 | 276 | canon = g_list_append (canon, g_strdup("1734")); | ||
454 | 277 | canon = g_list_append (canon, g_strdup("1735")); | ||
455 | 278 | canon = g_list_append (canon, g_strdup("1736")); | ||
456 | 279 | canon = g_list_append (canon, g_strdup("173a")); | ||
457 | 280 | canon = g_list_append (canon, g_strdup("173b")); | ||
458 | 281 | canon = g_list_append (canon, g_strdup("173c")); | ||
459 | 282 | canon = g_list_append (canon, g_strdup("173d")); | ||
460 | 283 | canon = g_list_append (canon, g_strdup("173e")); | ||
461 | 284 | canon = g_list_append (canon, g_strdup("173f")); | ||
462 | 285 | canon = g_list_append (canon, g_strdup("1740")); | ||
463 | 286 | canon = g_list_append (canon, g_strdup("1741")); | ||
464 | 287 | canon = g_list_append (canon, g_strdup("1742")); | ||
465 | 288 | canon = g_list_append (canon, g_strdup("1901")); | ||
466 | 289 | canon = g_list_append (canon, g_strdup("1904")); | ||
467 | 290 | canon = g_list_append (canon, g_strdup("1905")); | ||
468 | 291 | canon = g_list_append (canon, g_strdup("1909")); | ||
469 | 292 | canon = g_list_append (canon, g_strdup("190a")); | ||
470 | 293 | canon = g_list_append (canon, g_strdup("2204")); | ||
471 | 294 | canon = g_list_append (canon, g_strdup("2206")); | ||
472 | 295 | canon = g_list_append (canon, g_strdup("2207")); | ||
473 | 296 | canon = g_list_append (canon, g_strdup("2208")); | ||
474 | 297 | canon = g_list_append (canon, g_strdup("220d")); | ||
475 | 298 | canon = g_list_append (canon, g_strdup("220e")); | ||
476 | 299 | canon = g_list_append (canon, g_strdup("2213")); | ||
477 | 300 | canon = g_list_append (canon, g_strdup("221c")); | ||
478 | 301 | canon = g_list_append (canon, g_strdup("2220")); | ||
479 | 302 | canon = g_list_append (canon, g_strdup("2222")); | ||
480 | 303 | canon = g_list_append (canon, g_strdup("262f")); | ||
481 | 304 | canon = g_list_append (canon, g_strdup("2630")); | ||
482 | 305 | canon = g_list_append (canon, g_strdup("263c")); | ||
483 | 306 | canon = g_list_append (canon, g_strdup("263d")); | ||
484 | 307 | canon = g_list_append (canon, g_strdup("263e")); | ||
485 | 308 | canon = g_list_append (canon, g_strdup("263f")); | ||
486 | 309 | canon = g_list_append (canon, g_strdup("264c")); | ||
487 | 310 | canon = g_list_append (canon, g_strdup("264d")); | ||
488 | 311 | canon = g_list_append (canon, g_strdup("264e")); | ||
489 | 312 | canon = g_list_append (canon, g_strdup("264f")); | ||
490 | 313 | canon = g_list_append (canon, g_strdup("2659")); | ||
491 | 314 | canon = g_list_append (canon, g_strdup("265d")); | ||
492 | 315 | canon = g_list_append (canon, g_strdup("265e")); | ||
493 | 316 | canon = g_list_append (canon, g_strdup("265f")); | ||
494 | 317 | canon = g_list_append (canon, g_strdup("2660")); | ||
495 | 318 | canon = g_list_append (canon, g_strdup("2684")); | ||
496 | 319 | canon = g_list_append (canon, g_strdup("2686")); | ||
497 | 320 | canon = g_list_append (canon, g_strdup("26a3")); | ||
498 | 321 | canon = g_list_append (canon, g_strdup("26b0")); | ||
499 | 322 | canon = g_list_append (canon, g_strdup("26b4")); | ||
500 | 323 | canon = g_list_append (canon, g_strdup("26b5")); | ||
501 | 324 | canon = g_list_append (canon, g_strdup("26ec")); | ||
502 | 325 | canon = g_list_append (canon, g_strdup("26ed")); | ||
503 | 326 | canon = g_list_append (canon, g_strdup("26ee")); | ||
504 | 327 | g_hash_table_insert (scanners, | ||
505 | 328 | g_strdup("04a9"), | ||
506 | 329 | canon); | ||
507 | 330 | |||
508 | 331 | GList* nikon = NULL; | ||
509 | 332 | nikon = g_list_append (nikon, g_strdup ("4000")); | ||
510 | 333 | nikon = g_list_append (nikon, g_strdup ("4001")); | ||
511 | 334 | nikon = g_list_append (nikon, g_strdup ("4002")); | ||
512 | 335 | g_hash_table_insert (scanners, | ||
513 | 336 | g_strdup("04b0"), | ||
514 | 337 | nikon); | ||
515 | 338 | |||
516 | 339 | GList* epson = NULL; | ||
517 | 340 | |||
518 | 341 | // for testing (its a printer not a scanner!) | ||
519 | 342 | //epson = g_list_append (epson, g_strdup ("0001")); | ||
520 | 343 | |||
521 | 344 | epson = g_list_append (epson, g_strdup("0101")); | ||
522 | 345 | epson = g_list_append (epson, g_strdup("0103")); | ||
523 | 346 | epson = g_list_append (epson, g_strdup("0104")); | ||
524 | 347 | epson = g_list_append (epson, g_strdup("0105")); | ||
525 | 348 | epson = g_list_append (epson, g_strdup("0106")); | ||
526 | 349 | epson = g_list_append (epson, g_strdup("0107")); | ||
527 | 350 | epson = g_list_append (epson, g_strdup("0109")); | ||
528 | 351 | epson = g_list_append (epson, g_strdup("010a")); | ||
529 | 352 | epson = g_list_append (epson, g_strdup("010b")); | ||
530 | 353 | epson = g_list_append (epson, g_strdup("010c")); | ||
531 | 354 | epson = g_list_append (epson, g_strdup("010e")); | ||
532 | 355 | epson = g_list_append (epson, g_strdup("010f")); | ||
533 | 356 | epson = g_list_append (epson, g_strdup("0110")); | ||
534 | 357 | epson = g_list_append (epson, g_strdup("0112")); | ||
535 | 358 | epson = g_list_append (epson, g_strdup("0114")); | ||
536 | 359 | epson = g_list_append (epson, g_strdup("011b")); | ||
537 | 360 | epson = g_list_append (epson, g_strdup("011c")); | ||
538 | 361 | epson = g_list_append (epson, g_strdup("011d")); | ||
539 | 362 | epson = g_list_append (epson, g_strdup("011e")); | ||
540 | 363 | epson = g_list_append (epson, g_strdup("011f")); | ||
541 | 364 | epson = g_list_append (epson, g_strdup("0120")); | ||
542 | 365 | epson = g_list_append (epson, g_strdup("0121")); | ||
543 | 366 | epson = g_list_append (epson, g_strdup("0122")); | ||
544 | 367 | epson = g_list_append (epson, g_strdup("0126")); | ||
545 | 368 | epson = g_list_append (epson, g_strdup("0128")); | ||
546 | 369 | epson = g_list_append (epson, g_strdup("0129")); | ||
547 | 370 | epson = g_list_append (epson, g_strdup("012a")); | ||
548 | 371 | epson = g_list_append (epson, g_strdup("012b")); | ||
549 | 372 | epson = g_list_append (epson, g_strdup("012c")); | ||
550 | 373 | epson = g_list_append (epson, g_strdup("0135")); | ||
551 | 374 | epson = g_list_append (epson, g_strdup("0801")); | ||
552 | 375 | epson = g_list_append (epson, g_strdup("0802")); | ||
553 | 376 | epson = g_list_append (epson, g_strdup("0805")); | ||
554 | 377 | epson = g_list_append (epson, g_strdup("0806")); | ||
555 | 378 | epson = g_list_append (epson, g_strdup("0807")); | ||
556 | 379 | epson = g_list_append (epson, g_strdup("0808")); | ||
557 | 380 | epson = g_list_append (epson, g_strdup("080c")); | ||
558 | 381 | epson = g_list_append (epson, g_strdup("080d")); | ||
559 | 382 | epson = g_list_append (epson, g_strdup("080e")); | ||
560 | 383 | epson = g_list_append (epson, g_strdup("080f")); | ||
561 | 384 | epson = g_list_append (epson, g_strdup("0810")); | ||
562 | 385 | epson = g_list_append (epson, g_strdup("0811")); | ||
563 | 386 | epson = g_list_append (epson, g_strdup("0813")); | ||
564 | 387 | epson = g_list_append (epson, g_strdup("0814")); | ||
565 | 388 | epson = g_list_append (epson, g_strdup("0815")); | ||
566 | 389 | epson = g_list_append (epson, g_strdup("0817")); | ||
567 | 390 | epson = g_list_append (epson, g_strdup("0818")); | ||
568 | 391 | epson = g_list_append (epson, g_strdup("0819")); | ||
569 | 392 | epson = g_list_append (epson, g_strdup("081a")); | ||
570 | 393 | epson = g_list_append (epson, g_strdup("081c")); | ||
571 | 394 | epson = g_list_append (epson, g_strdup("081d")); | ||
572 | 395 | epson = g_list_append (epson, g_strdup("081f")); | ||
573 | 396 | epson = g_list_append (epson, g_strdup("0820")); | ||
574 | 397 | epson = g_list_append (epson, g_strdup("0827")); | ||
575 | 398 | epson = g_list_append (epson, g_strdup("0828")); | ||
576 | 399 | epson = g_list_append (epson, g_strdup("0829")); | ||
577 | 400 | epson = g_list_append (epson, g_strdup("082a")); | ||
578 | 401 | epson = g_list_append (epson, g_strdup("082b")); | ||
579 | 402 | epson = g_list_append (epson, g_strdup("082e")); | ||
580 | 403 | epson = g_list_append (epson, g_strdup("082f")); | ||
581 | 404 | epson = g_list_append (epson, g_strdup("0830")); | ||
582 | 405 | epson = g_list_append (epson, g_strdup("0833")); | ||
583 | 406 | epson = g_list_append (epson, g_strdup("0834")); | ||
584 | 407 | epson = g_list_append (epson, g_strdup("0835")); | ||
585 | 408 | epson = g_list_append (epson, g_strdup("0836")); | ||
586 | 409 | epson = g_list_append (epson, g_strdup("0837")); | ||
587 | 410 | epson = g_list_append (epson, g_strdup("0838")); | ||
588 | 411 | epson = g_list_append (epson, g_strdup("0839")); | ||
589 | 412 | epson = g_list_append (epson, g_strdup("083a")); | ||
590 | 413 | epson = g_list_append (epson, g_strdup("083c")); | ||
591 | 414 | epson = g_list_append (epson, g_strdup("0841")); | ||
592 | 415 | epson = g_list_append (epson, g_strdup("0843")); | ||
593 | 416 | epson = g_list_append (epson, g_strdup("0844")); | ||
594 | 417 | epson = g_list_append (epson, g_strdup("0846")); | ||
595 | 418 | epson = g_list_append (epson, g_strdup("0847")); | ||
596 | 419 | epson = g_list_append (epson, g_strdup("0848")); | ||
597 | 420 | epson = g_list_append (epson, g_strdup("0849")); | ||
598 | 421 | epson = g_list_append (epson, g_strdup("084a")); | ||
599 | 422 | epson = g_list_append (epson, g_strdup("084c")); | ||
600 | 423 | epson = g_list_append (epson, g_strdup("084d")); | ||
601 | 424 | epson = g_list_append (epson, g_strdup("084f")); | ||
602 | 425 | epson = g_list_append (epson, g_strdup("0851")); | ||
603 | 426 | epson = g_list_append (epson, g_strdup("0854")); | ||
604 | 427 | epson = g_list_append (epson, g_strdup("0856")); | ||
605 | 428 | g_hash_table_insert (scanners, | ||
606 | 429 | g_strdup("04b8"), | ||
607 | 430 | epson); | ||
608 | 431 | |||
609 | 432 | GList* fujitsu = NULL; | ||
610 | 433 | fujitsu = g_list_append (fujitsu, g_strdup ("1029")); | ||
611 | 434 | fujitsu = g_list_append (fujitsu, g_strdup ("1041")); | ||
612 | 435 | fujitsu = g_list_append (fujitsu, g_strdup ("1042")); | ||
613 | 436 | fujitsu = g_list_append (fujitsu, g_strdup ("1078")); | ||
614 | 437 | fujitsu = g_list_append (fujitsu, g_strdup ("1095")); | ||
615 | 438 | fujitsu = g_list_append (fujitsu, g_strdup ("1096")); | ||
616 | 439 | fujitsu = g_list_append (fujitsu, g_strdup ("1097")); | ||
617 | 440 | fujitsu = g_list_append (fujitsu, g_strdup ("10ad")); | ||
618 | 441 | fujitsu = g_list_append (fujitsu, g_strdup ("10ae")); | ||
619 | 442 | fujitsu = g_list_append (fujitsu, g_strdup ("10af")); | ||
620 | 443 | fujitsu = g_list_append (fujitsu, g_strdup ("10c7")); | ||
621 | 444 | fujitsu = g_list_append (fujitsu, g_strdup ("10cf")); | ||
622 | 445 | fujitsu = g_list_append (fujitsu, g_strdup ("10e0")); | ||
623 | 446 | fujitsu = g_list_append (fujitsu, g_strdup ("10e1")); | ||
624 | 447 | fujitsu = g_list_append (fujitsu, g_strdup ("10e2")); | ||
625 | 448 | fujitsu = g_list_append (fujitsu, g_strdup ("10e6")); | ||
626 | 449 | fujitsu = g_list_append (fujitsu, g_strdup ("10e7")); | ||
627 | 450 | fujitsu = g_list_append (fujitsu, g_strdup ("10ef")); | ||
628 | 451 | fujitsu = g_list_append (fujitsu, g_strdup ("10f2")); | ||
629 | 452 | fujitsu = g_list_append (fujitsu, g_strdup ("10fe")); | ||
630 | 453 | fujitsu = g_list_append (fujitsu, g_strdup ("1135")); | ||
631 | 454 | fujitsu = g_list_append (fujitsu, g_strdup ("114a")); | ||
632 | 455 | fujitsu = g_list_append (fujitsu, g_strdup ("114d")); | ||
633 | 456 | fujitsu = g_list_append (fujitsu, g_strdup ("114e")); | ||
634 | 457 | fujitsu = g_list_append (fujitsu, g_strdup ("114f")); | ||
635 | 458 | fujitsu = g_list_append (fujitsu, g_strdup ("1150")); | ||
636 | 459 | fujitsu = g_list_append (fujitsu, g_strdup ("1155")); | ||
637 | 460 | fujitsu = g_list_append (fujitsu, g_strdup ("1156")); | ||
638 | 461 | fujitsu = g_list_append (fujitsu, g_strdup ("116f")); | ||
639 | 462 | fujitsu = g_list_append (fujitsu, g_strdup ("1174")); | ||
640 | 463 | fujitsu = g_list_append (fujitsu, g_strdup ("1175")); | ||
641 | 464 | fujitsu = g_list_append (fujitsu, g_strdup ("1176")); | ||
642 | 465 | fujitsu = g_list_append (fujitsu, g_strdup ("1177")); | ||
643 | 466 | fujitsu = g_list_append (fujitsu, g_strdup ("1178")); | ||
644 | 467 | fujitsu = g_list_append (fujitsu, g_strdup ("117f")); | ||
645 | 468 | fujitsu = g_list_append (fujitsu, g_strdup ("119d")); | ||
646 | 469 | fujitsu = g_list_append (fujitsu, g_strdup ("119e")); | ||
647 | 470 | fujitsu = g_list_append (fujitsu, g_strdup ("119f")); | ||
648 | 471 | fujitsu = g_list_append (fujitsu, g_strdup ("11a0")); | ||
649 | 472 | fujitsu = g_list_append (fujitsu, g_strdup ("11a2")); | ||
650 | 473 | fujitsu = g_list_append (fujitsu, g_strdup ("11ed")); | ||
651 | 474 | fujitsu = g_list_append (fujitsu, g_strdup ("11ee")); | ||
652 | 475 | fujitsu = g_list_append (fujitsu, g_strdup ("11ef")); | ||
653 | 476 | fujitsu = g_list_append (fujitsu, g_strdup ("11f1")); | ||
654 | 477 | fujitsu = g_list_append (fujitsu, g_strdup ("11f2")); | ||
655 | 478 | fujitsu = g_list_append (fujitsu, g_strdup ("11f3")); | ||
656 | 479 | fujitsu = g_list_append (fujitsu, g_strdup ("11f4")); | ||
657 | 480 | fujitsu = g_list_append (fujitsu, g_strdup ("11fc")); | ||
658 | 481 | g_hash_table_insert (scanners, | ||
659 | 482 | g_strdup("04c5"), | ||
660 | 483 | fujitsu); | ||
661 | 484 | GList* konica = NULL; | ||
662 | 485 | konica = g_list_append (konica, g_strdup ("0722")); | ||
663 | 486 | g_hash_table_insert (scanners, | ||
664 | 487 | g_strdup("04c8"), | ||
665 | 488 | konica); | ||
666 | 489 | GList* panasonic = NULL; | ||
667 | 490 | panasonic = g_list_append (panasonic, g_strdup ("1000")); | ||
668 | 491 | panasonic = g_list_append (panasonic, g_strdup ("1001")); | ||
669 | 492 | panasonic = g_list_append (panasonic, g_strdup ("1006")); | ||
670 | 493 | panasonic = g_list_append (panasonic, g_strdup ("1007")); | ||
671 | 494 | panasonic = g_list_append (panasonic, g_strdup ("1009")); | ||
672 | 495 | panasonic = g_list_append (panasonic, g_strdup ("100a")); | ||
673 | 496 | panasonic = g_list_append (panasonic, g_strdup ("100f")); | ||
674 | 497 | panasonic = g_list_append (panasonic, g_strdup ("1010")); | ||
675 | 498 | g_hash_table_insert (scanners, | ||
676 | 499 | g_strdup("04da"), | ||
677 | 500 | panasonic); | ||
678 | 501 | |||
679 | 502 | GList* samsung = NULL; | ||
680 | 503 | |||
681 | 504 | samsung = g_list_append (samsung, g_strdup ("341b")); | ||
682 | 505 | samsung = g_list_append (samsung, g_strdup ("341f")); | ||
683 | 506 | samsung = g_list_append (samsung, g_strdup ("3426")); | ||
684 | 507 | samsung = g_list_append (samsung, g_strdup ("342a")); | ||
685 | 508 | samsung = g_list_append (samsung, g_strdup ("342b")); | ||
686 | 509 | samsung = g_list_append (samsung, g_strdup ("342c")); | ||
687 | 510 | samsung = g_list_append (samsung, g_strdup ("3433")); | ||
688 | 511 | samsung = g_list_append (samsung, g_strdup ("3434")); | ||
689 | 512 | samsung = g_list_append (samsung, g_strdup ("343c")); | ||
690 | 513 | samsung = g_list_append (samsung, g_strdup ("3434")); | ||
691 | 514 | g_hash_table_insert (scanners, | ||
692 | 515 | g_strdup("04e8"), | ||
693 | 516 | samsung); | ||
694 | 517 | |||
695 | 518 | GList* pentax = NULL; | ||
696 | 519 | pentax = g_list_append (pentax, g_strdup ("2038")); | ||
697 | 520 | g_hash_table_insert (scanners, | ||
698 | 521 | g_strdup("04f9"), | ||
699 | 522 | pentax); | ||
700 | 523 | |||
701 | 524 | GList* apitek = NULL; | ||
702 | 525 | apitek = g_list_append (apitek, g_strdup ("0202")); | ||
703 | 526 | g_hash_table_insert (scanners, | ||
704 | 527 | g_strdup("0553"), | ||
705 | 528 | apitek); | ||
706 | 529 | |||
707 | 530 | GList* mustek = NULL; | ||
708 | 531 | mustek = g_list_append (mustek, g_strdup ("0001")); | ||
709 | 532 | mustek = g_list_append (mustek, g_strdup ("0002")); | ||
710 | 533 | mustek = g_list_append (mustek, g_strdup ("0006")); | ||
711 | 534 | mustek = g_list_append (mustek, g_strdup ("0008")); | ||
712 | 535 | mustek = g_list_append (mustek, g_strdup ("0010")); | ||
713 | 536 | mustek = g_list_append (mustek, g_strdup ("0210")); | ||
714 | 537 | mustek = g_list_append (mustek, g_strdup ("0218")); | ||
715 | 538 | mustek = g_list_append (mustek, g_strdup ("0219")); | ||
716 | 539 | mustek = g_list_append (mustek, g_strdup ("021a")); | ||
717 | 540 | mustek = g_list_append (mustek, g_strdup ("021b")); | ||
718 | 541 | mustek = g_list_append (mustek, g_strdup ("021c")); | ||
719 | 542 | mustek = g_list_append (mustek, g_strdup ("021d")); | ||
720 | 543 | mustek = g_list_append (mustek, g_strdup ("021e")); | ||
721 | 544 | mustek = g_list_append (mustek, g_strdup ("021f")); | ||
722 | 545 | mustek = g_list_append (mustek, g_strdup ("0409")); | ||
723 | 546 | g_hash_table_insert (scanners, | ||
724 | 547 | g_strdup("055f"), | ||
725 | 548 | mustek); | ||
726 | 549 | GList* artec = NULL; | ||
727 | 550 | artec = g_list_append (artec, g_strdup ("4002")); | ||
728 | 551 | artec = g_list_append (artec, g_strdup ("4003")); | ||
729 | 552 | artec = g_list_append (artec, g_strdup ("4004")); | ||
730 | 553 | artec = g_list_append (artec, g_strdup ("4005")); | ||
731 | 554 | artec = g_list_append (artec, g_strdup ("4006")); | ||
732 | 555 | artec = g_list_append (artec, g_strdup ("4007")); | ||
733 | 556 | artec = g_list_append (artec, g_strdup ("4009")); | ||
734 | 557 | artec = g_list_append (artec, g_strdup ("4010")); | ||
735 | 558 | artec = g_list_append (artec, g_strdup ("4011")); | ||
736 | 559 | g_hash_table_insert (scanners, | ||
737 | 560 | g_strdup("05d8"), | ||
738 | 561 | artec); | ||
739 | 562 | |||
740 | 563 | GList* microtek = NULL; | ||
741 | 564 | microtek = g_list_append (microtek, g_strdup ("0099")); | ||
742 | 565 | microtek = g_list_append (microtek, g_strdup ("009a")); | ||
743 | 566 | microtek = g_list_append (microtek, g_strdup ("00a3")); | ||
744 | 567 | microtek = g_list_append (microtek, g_strdup ("00b6")); | ||
745 | 568 | microtek = g_list_append (microtek, g_strdup ("30cf")); | ||
746 | 569 | microtek = g_list_append (microtek, g_strdup ("30d4")); | ||
747 | 570 | microtek = g_list_append (microtek, g_strdup ("40b3")); | ||
748 | 571 | microtek = g_list_append (microtek, g_strdup ("40b8")); | ||
749 | 572 | microtek = g_list_append (microtek, g_strdup ("40ca")); | ||
750 | 573 | microtek = g_list_append (microtek, g_strdup ("40cb")); | ||
751 | 574 | microtek = g_list_append (microtek, g_strdup ("40dd")); | ||
752 | 575 | microtek = g_list_append (microtek, g_strdup ("40ff")); | ||
753 | 576 | microtek = g_list_append (microtek, g_strdup ("80a3")); | ||
754 | 577 | g_hash_table_insert (scanners, | ||
755 | 578 | g_strdup("05da"), | ||
756 | 579 | microtek); | ||
757 | 580 | |||
758 | 581 | GList* avision = NULL; | ||
759 | 582 | avision = g_list_append (avision, g_strdup ("0268")); | ||
760 | 583 | avision = g_list_append (avision, g_strdup ("026a")); | ||
761 | 584 | avision = g_list_append (avision, g_strdup ("0a13")); | ||
762 | 585 | avision = g_list_append (avision, g_strdup ("0a15")); | ||
763 | 586 | avision = g_list_append (avision, g_strdup ("0a16")); | ||
764 | 587 | avision = g_list_append (avision, g_strdup ("0a18")); | ||
765 | 588 | avision = g_list_append (avision, g_strdup ("0a19")); | ||
766 | 589 | avision = g_list_append (avision, g_strdup ("0a23")); | ||
767 | 590 | avision = g_list_append (avision, g_strdup ("0a24")); | ||
768 | 591 | avision = g_list_append (avision, g_strdup ("0a25")); | ||
769 | 592 | avision = g_list_append (avision, g_strdup ("0a27")); | ||
770 | 593 | avision = g_list_append (avision, g_strdup ("0a2a")); | ||
771 | 594 | avision = g_list_append (avision, g_strdup ("0a2b")); | ||
772 | 595 | avision = g_list_append (avision, g_strdup ("0a2c")); | ||
773 | 596 | avision = g_list_append (avision, g_strdup ("0a2d")); | ||
774 | 597 | avision = g_list_append (avision, g_strdup ("0a2e")); | ||
775 | 598 | avision = g_list_append (avision, g_strdup ("0a2f")); | ||
776 | 599 | avision = g_list_append (avision, g_strdup ("0a33")); | ||
777 | 600 | avision = g_list_append (avision, g_strdup ("0a3a")); | ||
778 | 601 | avision = g_list_append (avision, g_strdup ("0a3c")); | ||
779 | 602 | avision = g_list_append (avision, g_strdup ("0a40")); | ||
780 | 603 | avision = g_list_append (avision, g_strdup ("0a41")); | ||
781 | 604 | avision = g_list_append (avision, g_strdup ("0a45")); | ||
782 | 605 | avision = g_list_append (avision, g_strdup ("0a4d")); | ||
783 | 606 | avision = g_list_append (avision, g_strdup ("0a4e")); | ||
784 | 607 | avision = g_list_append (avision, g_strdup ("0a4f")); | ||
785 | 608 | avision = g_list_append (avision, g_strdup ("0a5e")); | ||
786 | 609 | avision = g_list_append (avision, g_strdup ("0a61")); | ||
787 | 610 | avision = g_list_append (avision, g_strdup ("0a65")); | ||
788 | 611 | avision = g_list_append (avision, g_strdup ("0a66")); | ||
789 | 612 | avision = g_list_append (avision, g_strdup ("0a68")); | ||
790 | 613 | avision = g_list_append (avision, g_strdup ("0a82")); | ||
791 | 614 | avision = g_list_append (avision, g_strdup ("0a84")); | ||
792 | 615 | avision = g_list_append (avision, g_strdup ("0a93")); | ||
793 | 616 | avision = g_list_append (avision, g_strdup ("0a94")); | ||
794 | 617 | avision = g_list_append (avision, g_strdup ("0aa1")); | ||
795 | 618 | avision = g_list_append (avision, g_strdup ("1a35")); | ||
796 | 619 | g_hash_table_insert (scanners, | ||
797 | 620 | g_strdup("0638"), | ||
798 | 621 | avision); | ||
799 | 622 | GList* minolta = NULL; | ||
800 | 623 | minolta = g_list_append (minolta, g_strdup ("4004")); | ||
801 | 624 | minolta = g_list_append (minolta, g_strdup ("400d")); | ||
802 | 625 | minolta = g_list_append (minolta, g_strdup ("400e")); | ||
803 | 626 | g_hash_table_insert (scanners, | ||
804 | 627 | g_strdup("0686"), | ||
805 | 628 | minolta); | ||
806 | 629 | |||
807 | 630 | GList* agfa = NULL; | ||
808 | 631 | agfa = g_list_append (agfa, g_strdup ("0001")); | ||
809 | 632 | agfa = g_list_append (agfa, g_strdup ("0002")); | ||
810 | 633 | agfa = g_list_append (agfa, g_strdup ("0100")); | ||
811 | 634 | agfa = g_list_append (agfa, g_strdup ("2061")); | ||
812 | 635 | agfa = g_list_append (agfa, g_strdup ("208d")); | ||
813 | 636 | agfa = g_list_append (agfa, g_strdup ("208f")); | ||
814 | 637 | agfa = g_list_append (agfa, g_strdup ("2091")); | ||
815 | 638 | agfa = g_list_append (agfa, g_strdup ("2093")); | ||
816 | 639 | agfa = g_list_append (agfa, g_strdup ("2095")); | ||
817 | 640 | agfa = g_list_append (agfa, g_strdup ("2097")); | ||
818 | 641 | agfa = g_list_append (agfa, g_strdup ("20fd")); | ||
819 | 642 | agfa = g_list_append (agfa, g_strdup ("20ff")); | ||
820 | 643 | g_hash_table_insert (scanners, | ||
821 | 644 | g_strdup("06bd"), | ||
822 | 645 | minolta); | ||
823 | 646 | |||
824 | 647 | GList* umax_2 = NULL; | ||
825 | 648 | umax_2 = g_list_append (umax_2, g_strdup ("0020")); | ||
826 | 649 | g_hash_table_insert (scanners, | ||
827 | 650 | g_strdup("06dc"), | ||
828 | 651 | umax_2); | ||
829 | 652 | |||
830 | 653 | GList* plustek = NULL; | ||
831 | 654 | |||
832 | 655 | plustek = g_list_append (plustek, g_strdup ("0001")); | ||
833 | 656 | plustek = g_list_append (plustek, g_strdup ("0010")); | ||
834 | 657 | plustek = g_list_append (plustek, g_strdup ("0011")); | ||
835 | 658 | plustek = g_list_append (plustek, g_strdup ("0013")); | ||
836 | 659 | plustek = g_list_append (plustek, g_strdup ("0015")); | ||
837 | 660 | plustek = g_list_append (plustek, g_strdup ("0017")); | ||
838 | 661 | plustek = g_list_append (plustek, g_strdup ("0400")); | ||
839 | 662 | plustek = g_list_append (plustek, g_strdup ("0401")); | ||
840 | 663 | plustek = g_list_append (plustek, g_strdup ("0402")); | ||
841 | 664 | plustek = g_list_append (plustek, g_strdup ("0403")); | ||
842 | 665 | plustek = g_list_append (plustek, g_strdup ("040b")); | ||
843 | 666 | plustek = g_list_append (plustek, g_strdup ("040e")); | ||
844 | 667 | plustek = g_list_append (plustek, g_strdup ("0412")); | ||
845 | 668 | plustek = g_list_append (plustek, g_strdup ("0413")); | ||
846 | 669 | plustek = g_list_append (plustek, g_strdup ("0422")); | ||
847 | 670 | plustek = g_list_append (plustek, g_strdup ("0454")); | ||
848 | 671 | plustek = g_list_append (plustek, g_strdup ("045f")); | ||
849 | 672 | plustek = g_list_append (plustek, g_strdup ("0462")); | ||
850 | 673 | plustek = g_list_append (plustek, g_strdup ("0900")); | ||
851 | 674 | g_hash_table_insert (scanners, | ||
852 | 675 | g_strdup("07b3"), | ||
853 | 676 | plustek); | ||
854 | 677 | |||
855 | 678 | GList* corex = NULL; | ||
856 | 679 | corex = g_list_append (corex, g_strdup ("0002")); | ||
857 | 680 | corex = g_list_append (corex, g_strdup ("0005")); | ||
858 | 681 | g_hash_table_insert (scanners, | ||
859 | 682 | g_strdup("08f0"), | ||
860 | 683 | corex); | ||
861 | 684 | |||
862 | 685 | GList* xerox = NULL; | ||
863 | 686 | xerox = g_list_append (xerox, g_strdup ("3d5d")); | ||
864 | 687 | xerox = g_list_append (xerox, g_strdup ("3da4")); | ||
865 | 688 | xerox = g_list_append (xerox, g_strdup ("420c")); | ||
866 | 689 | xerox = g_list_append (xerox, g_strdup ("4265")); | ||
867 | 690 | xerox = g_list_append (xerox, g_strdup ("4293")); | ||
868 | 691 | xerox = g_list_append (xerox, g_strdup ("4294")); | ||
869 | 692 | g_hash_table_insert (scanners, | ||
870 | 693 | g_strdup("0924"), | ||
871 | 694 | xerox); | ||
872 | 695 | |||
873 | 696 | GList* pentax_2 = NULL; | ||
874 | 697 | pentax_2 = g_list_append (pentax_2, g_strdup ("3210")); | ||
875 | 698 | g_hash_table_insert (scanners, | ||
876 | 699 | g_strdup("0a17"), | ||
877 | 700 | pentax_2); | ||
878 | 701 | |||
879 | 702 | GList* portable = NULL; | ||
880 | 703 | portable = g_list_append (portable, g_strdup ("1000")); | ||
881 | 704 | g_hash_table_insert (scanners, | ||
882 | 705 | g_strdup("0a53"), | ||
883 | 706 | portable); | ||
884 | 707 | |||
885 | 708 | GList* syscan = NULL; | ||
886 | 709 | syscan = g_list_append (syscan, g_strdup ("4600")); | ||
887 | 710 | syscan = g_list_append (syscan, g_strdup ("4802")); | ||
888 | 711 | syscan = g_list_append (syscan, g_strdup ("4803")); | ||
889 | 712 | syscan = g_list_append (syscan, g_strdup ("480c")); | ||
890 | 713 | syscan = g_list_append (syscan, g_strdup ("4810")); | ||
891 | 714 | syscan = g_list_append (syscan, g_strdup ("6620")); | ||
892 | 715 | g_hash_table_insert (scanners, | ||
893 | 716 | g_strdup("0a82"), | ||
894 | 717 | syscan); | ||
895 | 718 | |||
896 | 719 | GList* canon_2 = NULL; | ||
897 | 720 | canon_2 = g_list_append (canon_2, g_strdup ("160c")); | ||
898 | 721 | canon_2 = g_list_append (canon_2, g_strdup ("160f")); | ||
899 | 722 | canon_2 = g_list_append (canon_2, g_strdup ("1614")); | ||
900 | 723 | canon_2 = g_list_append (canon_2, g_strdup ("1617")); | ||
901 | 724 | canon_2 = g_list_append (canon_2, g_strdup ("1618")); | ||
902 | 725 | canon_2 = g_list_append (canon_2, g_strdup ("161a")); | ||
903 | 726 | canon_2 = g_list_append (canon_2, g_strdup ("161b")); | ||
904 | 727 | canon_2 = g_list_append (canon_2, g_strdup ("161d")); | ||
905 | 728 | canon_2 = g_list_append (canon_2, g_strdup ("1620")); | ||
906 | 729 | canon_2 = g_list_append (canon_2, g_strdup ("1622")); | ||
907 | 730 | canon_2 = g_list_append (canon_2, g_strdup ("1623")); | ||
908 | 731 | canon_2 = g_list_append (canon_2, g_strdup ("1624")); | ||
909 | 732 | canon_2 = g_list_append (canon_2, g_strdup ("1626")); | ||
910 | 733 | canon_2 = g_list_append (canon_2, g_strdup ("162b")); | ||
911 | 734 | canon_2 = g_list_append (canon_2, g_strdup ("1638")); | ||
912 | 735 | canon_2 = g_list_append (canon_2, g_strdup ("1639")); | ||
913 | 736 | g_hash_table_insert (scanners, | ||
914 | 737 | g_strdup("1083"), | ||
915 | 738 | canon_2); | ||
916 | 739 | |||
917 | 740 | GList* digital = NULL; | ||
918 | 741 | digital = g_list_append (digital, g_strdup ("0001")); | ||
919 | 742 | g_hash_table_insert (scanners, | ||
920 | 743 | g_strdup("1183"), | ||
921 | 744 | digital); | ||
922 | 745 | |||
923 | 746 | GList* konica_2 = NULL; | ||
924 | 747 | konica_2 = g_list_append (konica_2, g_strdup ("2089")); | ||
925 | 748 | g_hash_table_insert (scanners, | ||
926 | 749 | g_strdup("132b"), | ||
927 | 750 | konica_2); | ||
928 | 751 | |||
929 | 752 | GList* umax = NULL; | ||
930 | 753 | umax = g_list_append (umax, g_strdup ("0010")); | ||
931 | 754 | umax = g_list_append (umax, g_strdup ("0030")); | ||
932 | 755 | umax = g_list_append (umax, g_strdup ("0050")); | ||
933 | 756 | umax = g_list_append (umax, g_strdup ("0060")); | ||
934 | 757 | umax = g_list_append (umax, g_strdup ("0070")); | ||
935 | 758 | umax = g_list_append (umax, g_strdup ("0130")); | ||
936 | 759 | umax = g_list_append (umax, g_strdup ("0160")); | ||
937 | 760 | umax = g_list_append (umax, g_strdup ("0230")); | ||
938 | 761 | g_hash_table_insert (scanners, | ||
939 | 762 | g_strdup("1606"), | ||
940 | 763 | umax); | ||
941 | 764 | |||
942 | 765 | GList* docketport = NULL; | ||
943 | 766 | docketport = g_list_append (docketport, g_strdup ("4810")); | ||
944 | 767 | g_hash_table_insert (scanners, | ||
945 | 768 | g_strdup("1dcc"), | ||
946 | 769 | docketport); | ||
947 | 770 | |||
948 | 771 | GList* dell = NULL; | ||
949 | 772 | dell = g_list_append (dell, g_strdup ("5105")); | ||
950 | 773 | dell = g_list_append (dell, g_strdup ("5124")); | ||
951 | 774 | dell = g_list_append (dell, g_strdup ("5250")); | ||
952 | 775 | g_hash_table_insert (scanners, | ||
953 | 776 | g_strdup("413c"), | ||
954 | 777 | dell); | ||
955 | 778 | } | ||
956 | 0 | 779 | ||
957 | === modified file 'src/udev-mgr.c' | |||
958 | --- src/udev-mgr.c 2011-07-19 18:53:15 +0000 | |||
959 | +++ src/udev-mgr.c 2011-08-09 11:36:39 +0000 | |||
960 | @@ -17,22 +17,120 @@ | |||
961 | 17 | with this program. If not, see <http://www.gnu.org/licenses/>. | 17 | with this program. If not, see <http://www.gnu.org/licenses/>. |
962 | 18 | */ | 18 | */ |
963 | 19 | 19 | ||
964 | 20 | #include <gudev/gudev.h> | ||
965 | 21 | |||
966 | 22 | // TEMP | ||
967 | 23 | #include <stdio.h> | ||
968 | 24 | #include <string.h> | ||
969 | 25 | #include <stdlib.h> | ||
970 | 26 | #include <stdarg.h> | ||
971 | 27 | |||
972 | 20 | #include "udev-mgr.h" | 28 | #include "udev-mgr.h" |
973 | 29 | #include "sane-rules.h" | ||
974 | 30 | |||
975 | 31 | static void udevice_mgr_device_list_iterator (gpointer data, | ||
976 | 32 | gpointer userdata); | ||
977 | 33 | static void udev_mgr_uevent_cb (GUdevClient *client, | ||
978 | 34 | gchar *action, | ||
979 | 35 | GUdevDevice *device, | ||
980 | 36 | gpointer user_data); | ||
981 | 37 | static void udev_mgr_update_menuitems (UdevMgr* self); | ||
982 | 38 | static void udev_mgr_check_if_usb_device_is_supported (UdevMgr* self, | ||
983 | 39 | GUdevDevice *device, | ||
984 | 40 | UdevMgrDeviceAction action); | ||
985 | 41 | static void udev_mgr_handle_webcam (UdevMgr* self, | ||
986 | 42 | GUdevDevice* device, | ||
987 | 43 | UdevMgrDeviceAction action); | ||
988 | 44 | static void udev_mgr_handle_scsi_device (UdevMgr* self, | ||
989 | 45 | GUdevDevice* device, | ||
990 | 46 | UdevMgrDeviceAction action); | ||
991 | 47 | |||
992 | 48 | static void udev_mgr_cleanup_lists(gpointer data, gpointer self); | ||
993 | 49 | static void udev_mgr_cleanup_entries(gpointer data, gpointer self); | ||
994 | 50 | |||
995 | 51 | |||
996 | 52 | static void debug_device (UdevMgr* self, | ||
997 | 53 | GUdevDevice* device, | ||
998 | 54 | UdevMgrDeviceAction action); | ||
999 | 55 | |||
1000 | 56 | |||
1001 | 57 | struct _UdevMgr | ||
1002 | 58 | { | ||
1003 | 59 | GObject parent_instance; | ||
1004 | 60 | DbusmenuMenuitem* scanner_item; | ||
1005 | 61 | DbusmenuMenuitem* webcam_item; | ||
1006 | 62 | GUdevClient* client; | ||
1007 | 63 | GHashTable* supported_usb_scanners; | ||
1008 | 64 | GHashTable* supported_scsi_scanners; | ||
1009 | 65 | GHashTable* scanners_present; | ||
1010 | 66 | GHashTable* webcams_present; | ||
1011 | 67 | }; | ||
1012 | 68 | |||
1013 | 69 | const char *subsystems[3] = {"usb", "scsi", "video4linux"}; | ||
1014 | 70 | const gchar* usb_subsystem = "usb"; | ||
1015 | 71 | const gchar* scsi_subsystem = "scsi"; | ||
1016 | 72 | const gchar* video4linux_subsystem = "video4linux"; | ||
1017 | 21 | 73 | ||
1018 | 22 | 74 | ||
1019 | 23 | G_DEFINE_TYPE (UdevMgr, udev_mgr, G_TYPE_OBJECT); | 75 | G_DEFINE_TYPE (UdevMgr, udev_mgr, G_TYPE_OBJECT); |
1020 | 24 | 76 | ||
1021 | 25 | static void | 77 | static void |
1025 | 26 | udev_mgr_init (UdevMgr *object) | 78 | udev_mgr_init (UdevMgr* self) |
1026 | 27 | { | 79 | { |
1027 | 28 | /* TODO: Add initialization code here */ | 80 | self->client = NULL; |
1028 | 81 | self->supported_usb_scanners = NULL; | ||
1029 | 82 | self->scanners_present = NULL; | ||
1030 | 83 | self->webcams_present = NULL; | ||
1031 | 84 | self->client = g_udev_client_new (subsystems); | ||
1032 | 85 | self->supported_usb_scanners = g_hash_table_new_full (g_str_hash, | ||
1033 | 86 | g_str_equal, | ||
1034 | 87 | g_free, | ||
1035 | 88 | (GDestroyNotify)udev_mgr_cleanup_lists); | ||
1036 | 89 | self->supported_scsi_scanners = g_hash_table_new_full (g_str_hash, | ||
1037 | 90 | g_str_equal, | ||
1038 | 91 | g_free, | ||
1039 | 92 | (GDestroyNotify)udev_mgr_cleanup_lists); | ||
1040 | 93 | self->scanners_present = g_hash_table_new_full (g_str_hash, | ||
1041 | 94 | g_str_equal, | ||
1042 | 95 | g_free, | ||
1043 | 96 | g_free); | ||
1044 | 97 | self->webcams_present = g_hash_table_new_full (g_str_hash, | ||
1045 | 98 | g_str_equal, | ||
1046 | 99 | g_free, | ||
1047 | 100 | g_free); | ||
1048 | 101 | |||
1049 | 102 | // load into memory all supported scanners ... | ||
1050 | 103 | populate_usb_scanners (self->supported_usb_scanners); | ||
1051 | 104 | populate_scsi_scanners (self->supported_scsi_scanners); | ||
1052 | 105 | g_signal_connect (G_OBJECT (self->client), | ||
1053 | 106 | "uevent", | ||
1054 | 107 | G_CALLBACK (udev_mgr_uevent_cb), | ||
1055 | 108 | self); | ||
1056 | 109 | } | ||
1057 | 110 | |||
1058 | 111 | static void | ||
1059 | 112 | udev_mgr_cleanup_lists(gpointer data, gpointer self) | ||
1060 | 113 | { | ||
1061 | 114 | GList* scanners = (GList*)data; | ||
1062 | 115 | g_list_foreach (scanners, udev_mgr_cleanup_entries, NULL); | ||
1063 | 116 | g_list_free(scanners); | ||
1064 | 117 | } | ||
1065 | 118 | |||
1066 | 119 | static void | ||
1067 | 120 | udev_mgr_cleanup_entries(gpointer data, gpointer self) | ||
1068 | 121 | { | ||
1069 | 122 | gchar* entry = (gchar*)data; | ||
1070 | 123 | g_free(entry); | ||
1071 | 29 | } | 124 | } |
1072 | 30 | 125 | ||
1073 | 31 | static void | 126 | static void |
1074 | 32 | udev_mgr_finalize (GObject *object) | 127 | udev_mgr_finalize (GObject *object) |
1075 | 33 | { | 128 | { |
1078 | 34 | /* TODO: Add deinitalization code here */ | 129 | UdevMgr* self = UDEV_MGR (object); |
1079 | 35 | 130 | g_hash_table_destroy (self->supported_scsi_scanners); | |
1080 | 131 | g_hash_table_destroy (self->supported_usb_scanners); | ||
1081 | 132 | g_hash_table_destroy (self->scanners_present); | ||
1082 | 133 | g_hash_table_destroy (self->webcams_present); | ||
1083 | 36 | G_OBJECT_CLASS (udev_mgr_parent_class)->finalize (object); | 134 | G_OBJECT_CLASS (udev_mgr_parent_class)->finalize (object); |
1084 | 37 | } | 135 | } |
1085 | 38 | 136 | ||
1086 | @@ -40,7 +138,319 @@ | |||
1087 | 40 | udev_mgr_class_init (UdevMgrClass *klass) | 138 | udev_mgr_class_init (UdevMgrClass *klass) |
1088 | 41 | { | 139 | { |
1089 | 42 | GObjectClass* object_class = G_OBJECT_CLASS (klass); | 140 | GObjectClass* object_class = G_OBJECT_CLASS (klass); |
1090 | 43 | |||
1091 | 44 | object_class->finalize = udev_mgr_finalize; | 141 | object_class->finalize = udev_mgr_finalize; |
1092 | 45 | } | 142 | } |
1093 | 46 | 143 | ||
1094 | 144 | static void | ||
1095 | 145 | udevice_mgr_device_list_iterator (gpointer data, gpointer userdata) | ||
1096 | 146 | { | ||
1097 | 147 | g_return_if_fail (G_UDEV_IS_DEVICE (data)); | ||
1098 | 148 | g_return_if_fail (UDEV_IS_MGR (userdata)); | ||
1099 | 149 | |||
1100 | 150 | UdevMgr* self = UDEV_MGR (userdata); | ||
1101 | 151 | |||
1102 | 152 | GUdevDevice* device = G_UDEV_DEVICE (data); | ||
1103 | 153 | |||
1104 | 154 | const gchar* subsystem = NULL; | ||
1105 | 155 | subsystem = g_udev_device_get_subsystem (device); | ||
1106 | 156 | |||
1107 | 157 | if (g_strcmp0 (subsystem, "usb") == 0){ | ||
1108 | 158 | udev_mgr_check_if_usb_device_is_supported (self, device, ADD); | ||
1109 | 159 | } | ||
1110 | 160 | else if (g_strcmp0 (subsystem, "video4linux") == 0){ | ||
1111 | 161 | udev_mgr_handle_webcam (self, device, ADD); | ||
1112 | 162 | } | ||
1113 | 163 | else if (g_strcmp0 (subsystem, "scsi") == 0){ | ||
1114 | 164 | udev_mgr_handle_scsi_device (self, device, ADD); | ||
1115 | 165 | } | ||
1116 | 166 | |||
1117 | 167 | g_object_unref (device); | ||
1118 | 168 | } | ||
1119 | 169 | |||
1120 | 170 | |||
1121 | 171 | static void udev_mgr_update_menuitems (UdevMgr* self) | ||
1122 | 172 | { | ||
1123 | 173 | dbusmenu_menuitem_property_set_bool (self->scanner_item, | ||
1124 | 174 | DBUSMENU_MENUITEM_PROP_VISIBLE, | ||
1125 | 175 | g_hash_table_size (self->scanners_present) > 0); | ||
1126 | 176 | |||
1127 | 177 | dbusmenu_menuitem_property_set_bool (self->webcam_item, | ||
1128 | 178 | DBUSMENU_MENUITEM_PROP_VISIBLE, | ||
1129 | 179 | g_hash_table_size (self->webcams_present) > 0); | ||
1130 | 180 | |||
1131 | 181 | } | ||
1132 | 182 | |||
1133 | 183 | static void udev_mgr_uevent_cb (GUdevClient *client, | ||
1134 | 184 | gchar *action, | ||
1135 | 185 | GUdevDevice *device, | ||
1136 | 186 | gpointer user_data) | ||
1137 | 187 | { | ||
1138 | 188 | g_return_if_fail (UDEV_IS_MGR (user_data)); | ||
1139 | 189 | UdevMgr* self = UDEV_MGR (user_data); | ||
1140 | 190 | g_return_if_fail (device != NULL); | ||
1141 | 191 | |||
1142 | 192 | g_debug ("just received a UEVENT with an action : %s", action); | ||
1143 | 193 | |||
1144 | 194 | UdevMgrDeviceAction udev_mgr_action = ADD; | ||
1145 | 195 | |||
1146 | 196 | if (g_strcmp0 (action, "remove") == 0){ | ||
1147 | 197 | udev_mgr_action = REMOVE; | ||
1148 | 198 | } | ||
1149 | 199 | |||
1150 | 200 | const gchar* subsystem = NULL; | ||
1151 | 201 | subsystem = g_udev_device_get_subsystem (device); | ||
1152 | 202 | |||
1153 | 203 | if (g_strcmp0 (subsystem, "usb") == 0){ | ||
1154 | 204 | udev_mgr_check_if_usb_device_is_supported (self, | ||
1155 | 205 | device, | ||
1156 | 206 | udev_mgr_action); | ||
1157 | 207 | } | ||
1158 | 208 | else if (g_strcmp0 (subsystem, "video4linux") == 0){ | ||
1159 | 209 | udev_mgr_handle_webcam (self, device, udev_mgr_action); | ||
1160 | 210 | } | ||
1161 | 211 | else if (g_strcmp0 (subsystem, "scsi") == 0){ | ||
1162 | 212 | udev_mgr_handle_scsi_device (self, device, udev_mgr_action); | ||
1163 | 213 | } | ||
1164 | 214 | } | ||
1165 | 215 | |||
1166 | 216 | |||
1167 | 217 | static void | ||
1168 | 218 | udev_mgr_handle_webcam (UdevMgr* self, | ||
1169 | 219 | GUdevDevice* device, | ||
1170 | 220 | UdevMgrDeviceAction action) | ||
1171 | 221 | { | ||
1172 | 222 | if (FALSE) | ||
1173 | 223 | debug_device (self, device, action); | ||
1174 | 224 | |||
1175 | 225 | const gchar* vendor; | ||
1176 | 226 | const gchar* product; | ||
1177 | 227 | |||
1178 | 228 | vendor = g_udev_device_get_property (device, "ID_VENDOR_ID"); | ||
1179 | 229 | product = g_udev_device_get_property (device, "ID_MODEL_ID"); | ||
1180 | 230 | |||
1181 | 231 | if (action == REMOVE){ | ||
1182 | 232 | if (g_hash_table_lookup (self->webcams_present, product) == NULL){ | ||
1183 | 233 | g_warning ("Got a remove event on a webcam device but we don't have that device in our webcam cache"); | ||
1184 | 234 | return; | ||
1185 | 235 | } | ||
1186 | 236 | g_hash_table_remove (self->webcams_present, | ||
1187 | 237 | product); | ||
1188 | 238 | |||
1189 | 239 | } | ||
1190 | 240 | else { | ||
1191 | 241 | if (g_hash_table_lookup (self->webcams_present, product) != NULL){ | ||
1192 | 242 | g_warning ("Got an ADD event on a webcam device but we already have that device in our webcam cache"); | ||
1193 | 243 | return; | ||
1194 | 244 | } | ||
1195 | 245 | g_hash_table_insert (self->webcams_present, | ||
1196 | 246 | g_strdup (product), | ||
1197 | 247 | g_strdup (vendor)); | ||
1198 | 248 | } | ||
1199 | 249 | udev_mgr_update_menuitems (self); | ||
1200 | 250 | } | ||
1201 | 251 | |||
1202 | 252 | static void | ||
1203 | 253 | debug_device (UdevMgr* self, | ||
1204 | 254 | GUdevDevice* device, | ||
1205 | 255 | UdevMgrDeviceAction action) | ||
1206 | 256 | { | ||
1207 | 257 | const gchar* vendor; | ||
1208 | 258 | const gchar* product; | ||
1209 | 259 | const gchar* number; | ||
1210 | 260 | const gchar* name; | ||
1211 | 261 | |||
1212 | 262 | vendor = g_udev_device_get_property (device, "ID_VENDOR_ID"); | ||
1213 | 263 | product = g_udev_device_get_property (device, "ID_MODEL_ID"); | ||
1214 | 264 | number = g_udev_device_get_number (device); | ||
1215 | 265 | name = g_udev_device_get_name (device); | ||
1216 | 266 | |||
1217 | 267 | g_debug ("device vendor id %s , product id of %s , number of %s and name of %s", | ||
1218 | 268 | g_strdup(vendor), | ||
1219 | 269 | g_strdup(product), | ||
1220 | 270 | g_strdup(number), | ||
1221 | 271 | g_strdup(name)); | ||
1222 | 272 | |||
1223 | 273 | const gchar *const *list; | ||
1224 | 274 | const gchar *const *iter; | ||
1225 | 275 | char propstr[500]; | ||
1226 | 276 | guint32 namelen = 0, i; | ||
1227 | 277 | |||
1228 | 278 | list = g_udev_device_get_property_keys(device); | ||
1229 | 279 | |||
1230 | 280 | for (iter = list; iter && *iter; iter++) { | ||
1231 | 281 | if (strlen(*iter) > namelen) | ||
1232 | 282 | namelen = strlen(*iter); | ||
1233 | 283 | } | ||
1234 | 284 | namelen++; | ||
1235 | 285 | |||
1236 | 286 | for (iter = list; iter && *iter; iter++) { | ||
1237 | 287 | strcpy(propstr, *iter); | ||
1238 | 288 | strcat(propstr, ":"); | ||
1239 | 289 | for (i = 0; i < namelen - strlen(*iter); i++) | ||
1240 | 290 | strcat(propstr, " "); | ||
1241 | 291 | strcat(propstr, g_udev_device_get_property(device, *iter)); | ||
1242 | 292 | g_debug("%s", propstr); | ||
1243 | 293 | } | ||
1244 | 294 | } | ||
1245 | 295 | |||
1246 | 296 | static void udev_mgr_handle_scsi_device (UdevMgr* self, | ||
1247 | 297 | GUdevDevice* device, | ||
1248 | 298 | UdevMgrDeviceAction action) | ||
1249 | 299 | { | ||
1250 | 300 | const gchar* type = NULL; | ||
1251 | 301 | type = g_udev_device_get_property (device, "TYPE"); | ||
1252 | 302 | // apparently anything thats type 3 and SCSI is a Scanner | ||
1253 | 303 | if (g_strcmp0 (type, "6") == 0){ | ||
1254 | 304 | gchar* random_scanner_name = g_strdup_printf("%p--scanner", self); | ||
1255 | 305 | g_hash_table_insert (self->scanners_present, | ||
1256 | 306 | random_scanner_name, | ||
1257 | 307 | g_strdup("Scanner")); | ||
1258 | 308 | udev_mgr_update_menuitems (self); | ||
1259 | 309 | return; | ||
1260 | 310 | } | ||
1261 | 311 | |||
1262 | 312 | // We only care about type 3 for the special cases below | ||
1263 | 313 | if (g_strcmp0 (type, "3") != 0){ | ||
1264 | 314 | return; | ||
1265 | 315 | } | ||
1266 | 316 | |||
1267 | 317 | const gchar* vendor = NULL; | ||
1268 | 318 | vendor = g_udev_device_get_property (device, "VENDOR"); | ||
1269 | 319 | |||
1270 | 320 | if (vendor == NULL) | ||
1271 | 321 | return; | ||
1272 | 322 | |||
1273 | 323 | GList* vendor_list = NULL; | ||
1274 | 324 | vendor_list = g_hash_table_lookup (self->supported_scsi_scanners, | ||
1275 | 325 | (gpointer)vendor); | ||
1276 | 326 | if (vendor_list == NULL) | ||
1277 | 327 | return; | ||
1278 | 328 | |||
1279 | 329 | const gchar* model_id = NULL; | ||
1280 | 330 | model_id = g_udev_device_get_property (device, "MODEL"); | ||
1281 | 331 | |||
1282 | 332 | if (model_id == NULL) | ||
1283 | 333 | return; | ||
1284 | 334 | |||
1285 | 335 | GList* model_entry = NULL; | ||
1286 | 336 | model_entry = g_list_find_custom (vendor_list, | ||
1287 | 337 | model_id, | ||
1288 | 338 | (GCompareFunc)g_strcmp0); | ||
1289 | 339 | |||
1290 | 340 | if (model_entry != NULL){ | ||
1291 | 341 | if (action == REMOVE){ | ||
1292 | 342 | if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) == NULL){ | ||
1293 | 343 | g_warning ("Got an REMOVE event on a scanner device but we dont have that device in our scanners cache"); | ||
1294 | 344 | } | ||
1295 | 345 | else{ | ||
1296 | 346 | g_hash_table_remove (self->scanners_present, vendor); | ||
1297 | 347 | } | ||
1298 | 348 | } | ||
1299 | 349 | else{ | ||
1300 | 350 | if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) != NULL){ | ||
1301 | 351 | g_warning ("Got an ADD event on a scanner device but we already have that device in our scanners cache"); | ||
1302 | 352 | } | ||
1303 | 353 | else{ | ||
1304 | 354 | g_hash_table_insert (self->scanners_present, | ||
1305 | 355 | g_strdup(vendor), | ||
1306 | 356 | g_strdup(model_id)); | ||
1307 | 357 | } | ||
1308 | 358 | } | ||
1309 | 359 | udev_mgr_update_menuitems (self); | ||
1310 | 360 | } | ||
1311 | 361 | } | ||
1312 | 362 | |||
1313 | 363 | static void | ||
1314 | 364 | udev_mgr_check_if_usb_device_is_supported (UdevMgr* self, | ||
1315 | 365 | GUdevDevice *device, | ||
1316 | 366 | UdevMgrDeviceAction action) | ||
1317 | 367 | { | ||
1318 | 368 | const gchar* vendor = NULL; | ||
1319 | 369 | debug_device (self, device, action); | ||
1320 | 370 | |||
1321 | 371 | vendor = g_udev_device_get_property (device, "ID_VENDOR_ID"); | ||
1322 | 372 | |||
1323 | 373 | if (vendor == NULL) | ||
1324 | 374 | return; | ||
1325 | 375 | |||
1326 | 376 | //g_debug ("vendor = %s", vendor); | ||
1327 | 377 | |||
1328 | 378 | GList* vendor_list = NULL; | ||
1329 | 379 | vendor_list = g_hash_table_lookup (self->supported_usb_scanners, | ||
1330 | 380 | (gpointer)vendor); | ||
1331 | 381 | if (vendor_list == NULL) | ||
1332 | 382 | return; | ||
1333 | 383 | |||
1334 | 384 | const gchar* model_id = NULL; | ||
1335 | 385 | model_id = g_udev_device_get_property (device, "ID_MODEL_ID"); | ||
1336 | 386 | |||
1337 | 387 | if (model_id == NULL) | ||
1338 | 388 | return; | ||
1339 | 389 | |||
1340 | 390 | GList* model_entry = NULL; | ||
1341 | 391 | model_entry = g_list_find_custom(vendor_list, model_id, (GCompareFunc)g_strcmp0); | ||
1342 | 392 | |||
1343 | 393 | if (model_entry != NULL){ | ||
1344 | 394 | if (action == REMOVE){ | ||
1345 | 395 | if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) == NULL){ | ||
1346 | 396 | g_warning ("Got an REMOVE event on a scanner device but we dont have that device in our scanners cache"); | ||
1347 | 397 | } | ||
1348 | 398 | else{ | ||
1349 | 399 | g_hash_table_remove (self->scanners_present, vendor); | ||
1350 | 400 | } | ||
1351 | 401 | } | ||
1352 | 402 | else{ | ||
1353 | 403 | if (g_hash_table_lookup (self->scanners_present, g_strdup(vendor)) != NULL){ | ||
1354 | 404 | g_warning ("Got an ADD event on a scanner device but we already have that device in our scanners cache"); | ||
1355 | 405 | } | ||
1356 | 406 | else{ | ||
1357 | 407 | g_hash_table_insert (self->scanners_present, | ||
1358 | 408 | g_strdup(vendor), | ||
1359 | 409 | g_strdup(model_id)); | ||
1360 | 410 | } | ||
1361 | 411 | } | ||
1362 | 412 | udev_mgr_update_menuitems (self); | ||
1363 | 413 | } | ||
1364 | 414 | } | ||
1365 | 415 | |||
1366 | 416 | UdevMgr* udev_mgr_new (DbusmenuMenuitem* scanner, | ||
1367 | 417 | DbusmenuMenuitem* webcam) | ||
1368 | 418 | { | ||
1369 | 419 | UdevMgr* mgr = g_object_new (UDEV_TYPE_MGR, NULL); | ||
1370 | 420 | mgr->scanner_item = scanner; | ||
1371 | 421 | mgr->webcam_item = webcam; | ||
1372 | 422 | |||
1373 | 423 | // Check for USB devices | ||
1374 | 424 | GList* usb_devices_available = NULL; | ||
1375 | 425 | usb_devices_available = g_udev_client_query_by_subsystem (mgr->client, | ||
1376 | 426 | usb_subsystem); | ||
1377 | 427 | if (usb_devices_available != NULL){ | ||
1378 | 428 | g_list_foreach (usb_devices_available, | ||
1379 | 429 | udevice_mgr_device_list_iterator, | ||
1380 | 430 | mgr); | ||
1381 | 431 | |||
1382 | 432 | g_list_free (usb_devices_available); | ||
1383 | 433 | } | ||
1384 | 434 | // Check for webcams | ||
1385 | 435 | GList* video_devices_available = NULL; | ||
1386 | 436 | video_devices_available = g_udev_client_query_by_subsystem (mgr->client, | ||
1387 | 437 | video4linux_subsystem); | ||
1388 | 438 | if (video_devices_available != NULL){ | ||
1389 | 439 | g_list_foreach (video_devices_available, | ||
1390 | 440 | udevice_mgr_device_list_iterator, | ||
1391 | 441 | mgr); | ||
1392 | 442 | |||
1393 | 443 | g_list_free (video_devices_available); | ||
1394 | 444 | } | ||
1395 | 445 | // Check for SCSI devices | ||
1396 | 446 | GList* scsi_devices_available = NULL; | ||
1397 | 447 | scsi_devices_available = g_udev_client_query_by_subsystem (mgr->client, | ||
1398 | 448 | scsi_subsystem); | ||
1399 | 449 | if (scsi_devices_available != NULL){ | ||
1400 | 450 | g_list_foreach (scsi_devices_available, | ||
1401 | 451 | udevice_mgr_device_list_iterator, | ||
1402 | 452 | mgr); | ||
1403 | 453 | g_list_free (scsi_devices_available); | ||
1404 | 454 | } | ||
1405 | 455 | return mgr; | ||
1406 | 456 | } | ||
1407 | 47 | 457 | ||
1408 | === modified file 'src/udev-mgr.h' | |||
1409 | --- src/udev-mgr.h 2011-07-19 12:18:54 +0000 | |||
1410 | +++ src/udev-mgr.h 2011-08-09 11:36:39 +0000 | |||
1411 | @@ -21,6 +21,14 @@ | |||
1412 | 21 | #define _UDEV_MGR_H_ | 21 | #define _UDEV_MGR_H_ |
1413 | 22 | 22 | ||
1414 | 23 | #include <glib-object.h> | 23 | #include <glib-object.h> |
1415 | 24 | #include <libdbusmenu-glib/client.h> | ||
1416 | 25 | |||
1417 | 26 | #include <gtk/gtk.h> | ||
1418 | 27 | #if GTK_CHECK_VERSION(3, 0, 0) | ||
1419 | 28 | #include <libdbusmenu-gtk3/menuitem.h> | ||
1420 | 29 | #else | ||
1421 | 30 | #include <libdbusmenu-gtk/menuitem.h> | ||
1422 | 31 | #endif | ||
1423 | 24 | 32 | ||
1424 | 25 | G_BEGIN_DECLS | 33 | G_BEGIN_DECLS |
1425 | 26 | 34 | ||
1426 | @@ -39,12 +47,15 @@ | |||
1427 | 39 | GObjectClass parent_class; | 47 | GObjectClass parent_class; |
1428 | 40 | }; | 48 | }; |
1429 | 41 | 49 | ||
1430 | 42 | struct _UdevMgr | ||
1431 | 43 | { | ||
1432 | 44 | GObject parent_instance; | ||
1433 | 45 | }; | ||
1434 | 46 | 50 | ||
1435 | 47 | GType udev_mgr_get_type (void) G_GNUC_CONST; | 51 | GType udev_mgr_get_type (void) G_GNUC_CONST; |
1436 | 52 | UdevMgr* udev_mgr_new (DbusmenuMenuitem* scanner_item, | ||
1437 | 53 | DbusmenuMenuitem* webcam_item); | ||
1438 | 54 | |||
1439 | 55 | typedef enum { | ||
1440 | 56 | ADD, | ||
1441 | 57 | REMOVE | ||
1442 | 58 | }UdevMgrDeviceAction; | ||
1443 | 48 | 59 | ||
1444 | 49 | G_END_DECLS | 60 | G_END_DECLS |
1445 | 50 | 61 | ||
1446 | 51 | 62 | ||
1447 | === modified file 'src/user-menu-mgr.c' | |||
1448 | --- src/user-menu-mgr.c 2011-07-18 11:19:38 +0000 | |||
1449 | +++ src/user-menu-mgr.c 2011-08-09 11:36:39 +0000 | |||
1450 | @@ -149,10 +149,9 @@ | |||
1451 | 149 | 149 | ||
1452 | 150 | for (u = users; u != NULL; u = g_list_next (u)) { | 150 | for (u = users; u != NULL; u = g_list_next (u)) { |
1453 | 151 | user = u->data; | 151 | user = u->data; |
1454 | 152 | g_debug ("%p: %s", user, user->real_name); | ||
1455 | 152 | user->service = self->users_dbus_interface; | 153 | user->service = self->users_dbus_interface; |
1456 | 153 | 154 | ||
1457 | 154 | g_debug ("%i %s", (gint)user->uid, user->user_name); | ||
1458 | 155 | |||
1459 | 156 | if (g_strcmp0(user->user_name, "guest") == 0) { | 155 | if (g_strcmp0(user->user_name, "guest") == 0) { |
1460 | 157 | /* Check to see if the guest has sessions and so therefore should | 156 | /* Check to see if the guest has sessions and so therefore should |
1461 | 158 | get a check mark. */ | 157 | get a check mark. */ |
1462 | @@ -171,13 +170,26 @@ | |||
1463 | 171 | 170 | ||
1464 | 172 | if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) { | 171 | if (self->user_count > MINIMUM_USERS && self->user_count < MAXIMUM_USERS) { |
1465 | 173 | mi = dbusmenu_menuitem_new (); | 172 | mi = dbusmenu_menuitem_new (); |
1467 | 174 | dbusmenu_menuitem_property_set (mi, DBUSMENU_MENUITEM_PROP_TYPE, USER_ITEM_TYPE); | 173 | dbusmenu_menuitem_property_set (mi, |
1468 | 174 | DBUSMENU_MENUITEM_PROP_TYPE, | ||
1469 | 175 | USER_ITEM_TYPE); | ||
1470 | 175 | if (user->real_name_conflict) { | 176 | if (user->real_name_conflict) { |
1471 | 176 | gchar * conflictedname = g_strdup_printf("%s (%s)", user->real_name, user->user_name); | 177 | gchar * conflictedname = g_strdup_printf("%s (%s)", user->real_name, user->user_name); |
1472 | 177 | dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, conflictedname); | 178 | dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, conflictedname); |
1473 | 178 | g_free(conflictedname); | 179 | g_free(conflictedname); |
1474 | 179 | } else { | 180 | } else { |
1476 | 180 | dbusmenu_menuitem_property_set (mi, USER_ITEM_PROP_NAME, user->real_name); | 181 | //g_debug ("%i %s", (gint)user->uid, user->real_name); |
1477 | 182 | //g_debug ("users uid = %i", (gint)user->uid); | ||
1478 | 183 | //g_debug ("users real name = %s", user->real_name); | ||
1479 | 184 | if (user == NULL){ | ||
1480 | 185 | g_debug ("USER pointer is NULL"); | ||
1481 | 186 | return; | ||
1482 | 187 | } | ||
1483 | 188 | g_debug ("%p: %s", user, user->real_name); | ||
1484 | 189 | |||
1485 | 190 | dbusmenu_menuitem_property_set (mi, | ||
1486 | 191 | USER_ITEM_PROP_NAME, | ||
1487 | 192 | user->real_name); | ||
1488 | 181 | } | 193 | } |
1489 | 182 | dbusmenu_menuitem_property_set_bool (mi, | 194 | dbusmenu_menuitem_property_set_bool (mi, |
1490 | 183 | USER_ITEM_PROP_LOGGED_IN, | 195 | USER_ITEM_PROP_LOGGED_IN, |
- Your leaking all the contents of the lists you add to the hash tables as g_list_free isn't going to do anything to the data the list points too. I think you need to initially do something like iterate the hash table, which then calls g_list_foreach on every value with g_free.
- gchar* random_scanner_name = g_strdup_ printf( "%p--scanner" , self); table_insert (self-> scanners_ present,
g_strdup( random_ scanner_ name),
g_strdup( "Scanner" )); scanner_ name);
g_hash_
g_free (random_
just don't free random_scanner_name and send it in without g_strdup?
Apart from that, nothing jumps out at me. However, I can't mark as approved as it crashes every time on my system with the same backtrace as we spoke about (when trying to register the DBus Service). I tried lp:indicator-session and it runs fine, so it's definitely something in this branch :/
I'll have another look at the diff tomorrow morning, but if your around it would be good to maybe go through on Mumble or something to see if there's something we've missed?