summaryrefslogtreecommitdiffstats
path: root/perl-install/detect_devices.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/detect_devices.pm')
-rw-r--r--perl-install/detect_devices.pm14
1 files changed, 12 insertions, 2 deletions
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