No longer places function number in subclass box.
[tangerine.git] / arch / common / hidd.pci / pcitool / main.c
blobbb39a8d4c727299edd1d0a0f8b9189476b14e510
1 /*
2 Copyright © 2003-2009, The AROS Development Team.
3 $Id$
4 */
6 #include <exec/types.h>
7 #include <exec/memory.h>
8 #include <libraries/mui.h>
9 #include <hidd/hidd.h>
10 #include <hidd/pci.h>
11 #include <utility/tagitem.h>
12 #include <utility/hooks.h>
14 #include <proto/exec.h>
15 #include <proto/muimaster.h>
16 #include <proto/oop.h>
17 #include <proto/utility.h>
18 #include <proto/intuition.h>
19 #include "pciids.h"
21 #include <aros/debug.h>
23 #include <stdio.h>
24 #include <stdlib.h>
25 #include "locale.h"
26 #include "support.h"
28 #define APPNAME "PCITool"
29 #define VERSION "PCITool 0.2 (20.4.2009)"
31 static const char version[] = "$VER: " VERSION "\n";
33 struct Library *OOPBase = NULL;
34 struct Library *MUIMasterBase = NULL;
35 struct UtilityBase *UtilityBase = NULL;
37 OOP_AttrBase __IHidd_PCIDev;
38 OOP_AttrBase __IHidd_PCIDrv;
39 OOP_AttrBase HiddAttrBase;
41 OOP_Object *pci;
43 int openLibs()
45 if ((OOPBase=OpenLibrary("oop.library", 0)) != NULL)
47 __IHidd_PCIDev = OOP_ObtainAttrBase(IID_Hidd_PCIDevice);
48 __IHidd_PCIDrv = OOP_ObtainAttrBase(IID_Hidd_PCIDriver);
49 HiddAttrBase = OOP_ObtainAttrBase(IID_Hidd);
51 if ((MUIMasterBase=OpenLibrary("muimaster.library", 0)) != NULL)
53 if ((UtilityBase=(struct UtilityBase*)OpenLibrary("utility.library", 0)) != NULL)
55 pciids_Open();
56 return 1;
60 return 0;
63 void closeLibs()
65 pciids_Close();
67 if (pci)
68 OOP_DisposeObject(pci);
70 OOP_ReleaseAttrBase(IID_Hidd_PCIDevice);
71 OOP_ReleaseAttrBase(IID_Hidd_PCIDriver);
72 OOP_ReleaseAttrBase(IID_Hidd);
74 if (OOPBase != NULL)
75 CloseLibrary(OOPBase);
77 if (UtilityBase != NULL)
78 CloseLibrary((struct Library *)UtilityBase);
80 if (MUIMasterBase != NULL)
81 CloseLibrary(MUIMasterBase);
83 MUIMasterBase = NULL;
84 UtilityBase = NULL;
85 OOPBase = NULL;
88 void cleanup(CONST_STRPTR message)
90 Locale_Deinitialize();
92 if (message != NULL)
94 ShowError(NULL, NULL, message, TRUE);
95 exit(RETURN_FAIL);
97 else
99 exit(RETURN_OK);
103 Object *MakeLabel(STRPTR str)
105 return (MUI_MakeObject(MUIO_Label, str, 0));
108 LONG xget(Object * obj, ULONG attr)
110 LONG x = 0;
111 get(obj, attr, &x);
112 return x;
115 Object *app;
116 Object *MainWindow;
117 Object *DriverList;
118 Object *StrDriverName, *StrDriverHWName, *StrDriverDirect;
120 Object *StrDescription, *VendorID, *ProductID, *RevisionID;
121 Object *VendorName, *ProductName, *SubsystemName;
122 Object *Interface, *_Class, *SubClass, *IRQLine;
123 Object *ROMBase, *ROMSize;
124 Object *RangeList;
125 Object *Status;
127 struct Hook pci_hook;
128 struct Hook display_hook;
129 struct Hook select_hook;
131 AROS_UFH3(void, pci_callback,
132 AROS_UFHA(struct Hook *, hook, A0),
133 AROS_UFHA(OOP_Object *, obj, A2),
134 AROS_UFHA(APTR, msg, A1))
136 AROS_USERFUNC_INIT
138 DoMethod(DriverList, MUIM_List_InsertSingle, (IPTR)obj, MUIV_List_Insert_Bottom);
140 AROS_USERFUNC_EXIT
143 AROS_UFH3(void, display_function,
144 AROS_UFHA(struct Hook *, h, A0),
145 AROS_UFHA(char **, strings, A2),
146 AROS_UFHA(OOP_Object *, obj, A1))
148 AROS_USERFUNC_INIT
150 static char buf[20];
151 IPTR bus, dev, sub;
153 if (obj)
155 OOP_GetAttr(obj, aHidd_PCIDevice_Bus, (APTR)&bus);
156 OOP_GetAttr(obj, aHidd_PCIDevice_Dev, (APTR)&dev);
157 OOP_GetAttr(obj, aHidd_PCIDevice_Sub, (APTR)&sub);
159 snprintf(buf, 19, "%02x.%02x.%01x", bus, dev, sub);
160 strings[0] = buf;
163 AROS_USERFUNC_EXIT
166 void memoryPrint(STRPTR buffer, unsigned int bar, unsigned int base, unsigned int size, unsigned int type)
168 if(type & ADDRF_IO)
170 snprintf(buffer, 59, "Bar%d: %s%s at 0x%04x (size 0x%04x)", bar,
171 (type & ADDRF_PREFETCH) ? "Prefetchable " :"",
172 (type & ADDRF_IO)?"I/O":"Memory",
173 base, size);
175 else
177 snprintf(buffer, 59, "Bar%d: %s%s at 0x%08x (size 0x%08x)", bar,
178 (type & ADDRF_PREFETCH) ? "Prefetchable " :"",
179 (type & ADDRF_IO)?"I/O":"Memory",
180 base, size);
184 AROS_UFH3(void, select_function,
185 AROS_UFHA(struct Hook *, h, A0),
186 AROS_UFHA(Object *, object, A2),
187 AROS_UFHA(APTR, msg, A1))
189 AROS_USERFUNC_INIT
191 ULONG active;
192 OOP_Object *obj, *drv;
193 STRPTR class, subclass, interface, str;
194 UWORD vendor, product, subvendor, subdevice;
196 active = xget(object, MUIA_List_Active);
197 if (active != MUIV_List_Active_Off)
199 IPTR val, val2, val3;
200 static char buf[80];
202 static char ranges[6][60];
203 DoMethod(object, MUIM_List_GetEntry, active, (IPTR)&obj);
205 OOP_GetAttr(obj, aHidd_PCIDevice_Driver, (APTR)&drv);
206 OOP_GetAttr(drv, aHidd_Name, (APTR)&str);
207 set(StrDriverName, MUIA_Text_Contents, str);
208 OOP_GetAttr(drv, aHidd_HardwareName, (APTR)&str);
209 set(StrDriverHWName, MUIA_Text_Contents, str);
210 OOP_GetAttr(drv, aHidd_PCIDriver_DirectBus, (APTR)&val);
211 set(StrDriverDirect, MUIA_Text_Contents, (IPTR)((val)?_(MSG_YES):_(MSG_NO)));
213 OOP_GetAttr(obj, aHidd_PCIDevice_ClassDesc, (APTR)&class);
214 OOP_GetAttr(obj, aHidd_PCIDevice_SubClassDesc, (APTR)&subclass);
215 OOP_GetAttr(obj, aHidd_PCIDevice_InterfaceDesc, (APTR)&interface);
216 snprintf(buf, 79, "%s %s %s", class, subclass, interface);
217 set(StrDescription, MUIA_Text_Contents, buf);
219 OOP_GetAttr(obj, aHidd_PCIDevice_VendorID, (APTR)&val);
220 snprintf(buf, 79, "0x%04x", val);
221 set(VendorID, MUIA_Text_Contents, buf);
222 set(VendorName, MUIA_Text_Contents, pciids_GetVendorName(val, buf, 79));
223 vendor = val;
225 OOP_GetAttr(obj, aHidd_PCIDevice_ProductID, (APTR)&val);
226 snprintf(buf, 79, "0x%04x", val);
227 set(ProductID, MUIA_Text_Contents, buf);
228 set(ProductName, MUIA_Text_Contents,
229 pciids_GetDeviceName(vendor, val, buf, 79));
230 product = val;
232 OOP_GetAttr(obj, aHidd_PCIDevice_SubsystemVendorID, (APTR)&val);
233 subvendor = val;
234 OOP_GetAttr(obj, aHidd_PCIDevice_SubsystemID, (APTR)&val);
235 subdevice = val;
236 set(SubsystemName, MUIA_Text_Contents,
237 pciids_GetSubDeviceName(vendor, product, subvendor, subdevice,
238 buf, 79));
240 OOP_GetAttr(obj, aHidd_PCIDevice_RevisionID, (APTR)&val);
241 snprintf(buf, 79, "0x%04x", val);
242 set(RevisionID, MUIA_Text_Contents, buf);
244 OOP_GetAttr(obj, aHidd_PCIDevice_Interface, (APTR)&val);
245 snprintf(buf, 79, "0x%02x", val);
246 set(Interface, MUIA_Text_Contents, buf);
248 OOP_GetAttr(obj, aHidd_PCIDevice_Class, (APTR)&val);
249 snprintf(buf, 79, "0x%02x", val);
250 set(_Class, MUIA_Text_Contents, buf);
252 OOP_GetAttr(obj, aHidd_PCIDevice_SubClass, (APTR)&val);
253 snprintf(buf, 79, "0x%02x", val);
254 set(SubClass, MUIA_Text_Contents, buf);
256 OOP_GetAttr(obj, aHidd_PCIDevice_IRQLine, (APTR)&val);
257 OOP_GetAttr(obj, aHidd_PCIDevice_INTLine, (APTR)&val2);
258 if (val)
260 snprintf(buf, 79, "%d (%c)", val2, val + 'A' - 1);
262 else snprintf(buf, 79, _(MSG_NA));
263 set(IRQLine, MUIA_Text_Contents, buf);
265 OOP_GetAttr(obj, aHidd_PCIDevice_RomBase, (APTR)&val);
266 OOP_GetAttr(obj, aHidd_PCIDevice_RomSize, (APTR)&val2);
267 snprintf(buf, 79, "0x%08x", val2);
268 if (val2)
270 set(ROMSize, MUIA_Text_Contents, buf);
271 if (val)
273 snprintf(buf, 79, "0x%08x", val);
274 set(ROMBase, MUIA_Text_Contents, buf);
276 else set(ROMBase, MUIA_Text_Contents, _(MSG_UNUSED));
278 else
280 set(ROMBase, MUIA_Text_Contents, _(MSG_NA));
281 set(ROMSize, MUIA_Text_Contents, _(MSG_NA));
284 DoMethod(RangeList, MUIM_List_Clear);
286 OOP_GetAttr(obj, aHidd_PCIDevice_Base0, (APTR)&val);
287 OOP_GetAttr(obj, aHidd_PCIDevice_Size0, (APTR)&val2);
288 OOP_GetAttr(obj, aHidd_PCIDevice_Type0, (APTR)&val3);
290 if (val)
292 memoryPrint(ranges[0], 0, val, val2, val3);
293 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[0], MUIV_List_Insert_Bottom);
296 OOP_GetAttr(obj, aHidd_PCIDevice_Base1, (APTR)&val);
297 OOP_GetAttr(obj, aHidd_PCIDevice_Size1, (APTR)&val2);
298 OOP_GetAttr(obj, aHidd_PCIDevice_Type1, (APTR)&val3);
300 if (val)
302 memoryPrint(ranges[1], 1, val, val2, val3);
303 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[1], MUIV_List_Insert_Bottom);
306 OOP_GetAttr(obj, aHidd_PCIDevice_isBridge, (APTR)&val);
307 if (!val)
310 OOP_GetAttr(obj, aHidd_PCIDevice_Base2, (APTR)&val);
311 OOP_GetAttr(obj, aHidd_PCIDevice_Size2, (APTR)&val2);
312 OOP_GetAttr(obj, aHidd_PCIDevice_Type2, (APTR)&val3);
314 if (val)
316 memoryPrint(ranges[2], 2, val, val2, val3);
317 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[2], MUIV_List_Insert_Bottom);
320 OOP_GetAttr(obj, aHidd_PCIDevice_Base3, (APTR)&val);
321 OOP_GetAttr(obj, aHidd_PCIDevice_Size3, (APTR)&val2);
322 OOP_GetAttr(obj, aHidd_PCIDevice_Type3, (APTR)&val3);
324 if (val)
326 memoryPrint(ranges[3], 3, val, val2, val3);
327 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[3], MUIV_List_Insert_Bottom);
330 OOP_GetAttr(obj, aHidd_PCIDevice_Base4, (APTR)&val);
331 OOP_GetAttr(obj, aHidd_PCIDevice_Size4, (APTR)&val2);
332 OOP_GetAttr(obj, aHidd_PCIDevice_Type4, (APTR)&val3);
334 if (val)
336 memoryPrint(ranges[4], 4, val, val2, val3);
337 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[4], MUIV_List_Insert_Bottom);
340 OOP_GetAttr(obj, aHidd_PCIDevice_Base5, (APTR)&val);
341 OOP_GetAttr(obj, aHidd_PCIDevice_Size5, (APTR)&val2);
342 OOP_GetAttr(obj, aHidd_PCIDevice_Type5, (APTR)&val3);
344 if (val)
346 memoryPrint(ranges[5], 5, val, val2, val3);
347 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[5], MUIV_List_Insert_Bottom);
350 else
352 OOP_GetAttr(obj, aHidd_PCIDevice_SubBus, (APTR)&val);
353 OOP_GetAttr(obj, aHidd_PCIDevice_ISAEnable, (APTR)&val2);
354 OOP_GetAttr(obj, aHidd_PCIDevice_VGAEnable, (APTR)&val3);
356 snprintf(ranges[2], 59, _(MSG_BRIDGE),
357 val, (val2) ? (CONST_STRPTR)" " : _(MSG_NOT),
358 (val3) ? (CONST_STRPTR)" " : _(MSG_NOT));
359 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[2], MUIV_List_Insert_Bottom);
361 OOP_GetAttr(obj, aHidd_PCIDevice_MemoryBase, (APTR)&val);
362 OOP_GetAttr(obj, aHidd_PCIDevice_MemoryLimit, (APTR)&val2);
364 snprintf(ranges[3], 59, _(MSG_MEMORY_RANGE),
365 val, val2);
366 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[3], MUIV_List_Insert_Bottom);
368 OOP_GetAttr(obj, aHidd_PCIDevice_PrefetchableBase, (APTR)&val);
369 OOP_GetAttr(obj, aHidd_PCIDevice_PrefetchableLimit, (APTR)&val2);
371 snprintf(ranges[4], 59, _(MSG_PREFETCHABLE_MEMORY),
372 val, val2);
373 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[4], MUIV_List_Insert_Bottom);
375 OOP_GetAttr(obj, aHidd_PCIDevice_IOBase, (APTR)&val);
376 OOP_GetAttr(obj, aHidd_PCIDevice_IOLimit, (APTR)&val2);
378 snprintf(ranges[5], 59, _(MSG_IO_RANGE),
379 val, val2);
380 DoMethod(RangeList, MUIM_List_InsertSingle, (IPTR)ranges[5], MUIV_List_Insert_Bottom);
384 IPTR io, mem, master, snoop, is66;
385 OOP_GetAttr(obj, aHidd_PCIDevice_isIO, (APTR)&io);
386 OOP_GetAttr(obj, aHidd_PCIDevice_isMEM, (APTR)&mem);
387 OOP_GetAttr(obj, aHidd_PCIDevice_isMaster, (APTR)&master);
388 OOP_GetAttr(obj, aHidd_PCIDevice_paletteSnoop, (APTR)&snoop);
389 OOP_GetAttr(obj, aHidd_PCIDevice_is66MHz, (APTR)&is66);
391 snprintf(buf, 79, _(MSG_IO_MSG),
392 io ? _(MSG_YES):_(MSG_NO),
393 mem ? _(MSG_YES):_(MSG_NO),
394 master ? _(MSG_YES):_(MSG_NO),
395 snoop ? _(MSG_YES):_(MSG_NO),
396 is66 ? _(MSG_YES):_(MSG_NO));
397 set(Status, MUIA_Text_Contents, buf);
401 AROS_USERFUNC_EXIT
404 BOOL GUIinit()
406 BOOL retval = FALSE;
408 app = ApplicationObject,
409 MUIA_Application_Title, (IPTR)APPNAME,
410 MUIA_Application_Version, (IPTR)VERSION,
411 MUIA_Application_Copyright, (IPTR)"© 2004, The AROS Development Team",
412 MUIA_Application_Author, (IPTR)"Michal Schulz",
413 MUIA_Application_Base, (IPTR)APPNAME,
414 MUIA_Application_Description, __(MSG_DESCRIPTION),
416 SubWindow, MainWindow = WindowObject,
417 MUIA_Window_Title, __(MSG_WINTITLE),
418 // MUIA_Window_Height, MUIV_Window_Height_Visible(50),
419 // MUIA_Window_Width, MUIV_Window_Width_Visible(60),
421 WindowContents, HGroup,
422 MUIA_Group_SameWidth, FALSE,
424 Child, ListviewObject,
425 MUIA_Listview_List, DriverList = ListObject,
426 ReadListFrame,
427 MUIA_List_AdjustWidth, TRUE,
428 MUIA_List_DisplayHook, &display_hook,
429 End, // List
430 End, // ListView
431 Child, VGroup,
432 Child, VGroup, GroupFrameT(_(MSG_DRIVER_INFO)),
433 Child, ColGroup(2),
434 Child, Label(_(MSG_DRIVER_NAME)),
435 Child, HGroup,
436 Child, StrDriverName = TextObject,
437 TextFrame,
438 MUIA_Background, MUII_TextBack,
439 MUIA_Text_SetMax, FALSE,
440 MUIA_Text_Contents, "",
441 End,
442 Child, Label(_(MSG_DIRECT_BUS)),
443 Child, StrDriverDirect = TextObject,
444 TextFrame,
445 MUIA_Background, MUII_TextBack,
446 MUIA_Text_SetMax, FALSE,
447 MUIA_Text_Contents, "",
448 End,
449 End,
450 Child, Label(_(MSG_HARDWARE_INFO)),
451 Child, StrDriverHWName = TextObject,
452 TextFrame,
453 MUIA_Background, MUII_TextBack,
454 MUIA_Text_SetMax, FALSE,
455 MUIA_Text_Contents, "",
456 End,
457 End,
458 End, // HGroup
459 Child, VGroup, GroupFrameT(_(MSG_PCI_DEVICE_INFO)),
460 Child, ColGroup(2),
461 Child, Label(_(MSG_DEVICE_DESCRIPTION)),
462 Child, StrDescription = TextObject,
463 TextFrame,
464 MUIA_Background, MUII_TextBack,
465 MUIA_Text_SetMax, FALSE,
466 MUIA_Text_Contents, "",
467 End,
468 Child, Label(_(MSG_VENDORNAME)),
469 Child, VendorName = TextObject,
470 TextFrame,
471 MUIA_Background, MUII_TextBack,
472 MUIA_Text_SetMax, FALSE,
473 MUIA_Text_Contents, "",
474 End,
475 Child, Label(_(MSG_PRODUCTNAME)),
476 Child, ProductName = TextObject,
477 TextFrame,
478 MUIA_Background, MUII_TextBack,
479 MUIA_Text_SetMax, FALSE,
480 MUIA_Text_Contents, "",
481 End,
482 Child, Label(_(MSG_SUBSYSTEM)),
483 Child, SubsystemName = TextObject,
484 TextFrame,
485 MUIA_Background, MUII_TextBack,
486 MUIA_Text_SetMax, FALSE,
487 MUIA_Text_Contents, "",
488 End,
489 End,
490 Child, HGroup,
491 Child, ColGroup(2),
492 Child, Label(_(MSG_VENDORID)),
493 Child, VendorID = TextObject,
494 TextFrame,
495 MUIA_Background, MUII_TextBack,
496 MUIA_Text_SetMax, FALSE,
497 MUIA_Text_Contents, "0x0000",
498 End,
499 End,
500 Child, ColGroup(2),
501 Child, Label(_(MSG_PRODUCTID)),
502 Child, ProductID = TextObject,
503 TextFrame,
504 MUIA_Background, MUII_TextBack,
505 MUIA_Text_SetMax, FALSE,
506 MUIA_Text_Contents, "0x0000",
507 End,
508 End,
509 Child, ColGroup(2),
510 Child, Label(_(MSG_REVISIONID)),
511 Child, RevisionID = TextObject,
512 TextFrame,
513 MUIA_Background, MUII_TextBack,
514 MUIA_Text_SetMax, FALSE,
515 MUIA_Text_Contents, "0x0000",
516 End,
517 End,
518 End,
519 Child, HGroup,
520 Child, ColGroup(2),
521 MUIA_Weight, 0,
522 Child, Label(_(MSG_INTERFACE)),
523 Child, Interface = TextObject,
524 TextFrame,
525 MUIA_Background, MUII_TextBack,
526 MUIA_Text_SetMax, FALSE,
527 MUIA_Text_Contents, "0x00",
528 End,
529 End,
530 Child, ColGroup(2),
531 MUIA_Weight, 0,
532 Child, Label(_(MSG_CLASS)),
533 Child, _Class = TextObject,
534 TextFrame,
535 MUIA_Background, MUII_TextBack,
536 MUIA_Text_SetMax, FALSE,
537 MUIA_Text_Contents, "0x00",
538 End,
539 End,
540 Child, ColGroup(2),
541 MUIA_Weight, 0,
542 Child, Label(_(MSG_SUBCLASS)),
543 Child, SubClass = TextObject,
544 TextFrame,
545 MUIA_Background, MUII_TextBack,
546 MUIA_Text_SetMax, FALSE,
547 MUIA_Text_Contents, "0x00",
548 End,
549 End,
550 Child, ColGroup(2),
551 Child, Label(_(MSG_IRQ)),
552 Child, IRQLine = TextObject,
553 TextFrame,
554 MUIA_Background, MUII_TextBack,
555 MUIA_Text_SetMax, FALSE,
556 MUIA_Text_Contents, "15",
557 End,
558 End,
559 End,
560 Child, HGroup,
561 Child, ColGroup(2),
562 MUIA_Weight, 0,
563 Child, Label(_(MSG_ROM_BASE)),
564 Child, ROMBase = TextObject,
565 TextFrame,
566 MUIA_Background, MUII_TextBack,
567 MUIA_Text_SetMax, FALSE,
568 MUIA_Text_Contents, "0x00000000",
569 End,
570 End,
571 Child, ColGroup(2),
572 MUIA_Weight, 0,
573 Child, Label(_(MSG_ROM_SIZE)),
574 Child, ROMSize = TextObject,
575 TextFrame,
576 MUIA_Background, MUII_TextBack,
577 MUIA_Text_SetMax, FALSE,
578 MUIA_Text_Contents, "0x00000000",
579 End,
580 End,
581 Child, HVSpace,
582 End,
583 Child, HGroup,
584 Child, RangeList = ListviewObject,
585 MUIA_Listview_List, ListObject,
586 ReadListFrame,
587 MUIA_List_AdjustWidth, FALSE,
588 End, // List
589 End, // ListView
590 End,
591 Child, Status = TextObject,
592 TextFrame,
593 MUIA_Background, MUII_TextBack,
594 MUIA_Text_SetMax, FALSE,
595 End,
596 End,
597 End,
598 End, // WindowContents
599 End, // MainWindow
600 End; // ApplicationObject
602 if (app)
604 /* Quit application if the windowclosegadget or the esc key is pressed. */
606 DoMethod(MainWindow, MUIM_Notify, MUIA_Window_CloseRequest, TRUE,
607 (IPTR)app, 2,
608 MUIM_Application_ReturnID, MUIV_Application_ReturnID_Quit);
610 DoMethod(DriverList, MUIM_Notify, MUIA_List_Active, MUIV_EveryTime,
611 (IPTR)DriverList, 2,
612 MUIM_CallHook, (IPTR)&select_hook);
613 retval=TRUE;
616 return retval;
619 void loop(void)
621 ULONG sigs = 0;
623 while((LONG) DoMethod(app, MUIM_Application_NewInput, (IPTR)&sigs) != MUIV_Application_ReturnID_Quit)
625 if (sigs)
627 sigs = Wait(sigs);
630 } /* loop(void)*/
633 int main(int argc, char *argv[])
635 pci_hook.h_Entry = (APTR)pci_callback;
636 display_hook.h_Entry = (APTR)display_function;
637 select_hook.h_Entry = (APTR)select_function;
639 if (!Locale_Initialize())
640 cleanup(_(MSG_ERROR_LOCALE));
642 if(openLibs())
644 if(GUIinit())
646 pci = OOP_NewObject(NULL, CLID_Hidd_PCI, NULL);
647 if (pci)
649 HIDD_PCI_EnumDevices(pci, &pci_hook, NULL);
652 set(MainWindow, MUIA_Window_Open, TRUE);
654 if(xget(MainWindow, MUIA_Window_Open))
656 loop();
659 set(MainWindow, MUIA_Window_Open, FALSE);
660 DisposeObject(app);
662 // deinit_gui();
665 closeLibs();
667 cleanup(NULL);
669 return 0;
670 } /* main(int argc, char *argv[]) */