Chameleon

Chameleon Svn Source Tree

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

1/*
2 * Copyright (c) 2011,2012 cparm <armelcadetpetit@gmail.com>. All rights reserved.
3 *
4 */
5
6#include "libsaio.h"
7#include "modules.h"
8#include "bootstruct.h"
9#include "pci.h"
10#include "device_inject.h"
11
12#ifndef DEBUG_SATA
13#define DEBUG_SATA 0
14#endif
15
16#if DEBUG_SATA
17#define DBG(x...) printf(x)
18#else
19#define DBG(x...)
20#endif
21
22void SATA_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6);
23
24uint8_t default_SATA_ID[]= {
250x81, 0x26, 0x00, 0x00
26};
27#define SATA_ID_LEN ( sizeof(default_SATA_ID) / sizeof(uint8_t) )
28
29void SATA_hook(void* arg1, void* arg2, void* arg3, void* arg4, void* arg5, void* arg6)
30{
31pci_dt_t* current = arg1;
32struct DevPropDevice*device;
33char*devicepath;
34if (current && current->class_id == PCI_CLASS_STORAGE_SATA)
35{
36devicepath = get_pci_dev_path(current);
37if (devicepath)
38{
39verbose("SATA device : [%04x:%04x :: %04x] :: %s\n",
40current->vendor_id, current->device_id,current->class_id,
41devicepath);
42
43if (!string)
44{
45string = devprop_create_string();
46}
47device = devprop_add_device(string, devicepath);
48
49devprop_add_value(device, "device-id", default_SATA_ID, SATA_ID_LEN);
50
51
52stringdata = malloc(sizeof(uint8_t) * string->length);
53memcpy(stringdata, (uint8_t*)devprop_generate_string(string), string->length);
54stringlength = string->length;
55
56}
57}
58
59}
60
61void YellowIconFixer_start(void);
62void YellowIconFixer_start(void)
63{
64 register_hook_callback("PCIDevice", &SATA_hook);
65}
66
67

Archive Download this file

Revision: 1931