Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 271331 Details for
Bug 402071
Clean up macio.c, add new devices.
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
replacement patch
kudzu-1.2.80-macio-update.patch (text/plain), 13.65 KB, created by
David Woodhouse
on 2007-11-28 13:50:38 UTC
(
hide
)
Description:
replacement patch
Filename:
MIME Type:
Creator:
David Woodhouse
Created:
2007-11-28 13:50:38 UTC
Size:
13.65 KB
patch
obsolete
>--- kudzu-1.2.80/macio.c~ 2007-08-03 20:55:56.000000000 +0100 >+++ kudzu-1.2.80/macio.c 2007-11-27 23:57:28.000000000 +0000 >@@ -40,7 +40,7 @@ static void macioWriteDevice( FILE *file > > static int macioCompareDevice(struct macioDevice *dev1, struct macioDevice *dev2) > { >- return compareDevice( (struct device *)dev1, (struct device *)dev2); >+ return compareDevice( (struct device *)dev1, (struct device *)dev2); > } > > struct macioDevice *macioNewDevice( struct macioDevice *old ) { >@@ -59,6 +59,44 @@ struct macioDevice *macioNewDevice( stru > > #ifdef __powerpc__ > #include "minifind.h" >+static int check_of_compatible(char *path, char **matches) >+{ >+ int i, fd; >+ size_t size; >+ char buf[256]; >+ char *str = buf; >+ >+ buf[255] = 0; >+ snprintf(buf, 255, "%s/compatible", path); >+ >+ fd = open(buf, O_RDONLY); >+ if (fd < 0) >+ return 0; >+ >+ size = read(fd, buf, 255); >+ if (size < 0) { >+ close(fd); >+ return 0; >+ } >+ close(fd); >+ >+ while (str < &buf[size]) { >+ for (i=0; matches[i]; i++) >+ if (!strcmp(matches[i], str)) >+ return i+1; >+ str += strlen(str) + 1; >+ } >+ return 0; >+} >+ >+static void free_find_results(struct findNode *list) >+{ >+ while (list->result) { >+ struct pathNode *tmp = list->result; >+ list->result = tmp->next; >+ free(tmp); >+ } >+} > > /* given a class to probe, returns an array macio devices found which match */ > /* all entries are malloc'd, so caller must free when done. Use */ >@@ -67,222 +105,213 @@ struct macioDevice *macioNewDevice( stru > > struct device *macioProbe( enum deviceClass probeClass, int probeFlags, > struct device *devlist) { >- // check for airport >- if (probeClass & CLASS_NETWORK) { >- struct macioDevice *airport; >- struct macioDevice *bmac; >+ >+ struct findNode list; > struct pathNode *n; >- int ret = 0; > >- struct findNode *list = (struct findNode *) malloc(sizeof(struct findNode)); >- list->result = (struct pathNode *) malloc(sizeof(struct pathNode)); >- list->result->path = NULL; >- list->result->next = list->result; >- >- minifind("/proc/device-tree", "radio", list); >- >- // Supported >- for (n = list->result->next; n != list->result; n = n->next) >- { >- if (n->path) >- ret = 1; >- } >+ memset(&list, 0, sizeof(list)); >+ >+ if (probeClass & CLASS_USB) { >+ struct macioDevice *ohci; > >- if (ret) >- { >- airport = macioNewDevice(NULL); >- airport->type = CLASS_NETWORK; >- airport->device = strdup("eth"); >- airport->desc = strdup("Apple Computer Inc.|Airport"); >- airport->driver = strdup("airport"); >- airport->next = devlist; >- devlist = (struct device *)airport; >+ minifind("/proc/device-tree", "usb", &list); >+ >+ // Supported >+ for (n = list.result; n; n = n->next) { >+ char *matches[] = {"ohci-le", "ohci-littleendian", "ohci-be", >+ "ohci-bigendian", "mpc5200-ohci", >+ "mpc5200-usb-ohci", NULL}; >+ >+ if (check_of_compatible(n->path, matches)) { >+ ohci = macioNewDevice(NULL); >+ ohci->type = CLASS_USB; >+ ohci->desc = strdup("OpenFirmware OHCI"); >+ ohci->driver = strdup("ohci-hcd"); >+ ohci->next = devlist; >+ devlist = (struct device *)ohci; >+ break; >+ } >+ } >+ free_find_results(&list); > } > >- ret = 0; >- minifind("/proc/device-tree", "ethernet", list); >+ // check for airport >+ if (probeClass & CLASS_NETWORK) { >+ struct macioDevice *netdev; >+ struct pathNode *n; >+ >+ minifind("/proc/device-tree", "radio", &list); >+ >+ // Supported >+ if (list.result) { >+ netdev = macioNewDevice(NULL); >+ netdev->type = CLASS_NETWORK; >+ netdev->device = strdup("eth"); >+ netdev->desc = strdup("Apple Computer Inc.|Airport"); >+ netdev->driver = strdup("airport"); >+ netdev->next = devlist; >+ devlist = (struct device *)netdev; >+ } >+ free_find_results(&list); > >- // Supported >- for (n = list->result->next; n != list->result; n = n->next) >- { >- int fd; >- char buf[256]; >+ minifind("/proc/device-tree", "ethernet", &list); > >- if (!n->path) >- continue; >+ // Supported >+ for (n = list.result; n; n = n->next) { >+ int ret; >+ char *matches[] = {"bmac", "bmac+", "mpc5200-fec", NULL}; >+ >+ ret = check_of_compatible(n->path, matches); >+ if (!ret) >+ continue; >+ >+ netdev = macioNewDevice(NULL); >+ netdev->type = CLASS_NETWORK; >+ netdev->device = strdup("eth"); >+ switch(ret) { >+ case 1: >+ case 2: >+ netdev->desc = strdup("Apple Computer Inc.|BMAC/BMAC+"); >+ netdev->driver = strdup("bmac"); >+ break; >+ case 3: >+ netdev->desc = strdup("Freescale|MPC5200 FEC"); >+ netdev->driver = strdup("fec_mpc52xx"); >+ break; >+ } >+ netdev->next = devlist; >+ devlist = (struct device *)netdev; >+ break; >+ } >+ free_find_results(&list); > >- buf[255] = 0; >- snprintf(buf, 255, "%s/compatible", n->path); >+ /* Yes, this is a platform device */ >+ minifind("/sys/devices/platform", "mv643xx_eth", &list); > >- fd = open(buf, O_RDONLY); >- if (fd < 0) >- continue; >- >- if (read (fd, buf, 256) < 0) { >- close(fd); >- continue; >+ if (list.result) { >+ netdev = macioNewDevice(NULL); >+ netdev->type = CLASS_NETWORK; >+ netdev->device = strdup("eth"); >+ netdev->desc = strdup("Marvell|MV643xx Ethernet"); >+ netdev->driver = strdup("mv643xx_eth"); >+ netdev->next = devlist; >+ devlist = (struct device *)netdev; > } >- /* Check for bmac or bmac+ */ >- if (!strncmp(buf, "bmac", 4)) >- ret = 1; >+ free_find_results(&list); > >- close(fd); > } > >- if (ret) >- { >- bmac = macioNewDevice(NULL); >- bmac->type = CLASS_NETWORK; >- bmac->device = strdup("eth"); >- bmac->desc = strdup("Apple Computer Inc.|BMAC/BMAC+"); >- bmac->driver = strdup("bmac"); >- bmac->next = devlist; >- devlist = (struct device *)bmac; >- } >+ if (probeClass & CLASS_AUDIO) { >+ struct macioDevice *dmasound; >+ char buf[256]; > >- } >- if (probeClass & CLASS_AUDIO) { >- struct macioDevice *dmasound; >+ minifind("/proc/device-tree", "sound", &list); > >- struct pathNode *n; >- int ret = 0; >+ // Supported >+ for (n = list.result; n; n = n->next) { >+ >+ if (!strstr(n->path, "mac-io")) >+ continue; > >- struct findNode *list = (struct findNode *) malloc(sizeof(struct findNode)); >- list->result = (struct pathNode *) malloc(sizeof(struct pathNode)); >- list->result->path = NULL; >- list->result->next = list->result; >- >- minifind("/proc/device-tree", "sound", list); >- >- // Supported >- for (n = list->result->next; n != list->result; n = n->next) >- { >- if (n->path && strstr(n->path, "mac-io")) >- ret = 1; >+ dmasound = macioNewDevice(NULL); >+ dmasound->type = CLASS_AUDIO; >+ dmasound->next = devlist; >+ >+ snprintf(buf, 255, "%s/layout-id", n->path); >+ if (!access(buf, O_RDONLY)) { >+ dmasound->desc = strdup("Apple Computer Inc.|Apple Onboard Audio"); >+ dmasound->driver = strdup("snd-aoa-i2sbus"); >+ } else { >+ dmasound->desc = strdup("Apple Computer Inc.|PowerMac Sound"); >+ dmasound->driver = strdup("snd-powermac"); >+ } >+ devlist = (struct device *)dmasound; >+ break; >+ } >+ free_find_results(&list); > } > >- if (ret) >- { >- dmasound = macioNewDevice(NULL); >- dmasound->type = CLASS_AUDIO; >- dmasound->desc = strdup("Apple Computer Inc.|PowerMac Sound"); >- dmasound->driver = strdup("snd-powermac"); >- dmasound->next = devlist; >- devlist = (struct device *)dmasound; >+ if (probeClass & CLASS_IDE) { >+ struct macioDevice *ide; >+ char buf[256]; >+ >+ minifind("/proc/device-tree", "ide", &list); >+ >+ // Supported >+ for (n = list.result; n; n = n->next) { >+ char *matches = {"electra-ide", NULL}; >+ if (check_of_compatible(n->path, matches)) { >+ ide = macioNewDevice(NULL); >+ ide->type = CLASS_IDE; >+ ide->next = devlist; >+ ide->desc = strdup("PA Semi|Electra IDE"); >+ ide->driver = strdup("electra-ide"); >+ devlist = (struct device *)ide; >+ break; >+ } >+ } >+ free_find_results(&list); > } > >- } >- if (probeClass & CLASS_OTHER) { >- struct macioDevice *i2c; >- struct pathNode *n; >- int ret = 0; >- int fd; >- char buf[256]; >- >- struct findNode *list = (struct findNode *) malloc(sizeof(struct findNode)); >- list->result = (struct pathNode *) malloc(sizeof(struct pathNode)); >- list->result->path = NULL; >- list->result->next = list->result; >+ if (probeClass & CLASS_OTHER) { >+ struct macioDevice *i2c; > >- minifind("/proc/device-tree", "i2c", list); >- >- // Supported >- for (n = list->result->next; n != list->result; n = n->next) >- { >- if (!n->path) >- continue; >- >- buf[255] = 0; >- snprintf(buf, 255, "%s/compatible", n->path); >- >- fd = open(buf, O_RDONLY); >- if (fd < 0) >- continue; >- >- if (read (fd, buf, 256) < 0) { >- close(fd); >- continue; >- } >- /* Check for KeyWest or Hyrda */ >- if (!strcmp(buf, "keywest-i2c")) >- ret = 1; >- if (!strcmp(buf, "hydra-i2c")) >- ret = 2; >- close(fd); >- >- } >- if (ret) >- { >- i2c = macioNewDevice(NULL); >- i2c->type = CLASS_OTHER; >- >- if (ret == 1) { >- i2c->desc = strdup("Apple Computer Inc.|KeyWest I2C"); >- i2c->driver = strdup("i2c-keywest"); >- } else { >- i2c->desc = strdup("Apple Computer Inc.|Hydra I2C"); >- i2c->driver = strdup("i2c-hydra"); >- } >- i2c->next = devlist; >- devlist = (struct device *)i2c; >- } >- if (list->result) free(list->result); >- list->result = (struct pathNode *) malloc(sizeof(struct pathNode)); >- list->result->path = NULL; >- list->result->next = list->result; >+ char *matches[] = {"PowerMac7,2", "PowerMac7,3", "RackMac3,1", NULL}; >+ if (check_of_compatible("/proc/device-tree", matches)) { >+ i2c = macioNewDevice(NULL); >+ i2c->type = CLASS_OTHER; >+ i2c->desc = strdup("Apple Computer Inc.|G5 Thermostat"); >+ i2c->driver = strdup("therm_pm72"); >+ i2c->next = devlist; >+ devlist = (struct device *)i2c; >+ } >+ >+ minifind("/proc/device-tree", "i2c", &list); > >- ret = 0; >- minifind("/proc/device-tree", "fan", list); >- // Supported >- for (n = list->result->next; n != list->result; n = n->next) >- { >- if (!n->path) >- continue; >- >- buf[255] = 0; >- snprintf(buf, 255, "%s/compatible", n->path); >- >- fd = open(buf, O_RDONLY); >- if (fd < 0) >- continue; >- >- if (read (fd, buf, 256) < 0) { >- close(fd); >- continue; >- } >- if (!strncmp(buf, "adt746",6)) >- ret = 1; >- close(fd); >- } >- if (ret) >- { >- i2c = macioNewDevice(NULL); >- i2c->type = CLASS_OTHER; >- i2c->desc = strdup("Apple Computer Inc.|ADT 746x Thermostat"); >- i2c->driver = strdup("therm_adt746x"); >- i2c->next = devlist; >- devlist = (struct device *)i2c; >- } >- buf[255] = 0; >- snprintf(buf,255, "/proc/device-tree/compatible"); >- fd = open(buf, O_RDONLY); >- if (fd >= 0) { >- if (read (fd, buf, 256) >= 0) { >- if (!strncmp(buf, "PowerMac7,2", 11) || >- !strncmp(buf, "PowerMac7,3", 11) || >- !strncmp(buf, "RackMac3,1", 10)) { >- i2c = macioNewDevice(NULL); >- i2c->type = CLASS_OTHER; >- i2c->desc = strdup("Apple Computer Inc.|G5 Thermostat"); >- i2c->driver = strdup("therm_pm72"); >- i2c->next = devlist; >- devlist = (struct device *)i2c; >- } >- } >- close(fd); >- } >- } >- return devlist; >+ // Supported >+ for (n = list.result; n; n = n->next) { >+ int ret; >+ char *matches[] = {"keywest-i2c", "hydra-i2c", NULL}; >+ >+ ret = check_of_compatible(n->path, matches); >+ if (!ret) >+ continue; >+ >+ i2c = macioNewDevice(NULL); >+ i2c->type = CLASS_OTHER; >+ >+ if (ret == 1) { >+ i2c->desc = strdup("Apple Computer Inc.|KeyWest I2C"); >+ i2c->driver = strdup("i2c-keywest"); >+ } else { >+ i2c->desc = strdup("Apple Computer Inc.|Hydra I2C"); >+ i2c->driver = strdup("i2c-hydra"); >+ } >+ i2c->next = devlist; >+ devlist = (struct device *)i2c; >+ break; >+ } >+ free_find_results(&list); >+ >+ minifind("/proc/device-tree", "fan", &list); >+ // Supported >+ for (n = list.result; n; n = n->next) { >+ char *matches[] = {"adt7460", "adt7467", NULL}; >+ if (check_of_compatible(n->path, matches)) { >+ i2c = macioNewDevice(NULL); >+ i2c->type = CLASS_OTHER; >+ i2c->desc = strdup("Apple Computer Inc.|ADT 746x Thermostat"); >+ i2c->driver = strdup("therm_adt746x"); >+ i2c->next = devlist; >+ devlist = (struct device *)i2c; >+ break; >+ } >+ } >+ free_find_results(&list); >+ >+ } >+ >+ return devlist; > } > > #else >--- kudzu-1.2.80/minifind.c~ 2003-02-11 14:47:38.000000000 +0000 >+++ kudzu-1.2.80/minifind.c 2007-11-27 22:45:13.000000000 +0000 >@@ -15,12 +15,12 @@ > #include "minifind.h" > > // insert a node at head of linked-list >-void insert_node(struct pathNode *n, char *path) >+void insert_node(struct pathNode **n, char *path) > { > struct pathNode *new = (struct pathNode *) malloc(sizeof(struct pathNode)); > new->path = path; >- new->next = n->next; >- n->next = new; >+ new->next = *n; >+ (*n) = new; > } > > // return input strip less last character >@@ -47,7 +47,7 @@ char *minifind(char *dir, char *search, > if (search == NULL) > { > if (lstat(dir, &buf) == 0) >- insert_node(list->result, dir); >+ insert_node(&list->result, dir); > return 0; > } > >@@ -60,7 +60,7 @@ char *minifind(char *dir, char *search, > + strlen(namelist[n]->d_name)+1)); > sprintf(d, "%s/%s", dir, namelist[n]->d_name); > if (strstr(namelist[n]->d_name, search)) >- insert_node(list->result, d); >+ insert_node(&list->result, d); > > if ((lstat(d, &buf) == 0) && S_ISDIR(buf.st_mode)) > { >--- kudzu-1.2.80/minifind.h~ 2003-02-11 14:47:38.000000000 +0000 >+++ kudzu-1.2.80/minifind.h 2007-11-27 23:29:33.000000000 +0000 >@@ -35,7 +35,7 @@ struct findNode > struct pathNode *exclude; > }; > >-void insert_node(struct pathNode *n, char *path); >+void insert_node(struct pathNode **n, char *path); > char *stripLastChar(char *in); > char *minifind(char *dir, char *search, struct findNode *list); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 402071
:
270651
| 271331 |
271701
|
271711