summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/.perl_checker10
-rw-r--r--tools/Makefile7
-rwxr-xr-xtools/drakx-in-chroot102
-rwxr-xr-xtools/find-drivers-needing-nonfree-firmware94
-rwxr-xr-xtools/install-xml-file-list29
-rwxr-xr-xtools/mdkinst_stage2_tool5
-rw-r--r--tools/serial_probe/serial.c13
7 files changed, 199 insertions, 61 deletions
diff --git a/tools/.perl_checker b/tools/.perl_checker
deleted file mode 100644
index 8dc1d2d7d..000000000
--- a/tools/.perl_checker
+++ /dev/null
@@ -1,10 +0,0 @@
-AutoLoader
-Carp::Heavy
-constant
-Cwd
-Digest::base
-Encode
-File::Path
-Gtk2::Gdk::Keysyms
-IO::Handle
-Pod::Usage \ No newline at end of file
diff --git a/tools/Makefile b/tools/Makefile
index 669b6f987..40194245d 100644
--- a/tools/Makefile
+++ b/tools/Makefile
@@ -1,7 +1,8 @@
DIRS = serial_probe
-CFLAGS = -Wall
+LDFLAGS = $(shell pkg-config libtirpc --libs)
+CFLAGS = -Wall $(shell pkg-config libtirpc --cflags)
-ARCH := $(shell arch | egrep "(x86_64|sparc64|s390x)")
+ARCH := $(shell arch | grep -E "x86_64")
ifneq ("x$(ARCH)", "x")
LIB_NAME = lib64
else
@@ -10,7 +11,7 @@ endif
.PHONY: clean install $(DIRS)
-all: $(DIRS) xhost+ rpcinfo-flushed
+all: $(DIRS) rpcinfo-flushed
$(DIRS):
make -C $@
diff --git a/tools/drakx-in-chroot b/tools/drakx-in-chroot
index a4064ed5b..6565ec9e0 100755
--- a/tools/drakx-in-chroot
+++ b/tools/drakx-in-chroot
@@ -16,19 +16,22 @@ my $COMPRESSED_FILE_REL = $COMPRESSED_LOCATION_REL . 'mdkinst.sqfs';
my $AUTO_INSTALL_ROOTED = '/tmp/auto_inst.cfg.pl';
my $DEFCFG_ROOTED = '/tmp/defcfg.pl';
my $RPMSRATE_ROOTED = '/tmp/rpmsrate';
-my $resolution = '800x600';
+my $resolution = '1024x768';
my ($disk_iso_repository, $repository_uri);
@ARGV >= 2 or die "usage: drakx-in-chroot <root of distrib> <dir to install to> [options]\n
\nOptions specific to drakx-in-chroot:
--flang XX use XX locale
--disk-iso path of a distro
- --resolution=XXXxYYYY (eg: --resolution=1024x768)\n
+ --resolution=XXXxYYYY (eg: --resolution=800x600)\n
--repository=<path> path of packages repository
--text text mode installer
+ --depth=XX set screen color depth
+ --stage2-update X,Y will mount --bind X on Y
";
(my $repository, my $dir, @ARGV) = @ARGV;
+my ($wrapper);
foreach (@ARGV) {
if (/--resolution=(.*)/) {
$resolution = $1;
@@ -36,6 +39,12 @@ foreach (@ARGV) {
$disk_iso_repository = $1;
} elsif (/--repository=(.*)/) {
$repository_uri = $1;
+ } elsif (/--gdb/) {
+ $wrapper = "gdb -q --args";
+ } elsif (/--strace/) {
+ $wrapper = "strace -e file $ENV{STRACE_OPTIONS}";
+ } elsif (/--depth=(.*)/) {
+ $resolution .= "x$1";
}
}
my ($repository_without_arch, $repository_arch) = basename($repository) eq arch() ? (dirname($repository), '/' . arch()) : ($repository, '');
@@ -47,15 +56,18 @@ if ($>) {
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
}
+my @mounts;
+my $_b = before_leaving { sys("$sudo umount $_") foreach reverse @mounts };
+
undef $ENV{TMPDIR}; # prevent packdrake faillure on creating temporary files
if (-d $SLASH_LOCATION) {
- umount_all() == 0 or exit(1);
+ umount_all(1) == 0 or exit(1);
sys("$sudo rm -rf $SLASH_LOCATION/var/lib/rpm $SLASH_LOCATION/dev/mapper");
rm_rf($SLASH_LOCATION);
}
-mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/dev/usb', '/etc', '/var', '/proc', '/sys', $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $prefix_ROOTED;
+mkdir_p("$SLASH_LOCATION$_") foreach '/dev', '/etc', '/var', '/proc', '/sys', '/run', $STAGE2_LOCATION_ROOTED, $MEDIA_LOCATION_ROOTED, $prefix_ROOTED;
sys("$sudo rm -rf $dir") if $ENV{CLEAN};
-e $dir or sys("$sudo mkdir -p $dir");
@@ -68,28 +80,40 @@ if ($remote_repository) {
sys("curl --silent -o $local_mdkinst $repository/$COMPRESSED_FILE_REL");
mount_mdkinst($local_mdkinst);
} elsif (-d "$repository/$LIVE_LOCATION_REL") {
- sys("$sudo mount -o bind $repository/$LIVE_LOCATION_REL $STAGE2_LOCATION");
+ mount("$repository/$LIVE_LOCATION_REL", $STAGE2_LOCATION, "-o bind");
} elsif (-e "$repository/$COMPRESSED_FILE_REL") {
mount_mdkinst("$repository/$COMPRESSED_FILE_REL");
}
-sys("$sudo mount -o bind $dir $SLASH_LOCATION$prefix_ROOTED");
+mount($dir, "$SLASH_LOCATION$prefix_ROOTED", "-o bind");
$repository_uri ||= $repository_without_arch if !$remote_repository;
-sys("$sudo mount -o bind $repository_uri $SLASH_LOCATION$MEDIA_LOCATION_ROOTED") if $repository_uri;
+mount($repository_uri, "$SLASH_LOCATION$MEDIA_LOCATION_ROOTED", "-o bind") if $repository_uri;
+
+mount('/dev', "$SLASH_LOCATION/dev", " --bind -o ro");
+mount('none', "$SLASH_LOCATION/proc", "-t proc");
+mount('none', "$SLASH_LOCATION/sys", "-t sysfs");
+mount('none', "$SLASH_LOCATION/sys/kernel/debug", "-t debugfs");
+mount('none', "$SLASH_LOCATION/run", "-t tmpfs");
-sys("$sudo mount -t proc none $SLASH_LOCATION/proc");
-sys("$sudo mount -t sysfs none $SLASH_LOCATION/sys");
+# - Ensure we mount the udev run dir for various extra metadata from udevadm
+# - If dracut has been used (and thus udev has yummy metadata) make sure
+# drakx knows about it when running in the chroot
+# - Also speedup blkid by using its cache
+foreach my $dir (qw(initramfs udev blkid)) {
+ next if !-d "/run/$dir";
+ mkdir_p("$SLASH_LOCATION/run/$dir");
+ mount("/run/$dir", "$SLASH_LOCATION/run/$dir", "-o bind");
+}
if ($disk_iso_repository) {
my $repository_arch = $repository_arch || 'i586';
mkdir_p($LOOP_MOUNT_POINT);
- sys("$sudo mount -o loop,ro $disk_iso_repository $LOOP_MOUNT_POINT");
+ mount($disk_iso_repository, $LOOP_MOUNT_POINT, "-o loop,ro");
symlinkf('loop/' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED"); # FIXME: arch()
}
symlinkf('media' . $repository_arch, "$SLASH_LOCATION$IMAGE_LOCATION_ROOTED");
create_initial_symlinks();
-create_initial_devices();
apply_stage2_updates();
@@ -101,7 +125,7 @@ mkdir_p("$dir/dev");
eval { cp_af($_, "$dir$_") } foreach qw(/dev/root);
#- if the DISPLAY is remote, we may need to resolve the name:
-eval { cp_af($_, "$SLASH_LOCATION$_") } foreach qw(/etc/resolv.conf);
+eval { cp_af('/etc/resolv.conf', "$SLASH_LOCATION/etc/resolv.conf") };
{
chomp(my $kernel_version = `uname -r`);
@@ -111,14 +135,14 @@ eval { cp_af($_, "$SLASH_LOCATION$_") } foreach qw(/etc/resolv.conf);
}
my $Xnest_pid;
-my $Xnest_bin = find { whereis_binary($_) } 'Xephyr', 'Xnest';
-if (!-f ($SLASH_LOCATION . $AUTO_INSTALL_ROOTED) && $Xnest_bin && (join('', @ARGV) !~ /--text/)) {
+if (!-f ($SLASH_LOCATION . $AUTO_INSTALL_ROOTED) && join('', @ARGV) !~ /--text/) {
+ my $Xnest_bin = find { whereis_binary($_) } 'Xephyr', 'Xnest' or die "Xephyr not found! Please install x11-server-xephyr!\n";
my $DISPLAY = ':8';
$Xnest_pid = fork();
if (!$Xnest_pid) {
exec $Xnest_bin, $DISPLAY, '-ac', ($Xnest_bin eq 'Xephyr' ? '-screen' : '-geometry'), $resolution or die "Xnest failed\n";
}
- $ENV{DISPLAY} = '127.0.0.1' . $DISPLAY;
+ $ENV{DISPLAY} = $DISPLAY;
}
if (my $pid = fork()) {
@@ -128,8 +152,8 @@ if (my $pid = fork()) {
} else {
$ENV{TERM} = 'linux'; # we only have terminfo for terminal "linux"
$ENV{HOME} = '/';
- # to kept sync with gi/mdk-stage1/init.c::env:
- $ENV{LD_LIBRARY_PATH}='/lib:/usr/lib:/mnt/lib:/mnt/usr/lib:/usr/X11R6/lib:/mnt/usr/X11R6/lib:/lib64:/usr/lib64:/usr/X11R6/lib64:/mnt/lib64:/mnt/usr/lib64:/mnt/usr/X11R6/lib64';
+ # to kept sync with mdk-stage1/init.c::env:
+ $ENV{LD_LIBRARY_PATH}='/lib:/usr/lib:/mnt/lib:/mnt/usr/lib:/lib64:/usr/lib64:/mnt/lib64:/mnt/usr/lib64';
if ($remote_repository) {
$ENV{URLPREFIX} = $repository;
}
@@ -137,7 +161,18 @@ if (my $pid = fork()) {
if_($disk_iso_repository, "--method disk-iso"),
if_($remote_repository, "--method $remote_repository"),
@ARGV);
- exec "$sudo chroot $SLASH_LOCATION $cmd" or die "exec $cmd in $SLASH_LOCATION failed\n";
+ if ($wrapper) {
+ warn qq(GDB USAGE
+Beware that debug info won't be found so on segfault
+just generate a core dump with "gcore" and then
+analyze it offline.
+Thus you sessions will look like:
+(gdb) run
+(gdb) gcore
+(gdb) exit
+);
+ }
+ exec "$sudo $wrapper chroot $SLASH_LOCATION $cmd" or die "exec $cmd in $SLASH_LOCATION failed\n";
}
sub system_verbose { warn join(' ', @_), "\n" if $verbose; system(@_) }
@@ -145,7 +180,7 @@ sub sys { &system_verbose; $? and die qq(running "@_" failed: $?\n) }
sub mount_mdkinst {
my ($mdkinst) = @_;
- sys("$sudo mount -t squashfs -o loop,ro $mdkinst $STAGE2_LOCATION");
+ mount($mdkinst, $STAGE2_LOCATION, "-t squashfs -o loop,ro");
}
sub create_initial_symlinks() {
foreach (cat_or_die("$STAGE2_LOCATION/usr/share/symlinks")) {
@@ -156,21 +191,36 @@ sub create_initial_symlinks() {
symlink $from, $to or die "symlinking $to failed\n";
}
}
+ my $from = "$STAGE2_LOCATION_ROOTED/usr";
+ my $to = "$SLASH_LOCATION/usr";
+ symlink $from, $to or die "symlinking $to failed\n";
+ foreach ('bin', 'sbin', 'lib', 'lib64') {
+ $from = "usr/$_";
+ $to = "$SLASH_LOCATION/$_";
+ symlink $from, $to or die "symlinking $to failed\n";
+ }
}
-sub create_initial_devices() {
- sys("$sudo cp -a /dev/{mem,null,random,urandom} $SLASH_LOCATION/dev");
+sub mount {
+ my ($from, $mntpt, @opts) = @_;
+ push @mounts, $mntpt;
+ sys("$sudo mount $from $mntpt " . join(' ', @opts));
}
-sub umount_all() {
+sub umount_all {
+ my ($b_umount_dev_too) = @_;
my $err;
clean_stage2_updates();
- my @procs = ('/proc/bus/usb', '/proc', '/sys');
- foreach ((map { "$prefix_ROOTED$_" } @procs, ''), @procs, $STAGE2_LOCATION_ROOTED, $LOOP_MOUNT_POINT, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) {
+ my @procs = (qw(/proc /sys/kernel/debug /sys /run/udev /run/blkid /run/initramfs /run));
+ # special case for !draklive case (else a 2nd run would fail):
+ if ($b_umount_dev_too && cat_('/proc/mounts') =~ m! $SLASH_LOCATION/dev !) {
+ system_verbose "$sudo umount $SLASH_LOCATION/dev" and rm_rf("$SLASH_LOCATION/dev");
+ }
+ foreach ((map { "$prefix_ROOTED$_" } @procs, '/dev', ''), @procs, $STAGE2_LOCATION_ROOTED, $LOOP_MOUNT_POINT, $MEDIA_LOCATION_ROOTED, $IMAGE_LOCATION_ROOTED) {
my $dir = "$SLASH_LOCATION$_";
rmdir $dir;
if (-d $dir) {
- if (m!/proc/bus/usb! || begins_with($_, $prefix_ROOTED)) {
+ if (m!/sys/kernel/debug! || begins_with($_, $prefix_ROOTED)) {
system_verbose "$sudo umount $dir 2>/dev/null";
next;
}
@@ -217,7 +267,7 @@ sub apply_stage2_updates() {
undef $ARGV[$::i+1];
undef $ARGV[$::i+2];
push @stage2_updates, $dest;
- sys("$sudo mount --bind $file $STAGE2_LOCATION/$dest");
+ mount($file, "$STAGE2_LOCATION/$dest", " --bind");
}
}
} @ARGV;
diff --git a/tools/find-drivers-needing-nonfree-firmware b/tools/find-drivers-needing-nonfree-firmware
new file mode 100755
index 000000000..e8068baee
--- /dev/null
+++ b/tools/find-drivers-needing-nonfree-firmware
@@ -0,0 +1,94 @@
+#!/usr/bin/perl
+use MDK::Common;
+use Data::Dumper;
+use Data::Dumper::Perltidy;
+
+my $debug = member('--debug', @ARGV);
+
+my $path = '../../cache';
+my %cache = (
+ version => "$path/version.txt",
+ modules => "$path/modules.txt",
+ firmwares => "$path/firmwares.txt",
+ modinfo => "$path/modinfo.",
+ );
+
+mkdir_p($path) if !-d $path;
+# version of main kernel flavor:
+my $kernel = chomp_(cat_($cache{version}));
+if (!$kernel) {
+ # get regular flavor:
+ ($kernel) = split('\|', chomp_(`urpmq -f kernel-desktop-latest`));
+ # get real package name:
+ $kernel =~ s/-latest//;
+ # drop arch as it confuses urpmq:
+ $kernel =~ s/\.[^.]*$//;
+ output($cache{version}, $kernel);
+}
+warn ">> GOT '$kernel'\n" if $debug;
+
+# list of modules:
+my @modules = cat_($cache{modules});
+if (!@modules) {
+ @modules = grep { /\.ko/ } `urpmq -l $kernel`;
+ output($cache{modules}, @modules);
+}
+@modules = map { chomp; $_ } @modules;
+
+# list of those module firmwares:
+my %firmwares;
+{
+ my @firmwares = cat_($cache{firmwares});
+ if (!@firmwares) {
+ @firmwares = `urpmf --qf '%name-%version-%release.%arch:%files' /lib/firmware/ |sort -u`;
+ output($cache{firmwares}, @firmwares);
+ }
+ %firmwares = map { chomp; s!^(.*):/lib/firmware/!!; $_ => $1 } @firmwares;
+}
+
+#warn Data::Dumper->Dump([ \@modules ], [ 'modules' ]);
+warn Data::Dumper->Dump([ \%firmwares ], [ 'firmwares' ]) if $debug;
+
+# compute list of module that needs nonfree firmwares:
+my @non_free_fw_drivers;
+foreach (uniq(@modules)) {
+ my ($raw) = m!([^/]*)$!;
+ my $cache = $cache{modinfo} . $raw;
+ my @firmwares = cat_($cache);
+ # speedup: cache might exists but being empty:
+ if (!-e $cache) {
+ #warn ">> run '/sbin/modinfo $_ | grep firmware:'\n" if $debug;
+ @firmwares = `/sbin/modinfo $_ | grep firmware:`;
+ output($cache, @firmwares);
+ }
+ @firmwares = map { chomp; s/^.*:\s+//; $_ } @firmwares;
+ next if !@firmwares;
+ warn Data::Dumper->Dump([ \@firmwares ], [ 'firmware' ]) if $debug;
+ if (any { $firmwares{$_} && $firmwares{$_} =~ /nonfree/ } @firmwares) {
+ push @non_free_fw_drivers, $_;
+ #last;
+ }
+}
+
+# cleaning:
+@non_free_fw_drivers = sort map { s!.*/!!; s!\.ko.*$!!; $_ } @non_free_fw_drivers;
+
+#$Data::Dumper::Perltidy::ARGV = '-it=2 -l 100';
+#warn Dumper(\@non_free_fw_drivers) . "\n";
+
+# Pretty dump:
+my $sep = ' ';
+my $s = $sep . 'qw(' . join(' ', @non_free_fw_drivers) . ')';
+$s =~ s/(.{70}\S*)\s+/$1\n$sep/g;
+
+output('list_firmwares.pm',
+ "# generated using $kernel\n",
+ q(# This list is autogenerated ; Do NOT alter manually.
+
+package list_firmwares;
+
+our @modules_with_nonfree_firmware =
+),
+ $s, ";\n\n1;\n");
+
+
diff --git a/tools/install-xml-file-list b/tools/install-xml-file-list
index 56b7a0a4f..64c70b9c6 100755
--- a/tools/install-xml-file-list
+++ b/tools/install-xml-file-list
@@ -19,10 +19,12 @@ if ($>) {
$ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}";
}
+my $verbose;
#$verbose = 1;
my $initial_dir = cwd();
my $ARCH = arch() =~ /i.86/ ? 'i386' : arch();
+$ARCH =~ s/^(arm).*/$1/;
my $LIB = arch() =~ /x86_64/ ? "lib64" : "lib";
my $base_cpio_options = '-pumd --quiet';
@@ -91,7 +93,7 @@ sub valid_cond {
sub add_to_env {
my ($env, $tag, $attr) = @_;
- my %env = map_each { $::a => +{%$::b} } %$env;
+ my %env = map_each { $::a => +{ %$::b } } %$env;
foreach (keys %$attr) {
!$env{$tag}{$_} or die qq(overriding attribute <$tag $_="$env{$tag}{$_}"> with $_="$attr->{$_}"\n);
$env{$tag}{$_} = $attr->{$_};
@@ -148,17 +150,17 @@ sub collect_needed_libraries {
@to_check = ();
}
}
-sub install_needed_libraries {
+sub install_needed_libraries() {
copy_files('', $DEST, [ keys %needed_libraries ], '', '--dereference');
}
sub collect_needed_perl_files {
- my ($local_rep, $dest, @scripts) = @_;
+ my ($local_rep, @scripts) = @_;
my (%local, %global);
foreach my $script (@scripts) {
foreach (`strace -efile perl -cw -I$local_rep $script 2>&1`) {
- my ($f) = /^open\("(.*?)",.*\)\s*=\s*\d+$/ or next;
+ my ($f) = /^open(?:at\([^,]*, |)"(.*?)",.*\)\s*=\s*\d+$/ or next;
if ($f =~ m!^\Q$local_rep\E/(.*)!) {
$local{$1} = 1;
} elsif (begins_with($f, '/dev/')) {
@@ -230,7 +232,7 @@ sub install {
@l = all_files_rec_($l[0]);
}
@l = grep { !m!/(\.svn|CVS)($|/)! } @l;
- if (my $re = $env->{from}{matching}) {
+ if (my $re = expand_macros($env->{from}{matching})) {
@l = grep { eval $re } @l;
}
@@ -258,7 +260,9 @@ sub install {
} elsif ($expand eq 'binary') {
$disallow_from_dir->();
- my @PATH = qw(/sbin /bin /usr/bin /usr/sbin /usr/X11R6/bin);
+ my @PATH = qw(/usr/sbin /usr/bin /usr/X11R6/bin);
+ unshift(@PATH, "/bin") unless -l "/bin";
+ unshift(@PATH, "/sbin") unless -l "/sbin";
foreach my $name (map { expand_macros($_) } @text_l) {
my @l = grep { -x $_ } map { "$_/$name" } @PATH;
@l or error("can't find binary $name"), next;
@@ -295,20 +299,28 @@ sub install {
push @files, @l;
}
+ } elsif ($expand eq 'perl-bin') {
+ $disallow_from_dir->();
+ $from_dir = '/usr/LIB/perl5/vendor_perl/';
+ @files = @text_l;
} elsif ($expand eq 'perl') {
$disallow_from_dir->();
- $from_dir = '/usr/lib/perl5/vendor_perl/*';
+ $from_dir = '/usr/share/perl5/vendor_perl/';
@files = @text_l;
} elsif ($expand eq 'main-perl') {
$disallow_from_dir->();
$from_dir = $Config{privlib};
@files = @text_l;
+ } elsif ($expand eq 'main-perl-bin') {
+ $disallow_from_dir->();
+ $from_dir = $Config{archlib};
+ @files = @text_l;
} elsif ($expand =~ /collect-perl-files/) {
my (undef, $local, $to) = split(' ', $expand);
@files = @text_l;
warn "collect-perl-files $local $to @files ($env->{filter}{command})\n";
- my ($local_perl_files, $global_perl_files) = collect_needed_perl_files($local, $to, @files);
+ my ($local_perl_files, $global_perl_files) = collect_needed_perl_files($local, @files);
warn "collect-perl-files gave: ", join(' ', @$local_perl_files), "\n";
# warn " and: ", join(' ', @$global_perl_files), "\n";
copy_and_filter($local =~ m!/! ? $local : "$working_dir/$local", "$DEST$to", $local_perl_files, $env->{filter}, '', '--dereference');
@@ -353,6 +365,7 @@ sub apply_filter {
@l = grep { ! -d $_ } @l or next;
if (my $subst = $filter->{subst}) {
+ warn "running substition $subst \n" if $verbose;
system('perl', '-pi', '-e', $subst, @l);
}
if (my $command = $filter->{command}) {
diff --git a/tools/mdkinst_stage2_tool b/tools/mdkinst_stage2_tool
index c1ef5d151..0019ffc86 100755
--- a/tools/mdkinst_stage2_tool
+++ b/tools/mdkinst_stage2_tool
@@ -36,7 +36,10 @@ if [ $ACTION = "--compress" ]; then
[ -d "$LIVE_DIR" ] || error
echo "Creating $COMPRESSED_IMAGE from $LIVE_DIR"
rm -f $STAGE2_DIR/.room
- mksquashfs $LIVE_DIR $COMPRESSED_IMAGE -all-root -noappend >/dev/null || { echo "mksquashfs failed"; exit 1; }
+ if ! mksquashfs $LIVE_DIR $COMPRESSED_IMAGE -all-root -noappend >/dev/null; then
+ echo "mksquashfs failed"
+ exit 1
+ fi
chmod 755 $COMPRESSED_IMAGE
echo foo > $STAGE2_DIR/.room
if [ -s $STAGE2_DIR/.room ]; then
diff --git a/tools/serial_probe/serial.c b/tools/serial_probe/serial.c
index c84cbcff5..5159c3dae 100644
--- a/tools/serial_probe/serial.c
+++ b/tools/serial_probe/serial.c
@@ -663,7 +663,6 @@ static int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len,
unsigned char *endfield;
unsigned char *temppos;
unsigned char *pnp_string;
- unsigned char end_char;
int no_more_extensions=0;
int stage;
@@ -719,7 +718,6 @@ static int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len,
/* setup end character we are looking for based on the start character */
if (start == p2) {
pnp_id->xlate_6bit = 1;
- end_char = EndPnP2;
/* we need to xlate data in PnP fields */
/* remember to skip the revision fields (bytes 1 and 2 after start) */
temppos=start;
@@ -734,7 +732,6 @@ static int parse_pnp_string( unsigned char *pnp_id_string, int pnp_len,
}
} else {
pnp_id->xlate_6bit = 0;
- end_char = EndPnP1;
}
/* move everything before the start of the PnP block */
@@ -881,7 +878,6 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags,
int fd;
int temp;
int pnp_strlen;
- int devicetype=-1;
unsigned char pnp_string[100];
char port[20];
struct termios origattr;
@@ -918,19 +914,11 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags,
maj = major(sb.st_rdev);
if (maj != 4 && (maj < 136 || maj > 143)) {
if (ioctl (fd, TIOCLINUX, &twelve) < 0) {
- #ifdef __powerpc__
- // we could have gotten an error for another reason - like EINVAL
- // skipping ttyS0 on PPC - which is where most modems reside
- if (errno == ENOTTY) {
- #endif
if (ioctl (fd, TIOCGSERIAL, &si) >= 0) {
if (si.line > 0) {
console = 1 << si.line;
} else {
console = 0;
- #ifdef __powerpc__
- }
- #endif
}
} else console = 0;
}
@@ -986,7 +974,6 @@ struct device *serialProbe(enum deviceClass probeClass, int probeFlags,
/* try twiddling RS232 control lines and see if it talks to us */
- devicetype=-1;
pnp_strlen = 0;
if (attempt_pnp_retrieve( fd, pnp_string, &pnp_strlen,
sizeof(pnp_string) - 1 ) == PNP_COM_FATAL)