Chameleon

Chameleon Svn Source Tree

Root/branches/cparm/i386/modules/USBFix/USBFix.c

1/*
2 * Copyright (c) 2009 Evan Lojewski. All rights reserved.
3 *
4 */
5
6#include "libsaio.h"
7#include "modules.h"
8#include "pci.h"
9#include "bootstruct.h"
10
11#define kEnableUSBMod"EnableUSBModule"
12extern int usb_loop();
13
14void notify_usb_dev(pci_dt_t *pci_dev);
15
16void USBFix_pci_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)
17{
18pci_dt_t* current = arg1;
19if(current->class_id == PCI_CLASS_SERIAL_USB)
20{
21notify_usb_dev(current);
22}
23}
24
25void USBFix_start_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)
26{
27usb_loop();
28}
29
30void USBFix_start()
31{
32bool enable = true;
33getBoolForKey(kEnableUSBMod, &enable, &bootInfo->bootConfig) ;
34
35if (enable) {
36register_hook_callback("PCIDevice", &USBFix_pci_hook);
37register_hook_callback("Kernel Start", &USBFix_start_hook);
38}
39
40
41}
42
43

Archive Download this file

Revision: 1119