~ubuntu-branches/ubuntu/trusty/isdnutils/trusty

« back to all changes in this revision

Viewing changes to capiinit/capiinit.c

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2013-11-15 00:02:58 UTC
  • mfrom: (1.1.8) (31.1.1 trusty-proposed)
  • Revision ID: package-import@ubuntu.com-20131115000258-tt9v3gasgrdml07k
Tags: 1:3.25+dfsg1-3.3ubuntu1
* Merge from Debian unstable:
  - resolves licensing issues with package contents.  LP: #511988.
  - includes proper upstream fix for ipppd on ARM.  LP: #453159.
  - resolves isdnutils-base removal failures.  LP: #813771.
  - fixes capiutils init script to not try to mount obsolete capifs.
    LP: #1064347.
* Remaining changes:
  - Switch libreadline5-dev to libreadline-gplv2-dev since this package
    appears to be GPLv2
  - debian/patches/no-imake.patch: Don't build xisdnload/xmonisdn using
    xmkmf/imake.  This patch was dropped in Debian without explanation;
    it still applies and seems to still be a good idea for eventual
    upstreaming, since imake is quite obsolete.
  - capi.conf: Fix typo for fcdsl2 firmware. LP: #189132.
  - Remove dependencies on /etc/inittab.
    - Disable the installation code to modify /etc/inittab.
    - isdnutils-base: Add ttyI0 example script, which needs to be installed
      in /etc/event.d/ttyI0.
    - isdnvboxserver: Add ttyI1 example script, which needs to be installed
      in /etc/event.d/ttyI1.
    - The two upstart scripts need to be edited.
    - Further improvements and documentation welcome.
* Changes included in Debian:
  - replace calls to ./MAKEDEV with /sbin/MAKEDEV
  - Build-depend on ppp-dev.
  - Switch to newer tcl -dev.
  - update to newer automake
  - debian/rules: use autoreconf to update the autotools in the capi20
    directory
  - debian/{compat,rules,*.files,.dirs}: Convert to Multi-arch.
  - debian/libcapi20-dev.install: Remove .la files (no builds use them).
* Changes included upstream:
  - fix for ARM FTBFS.
  - fix bashisms in vboxplay.
  - debian/patches/{config_libdir,toplevel-make}.patch: add CONFIG_LIBDIR
    override to upstream build system to support Multi-arch.
* Dropped changes:
  - kick dpatch to the curb.
* Handle migrating the blacklist file from
  /etc/modprobe.d/blacklist-capiutils.conf to the path used in Debian,
  /etc/modprobe.d/capiutils.conf.
* Handle rename of /etc/ppp/ip-down.d/99-ipppd and /etc/ppp/ip-up.d/00-ipppd
  to /etc/ppp/ip-down.d/ipppd and /etc/ppp/ip-up.d/ipppd
* Handle rename of /etc/init.d/isdnutils to /etc/init.d/isdnutils-base
* Restore standard.tcl to /usr/share/isdnvboxserver/default; maintainer
  scripts must not depend on contents of /usr/share/doc.
* Apply patches that were preserved in the 3.0 (quilt) migration, but
  were inadvertently not applied:
  - debian/patches/capifax.additional_error_codes.patch
  - debian/patches/capifax.3_1kHz_audio.patch
* Drop debian/isdnutils-base.cron.d, which isn't a cronjob example at all
  but an inittab example gone astray.
* debian/dotconfig*: don't use embedded quotes for paths; this confuses
  vbox's Makefiles something fierce, and causes files to be missed from
  debian/tmp'/usr/share/man/' at install time.
* Fix isdnlog and ipppd to not ship files used in the postinst under
  /usr/share/doc.
* Modernize the upstart examples.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 *
4
4
 * $Log: capiinit.c,v $
5
5
 * Revision 1.17  2005/02/21 17:52:00  keil
6
 
 * * have a seperate config directory for firmware
7
 
 * * have a seperate config directory for card tools
 
6
 * * have a separate config directory for firmware
 
7
 * * have a separate config directory for card tools
8
8
 *
9
9
 * Revision 1.16  2004/01/19 09:15:57  calle
10
10
 * Always use capifs, don't trust devfs.
