summaryrefslogtreecommitdiffstats
path: root/perl-install/c
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/c')
-rwxr-xr-xperl-install/c/Makefile.PL2
-rw-r--r--perl-install/c/README1
-rw-r--r--perl-install/c/stuff.pm2
-rwxr-xr-xperl-install/c/stuff.xs.pl49
4 files changed, 33 insertions, 21 deletions
diff --git a/perl-install/c/Makefile.PL b/perl-install/c/Makefile.PL
index 8cb2524c9..f776d27f2 100755
--- a/perl-install/c/Makefile.PL
+++ b/perl-install/c/Makefile.PL
@@ -12,7 +12,7 @@ my $pcmcia_probe_o = "/usr/$lib/drakx-installer-binaries/pcmcia_probe.o";
WriteMakefile(
'NAME' => 'stuff',
- 'OPTIMIZE' => '-Os',
+ 'OPTIMIZE' => '-Os -Wall',
'MAKEFILE' => 'Makefile_c',
'OBJECT' => "stuff.o " . (-e $pcmcia_probe_o && " $pcmcia_probe_o"),
'VERSION_FROM' => 'stuff.pm', # finds $VERSION
diff --git a/perl-install/c/README b/perl-install/c/README
deleted file mode 100644
index 2453a5121..000000000
--- a/perl-install/c/README
+++ /dev/null
@@ -1 +0,0 @@
-md5.c, md5_crypt.c and md5.h are taken from pam (dir modules/pam_pwdb)
diff --git a/perl-install/c/stuff.pm b/perl-install/c/stuff.pm
index e9cdbc3bd..72b5b0bd3 100644
--- a/perl-install/c/stuff.pm
+++ b/perl-install/c/stuff.pm
@@ -1,4 +1,4 @@
-package c::stuff; # $Id: stuff.pm 214710 2005-12-15 09:14:01Z prigaux $
+package c::stuff;
use strict;
use vars qw($VERSION @ISA);
diff --git a/perl-install/c/stuff.xs.pl b/perl-install/c/stuff.xs.pl
index 4b80a862f..245746821 100755
--- a/perl-install/c/stuff.xs.pl
+++ b/perl-install/c/stuff.xs.pl
@@ -95,6 +95,18 @@ void log_perror(const char *msg) {
log_message("%s: %s", msg, strerror(errno));
}
+HV* common_pciusb_hash_init(struct pciusb_entry *e) {
+ HV *rh = (HV *)sv_2mortal((SV *)newHV());
+ hv_store(rh, "vendor", 6, newSViv(e->vendor), 0);
+ hv_store(rh, "subvendor", 9, newSViv(e->subvendor), 0);
+ hv_store(rh, "id", 2, newSViv(e->device), 0);
+ hv_store(rh, "subid", 5, newSViv(e->subdevice), 0);
+ hv_store(rh, "driver", 6, newSVpv(e->module ? e->module : "unknown", 0), 0);
+ hv_store(rh, "description", 11, newSVpv(e->text, 0), 0);
+ hv_store(rh, "pci_bus", 7, newSViv(e->pci_bus), 0);
+ hv_store(rh, "pci_device", 10, newSViv(e->pci_device), 0);
+ return rh;
+}
';
@@ -166,7 +178,7 @@ init_setlocale()
setlocale(LC_NUMERIC, "C"); /* otherwise eval "1.5" returns 1 in fr_FR for example */
char *
-setlocale(category, locale = 0)
+setlocale(category, locale = NULL)
int category
char * locale
@@ -261,19 +273,20 @@ get_pci_description(int vendor_id,int device_id)
void
pci_probe()
PPCODE:
- //proc_pci_path = "/tmp/pci";
struct pciusb_entries entries = pci_probe();
- char buf[2048];
int i;
EXTEND(SP, entries.nb);
for (i = 0; i < entries.nb; i++) {
struct pciusb_entry *e = &entries.entries[i];
- snprintf(buf, sizeof(buf), "%04x\t%04x\t%04x\t%04x\t%d\t%d\t%d\t%d\t%d\t%d\t%s\t%s\t%s\t%s",
- e->vendor, e->device, e->subvendor, e->subdevice, e->pci_domain, e->pci_bus,
- e->pci_device, e->pci_function, e->pci_revision, e->is_pciexpress,
- pci_class2text(e->class_id), e->class, e->module ? e->module : "unknown", e->text);
- PUSHs(sv_2mortal(newSVpv(buf, 0)));
+ HV * rh = common_pciusb_hash_init(e);
+ hv_store(rh, "pci_domain", 10, newSViv(e->pci_domain), 0);
+ hv_store(rh, "pci_function", 12, newSViv(e->pci_function), 0);
+ hv_store(rh, "pci_revision", 12, newSViv(e->pci_revision), 0);
+ hv_store(rh, "is_pciexpress", 13, newSViv(e->is_pciexpress), 0);
+ hv_store(rh, "nice_media_type", 15, newSVpv(e->class, 0), 0);
+ hv_store(rh, "media_type", 10, newSVpv(pci_class2text(e->class_id), 0), 0);
+ PUSHs(newRV((SV *)rh));
}
pciusb_free(&entries);
@@ -288,11 +301,11 @@ usb_probe()
for (i = 0; i < entries.nb; i++) {
struct pciusb_entry *e = &entries.entries[i];
struct usb_class_text class_text = usb_class2text(e->class_id);
- snprintf(buf, sizeof(buf), "%04x\t%04x\t%s|%s|%s\t%s\t%s\t%d\t%d\t%d",
- e->vendor, e->device, class_text.usb_class_text, class_text.usb_sub_text,
- class_text.usb_prot_text, e->module ? e->module : "unknown", e->text,
- e->pci_bus, e->pci_device, e->usb_port);
- PUSHs(sv_2mortal(newSVpv(buf, 0)));
+ snprintf(buf, sizeof(buf), "%s|%s|%s", class_text.usb_class_text, class_text.usb_sub_text, class_text.usb_prot_text);
+ HV * rh = common_pciusb_hash_init(e);
+ hv_store(rh, "usb_port", 8, newSViv(e->usb_port), 0);
+ hv_store(rh, "media_type", 10, newSVpv(buf, 0), 0);
+ PUSHs(newRV((SV *)rh));
}
pciusb_free(&entries);
@@ -303,14 +316,14 @@ dmi_probe()
//dmidecode_file = "../../soft/ldetect-lst/test/dmidecode.Laptop.Sony-Vaio-GRX316MP";
struct dmi_entries entries = dmi_probe();
- char buf[2048];
int i;
EXTEND(SP, entries.nb);
for (i = 0; i < entries.nb; i++) {
- snprintf(buf, sizeof(buf), "%s\t%s",
- entries.entries[i].module, entries.entries[i].constraints);
- PUSHs(sv_2mortal(newSVpv(buf, 0)));
+ HV * rh = (HV *)sv_2mortal((SV *)newHV());
+ hv_store(rh, "driver", 6, newSVpv(entries.entries[i].module, 0), 0);
+ hv_store(rh, "description", 11, newSVpv(entries.entries[i].constraints, 0), 0);
+ PUSHs(newRV((SV *)rh));
}
dmi_entries_free(entries);
@@ -510,7 +523,7 @@ EVIocGBitKey (char *file)
fd = open (file, O_RDONLY);
if (fd < 0) {
- perror("Cannot open /dev/input/eventX");
+ warn("Cannot open %s: %s\n", file, strerror(errno));
return;
}