From d498565fa66347fe9f65d28864ee002b4c8ef5f2 Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Tue, 30 Jul 2002 19:42:33 +0000 Subject: use usb keyboard bCountryCode to choose the right keyboard --- perl-install/detect_devices.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'perl-install/detect_devices.pm') diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 7ffd92252..a80fb29c9 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -348,11 +348,11 @@ sub pci_probe { } sub usb_probe { - -e "/proc/bus/usb/devices" or return (); + -e "/proc/bus/usb/devices" or return; add_addons($usbtable_addons, map { my %l; - @l{qw(vendor id media_type driver description)} = split "\t"; + @l{qw(vendor id media_type driver description pci_bus pci_device)} = split "\t"; $l{$_} = hex $l{$_} foreach qw(vendor id); $l{bus} = 'USB'; \%l @@ -490,6 +490,16 @@ sub usbWacom { grep { $_->{driver} =~ /Tablet:wacom/ } usb_probe() } sub usbKeyboards { grep { $_->{media_type} =~ /\|Keyboard/ } usb_probe() } sub usbStorage { grep { $_->{media_type} =~ /Mass Storage\|/ } usb_probe() } +sub usbKeyboard2country_code { + my ($usb_kbd) = @_; + local *F; + my $tmp; + sysopen(F, sprintf("/proc/bus/usb/%03d/%03d", $usb_kbd->{pci_bus}, $usb_kbd->{pci_device}), 0) and + sysseek F, 0x28, 0 and + sysread F, $tmp, 1 and + unpack("C", $tmp); +} + sub whatUsbport() { # The printer manufacturer and model names obtained with the usb_probe() # function were very messy, once there was a lot of noise around the -- cgit v1.2.1