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

« back to all changes in this revision

Viewing changes to debian/patches/perl_fix_noserial

  • Committer: Bazaar Package Importer
  • Author(s): Jean-Michel Dault, Tzafrir Cohen
  • Date: 2010-02-16 13:44:09 UTC
  • mfrom: (1.1.2 upstream) (2.1.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20100216134409-4y4k26mgzyra537o
Tags: 1:2.2.1-0ubuntu1
* Merge from Debian pkg-voip.
  * 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

* From Debian pkg-voip:
[ Tzafrir Cohen ]
* New upstream release (Closes: #536257, #564381).
* Patch 'bashism' dropped: merged upstream. 
* Patch xpp_no_extra_at dropped: merged upstream. 
* Add an example genconf_parameters.
* Compat level 7.
* Bump standars version to 3.8.3.0 (no change needed)
* Udev rules are now in dahdi-linux.
* Patches perl_fix_noserial, perl_fix_transportdir: Fixes for some
  minor perl issues.
* Add the missing ${misc:Depends}, as per lintian. 
* Patch astribank_allow_ignoreend: an extra missing patch from upstream. 
* Patches init_unload_modules and init_unload_oslec: also unload OSLEC
  when unloading all modules.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Tzafrir Cohen <tzafrir.cohen@xorcom.com>
 
2
Subject: [PATCH 1/2] 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
---
 
7
 xpp/perl_modules/Dahdi/Hardware/USB.pm |   11 ++++++++++-
 
8
 1 files changed, 10 insertions(+), 1 deletions(-)
 
9
 
 
10
diff --git a/xpp/perl_modules/Dahdi/Hardware/USB.pm b/xpp/perl_modules/Dahdi/Hardware/USB.pm
 
11
index 3eb9fe6..dff25ef 100644
 
12
--- a/xpp/perl_modules/Dahdi/Hardware/USB.pm
 
13
+++ b/xpp/perl_modules/Dahdi/Hardware/USB.pm
 
14
@@ -121,6 +121,15 @@ sub _get_attr($) {
 
15
        return $value;
 
16
 }
 
17
 
 
18
+sub _get_attr_optional($$) {
 
19
+       my ($attr_file, $def_val) = $@;
 
20
+
 
21
+       eval {return _get_attr($attr_file)};
 
22
+       
 
23
+       # If we got here, _get_attr exploded. Return the default value:
 
24
+       return $def_val;
 
25
+}
 
26
+
 
27
 sub scan_devices_sysfs($) {
 
28
        my $pack = shift || die;
 
29
        my @devices = ();
 
30
@@ -137,7 +146,7 @@ sub scan_devices_sysfs($) {
 
31
                my $model = $usb_ids{"$vendor:$product"};
 
32
                next unless defined $model;
 
33
                my $devnum = _get_attr("$_/devnum");
 
34
-               my $serial = _get_attr("$_/serial");
 
35
+               my $serial = _get_attr_optional("$_/serial", '');
 
36
                my $devname = sprintf("%03d/%03d", $busnum, $devnum);
 
37
                my $d = Dahdi::Hardware::USB->new(
 
38
                        IS_ASTRIBANK            => ($model->{DRIVER} eq 'xpp_usb')?1:0,
 
39
-- 
 
40
1.6.5
 
41