87
87
#include <linux/capi.h>
88
88
#include <linux/kernelcapi.h>
89
89
#include <getopt.h>
 
90
#include <sys/utsname.h>
90
91
 
91
92
#define MODPROBE        "/sbin/modprobe"
92
93
static char capidevnameold[] = "/dev/capi20";
94
95
static char *capidevname = capidevnameold;
95
96
 
96
97
static char *firmwarepath[] = {
 
98
        "/usr/share/isdn/release", /* replaced by kernel release */
97
99
        "/lib/firmware/isdn",
98
100
        "/usr/share/isdn",
99
101
        "/usr/lib/isdn",
107
109
 
108
110
static int patchdebug = 0;      /* -d || -debug */
109
111
static int silent = 0;          /* -s || -silent */
110
 
char *configfilename = "/etc/capi.conf";
 
112
char *configfilename = "/etc/isdn/capi.conf";
111
113
 
112
114
/* ---------------- utils -------------------------------------------- */
113
115
 
136
138
   return s;
137
139
}
138
140
 
 
141
static int init_firmware_path(void)
 
142
{
 
143
   struct utsname uts;
 
144
   char *path;
 
145
 
 
146
   if (uname(&uts))
 
147
      return 1;
 
148
   path = (char *) malloc(strlen(firmwarepath[0]) + strlen(uts.release) + 1);
 
149
   sprintf(path, "/usr/share/isdn/%s", uts.release);
 
150
   firmwarepath[0] = path;
 
151
   return 0;
 
152
}
 
153
 
139
154
/* ---------------- load module -------------------------------------- */
140
155
 
141
156
static int is_module_loaded(char *module)
161
176
        return 0;
162
177
}
163
178
 
164
 
static int load_module(char *module)
 
179
static int load_module(char *module, int silently)
165
180
{
166
181
        char buf[1024];
167
 
        snprintf(buf, sizeof(buf), "%s %s", MODPROBE, module);
 
182
        snprintf(buf, sizeof(buf), "%s %s %s", MODPROBE, module,
 
183
                 silently ? "2>/dev/null" : "");
168
184
        return system(buf);
169
185
}
170
186
 
368
384
                driver = "b1pci";
369
385
        if (strcmp(driver, "c2") == 0)
370
386
                driver = "c4";
371
 
        return load_module(driver);
 
387
        return load_module(driver, 0);
372
388
}
373
389
 
374
390
static int unload_driver(char *driver)
410
426
 
411
427
static int load_filesystem(char *fstype)
412
428
{
413
 
        return load_module(fstype);
 
429
        return load_module(fstype, 1);
414
430
}
415
431
 
416
432
static int unload_filesystem(char *fstype)
1154
1170
{
1155
1171
        if (access("/proc/capi/applications", 0) == 0)
1156
1172
                return 0;
1157
 
        load_module("kernelcapi");
 
1173
        load_module("kernelcapi", 0);
1158
1174
        if (access("/proc/capi/applications", 0) == 0)
1159
1175
                return 0;
1160
1176
        fprintf(stderr, "ERROR: cannot load module kernelcapi\n");
1165
1181
{
1166
1182
        if (access("/proc/capi/capi20", 0) == 0)
1167
1183
                return 0;
1168
 
        load_module("capi");
 
1184
        load_module("capi", 0);
1169
1185
        if (access("/proc/capi/capi20", 0) == 0)
1170
1186
                return 0;
1171
1187
        fprintf(stderr, "ERROR: cannot load module capi20\n");
1200
1216
        if (filesystem_available("devfs"))
1201
1217
                return 0;
1202
1218
#endif
1203
 
        load_filesystem("capifs");
1204
 
        if (filesystem_available("capifs")) 
1205
 
                return 0;
1206
 
        fprintf(stderr, "WARNING: filesystem capifs not available\n");
1207
1219
        return -1;
1208
1220
}
1209
1221
 
1607
1619
                }
1608
1620
        }
1609
1621
 
 
1622
        init_firmware_path();
 
1623
 
1610
1624
        if (optind == ac) {
1611
1625
                return main_start(1, 0, 0);
1612
1626
        } else if (optind+1 == ac) {