summaryrefslogtreecommitdiff
path: root/xpp/utils/zconf/Zaptel/Hardware.pm
diff options
context:
space:
mode:
Diffstat (limited to 'xpp/utils/zconf/Zaptel/Hardware.pm')
-rw-r--r--xpp/utils/zconf/Zaptel/Hardware.pm40
1 files changed, 40 insertions, 0 deletions
diff --git a/xpp/utils/zconf/Zaptel/Hardware.pm b/xpp/utils/zconf/Zaptel/Hardware.pm
new file mode 100644
index 0000000..321292a
--- /dev/null
+++ b/xpp/utils/zconf/Zaptel/Hardware.pm
@@ -0,0 +1,40 @@
+package Zaptel::Hardware;
+#
+# Written by Oron Peled <oron@actcom.co.il>
+# Copyright (C) 2007, Xorcom
+# This program is free software; you can redistribute and/or
+# modify it under the same terms as Perl itself.
+#
+# $Id$
+#
+use strict;
+use Zaptel::Hardware::USB;
+use Zaptel::Hardware::PCI;
+
+my @zaptel_devices;
+
+sub device_detected($$) {
+ my $dev = shift || die;
+ my $name = shift || die;
+ warn "Device '$name' already known\n"
+ if grep { $_->hardware_name eq $name } @zaptel_devices;
+ push(@zaptel_devices, $dev);
+}
+
+sub device_removed($) {
+ my $dev = shift || die;
+ my $name = $dev->hardware_name;
+ die "Missing zaptel device hardware name" unless $name;
+ @zaptel_devices = grep { $_->hardware_name ne $name } @zaptel_devices;
+}
+
+sub devices($) {
+ my $pack = shift || die;
+
+ return @zaptel_devices;
+}
+
+Zaptel::Hardware::USB->scan_devices;
+Zaptel::Hardware::PCI->scan_devices;
+
+1;