~ubuntu-branches/ubuntu/saucy/dahdi-tools/saucy

« back to all changes in this revision

Viewing changes to debian/patches/perl_fix_noserial

  • Committer: Stefan Lesicnik
  • Date: 2011-05-08 12:22:46 UTC
  • mfrom: (2.1.4 sid)
  • Revision ID: stefan@lsd.co.za-20110508122246-lh6k2x1uy8pl3vdi
Tags: 1:2.4.1-1ubuntu1
* Merge from Debian. Remaining changes:
  - Bug Fix: If linux-headers are not installed, don't block, and print
    information for the user.
  - added debian/dahdi.postinst
  - added --error-handler=init_failed to debian/rules
  - Changes from Debian:
    - debian/control: Change Maintainer
    - debian/control: Removed Uploaders field.
    - debian/control: Removed Debian Vcs-Svn entry and replaced with
      ubuntu-voip Vcs-Bzr, to reflect divergence in packages.
    - debian/control: Package dahdi Depends on dahdi-dkms | dahdi-source
* debian/control: Added gawk as dependency for dkms build (LP: #493304)
* New upstream release (Closes: #581076, #582094).
* Patches hardware_rescan, perl_fix_noserial, perl_fix_transportdir,
  astribank_allow_ignoreend, init_unload_modules and wcb4xxp_extra_trunk
  dropped: merged upstream.
* dahdi-linux 2.3.0 is required (extra config options for dahdi_cfg).
* Convert to dpkg v.3 format.
* Standards version: 3.9.1.0 (No change needed.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
From: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
2
 
Subject: Not all Astribanks have a 'serial' attribute. Make it optional.
3
 
Origin: http://svn.digium.com/svn/dahdi/tools/trunk@7953
4
 
Last-Update: 2010-01-24
5
 
 
6
 
Backport from current trunk. Will be included in dahdi-tools 2.3.
7
 
 
8
 
---
9
 
 xpp/perl_modules/Dahdi/Hardware/USB.pm |   11 ++++++++++-
10
 
 1 files changed, 10 insertions(+), 1 deletions(-)
11
 
 
12
 
diff --git a/xpp/perl_modules/Dahdi/Hardware/USB.pm b/xpp/perl_modules/Dahdi/Hardware/USB.pm
13
 
index 3eb9fe6..dff25ef 100644
14
 
--- a/xpp/perl_modules/Dahdi/Hardware/USB.pm
15
 
+++ b/xpp/perl_modules/Dahdi/Hardware/USB.pm
16
 
@@ -121,6 +121,15 @@ sub _get_attr($) {
17
 
        return $value;
18
 
 }
19
 
 
20
 
+sub _get_attr_optional($$) {
21
 
+       my ($attr_file, $def_val) = $@;
22
 
+
23
 
+       eval {return _get_attr($attr_file)};
24
 
+       
25
 
+       # If we got here, _get_attr exploded. Return the default value:
26
 
+       return $def_val;
27
 
+}
28
 
+
29
 
 sub scan_devices_sysfs($) {
30
 
        my $pack = shift || die;
31
 
        my @devices = ();
32
 
@@ -137,7 +146,7 @@ sub scan_devices_sysfs($) {
33
 
                my $model = $usb_ids{"$vendor:$product"};
34
 
                next unless defined $model;
35
 
                my $devnum = _get_attr("$_/devnum");
36
 
-               my $serial = _get_attr("$_/serial");
37
 
+               my $serial = _get_attr_optional("$_/serial", '');
38
 
                my $devname = sprintf("%03d/%03d", $busnum, $devnum);
39
 
                my $d = Dahdi::Hardware::USB->new(
40
 
                        IS_ASTRIBANK            => ($model->{DRIVER} eq 'xpp_usb')?1:0,
41
 
1.6.5
42