summaryrefslogtreecommitdiffstats
path: root/lib/network/connection
diff options
context:
space:
mode:
authorEugeni Dodonov <eugeni@mandriva.org>2009-11-09 11:10:52 +0000
committerEugeni Dodonov <eugeni@mandriva.org>2009-11-09 11:10:52 +0000
commita72de41cd8369d5ddcd48b4de6e9d78a1b7f3272 (patch)
tree15f3d3dd3614c71ec973abf55cc4160021ac88dc /lib/network/connection
parent0c26b0fbedc597541c1cdd71cd5ae5714c1eabc8 (diff)
downloaddrakx-net-a72de41cd8369d5ddcd48b4de6e9d78a1b7f3272.tar
drakx-net-a72de41cd8369d5ddcd48b4de6e9d78a1b7f3272.tar.gz
drakx-net-a72de41cd8369d5ddcd48b4de6e9d78a1b7f3272.tar.bz2
drakx-net-a72de41cd8369d5ddcd48b4de6e9d78a1b7f3272.tar.xz
drakx-net-a72de41cd8369d5ddcd48b4de6e9d78a1b7f3272.zip
Added patch to support udev-supplied 3g modem parameters (patch by
Herton).
Diffstat (limited to 'lib/network/connection')
-rw-r--r--lib/network/connection/cellular_card.pm38
1 files changed, 34 insertions, 4 deletions
diff --git a/lib/network/connection/cellular_card.pm b/lib/network/connection/cellular_card.pm
index ccfeba5..58977f0 100644
--- a/lib/network/connection/cellular_card.pm
+++ b/lib/network/connection/cellular_card.pm
@@ -63,15 +63,45 @@ sub get_interface {
sub get_tty_device {
my ($self) = @_;
+
+ my $tty_interface = 0;
+ my %udev_env = map { if_(/^([^=]*)=(.*)$/, $1 => $2) } chomp_(run_program::get_stdout("udevadm info --query=property --path=$self->{device}{sysfs_device}"));
+
+ if ($udev_env{USB_INTERFACE}) {
+ my $dev_sys_path = $self->{device}->{sysfs_device};
+ my $cfg = chomp_(cat_($dev_sys_path . "/bConfigurationValue"));
+ my $tty_usb = basename(glob_("$dev_sys_path/" .
+ $self->{device}->{pci_bus} . "-" .
+ ($self->{device}->{usb_port} + 1) . ":$cfg." .
+ $udev_env{USB_INTERFACE} . "/ttyUSB*"));
+ if ($tty_usb) {
+ $tty_usb =~ s/ttyUSB//;
+ $tty_interface = $tty_usb;
+ }
+ } else {
+ # if no usb interface for tty port given, use first one
+ my @intfs = glob_("$self->{device}->{sysfs_device}/" .
+ $self->{device}->{pci_bus} . "-" .
+ ($self->{device}->{usb_port} + 1) . ":*");
+ foreach (@intfs) {
+ my $tty_usb = basename(glob_("$_/tty*"));
+ if ($tty_usb) {
+ $tty_usb =~ s/tty[a-zA-Z]*//;
+ $tty_interface = $tty_usb;
+ last;
+ }
+ }
+ }
+
$self->{device}{device} ?
"/dev/" . $self->{device}{device} :
$self->get_driver eq "nozomi" ?
- "/dev/noz0" :
+ "/dev/noz" . $tty_interface :
$self->get_driver eq "cdc_acm" ?
- "/dev/ttyACM0" :
+ "/dev/ttyACM" . $tty_interface :
$self->get_driver eq "hso" ?
- "/dev/ttyHS0" :
- "/dev/ttyUSB0";
+ "/dev/ttyHS" . $tty_interface :
+ "/dev/ttyUSB" . $tty_interface;
}
sub get_control_device {