diff options
author | nadi <nadi@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-04-03 11:02:46 +0000 |
---|---|---|
committer | nadi <nadi@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-04-03 11:02:46 +0000 |
commit | f23e8f8b6ca07d57b87b4c0f78bd6a09756e5c0a (patch) | |
tree | e3d05fcea768fc1406cc2232f51f01aedaa08b30 /channels/misdn_config.c | |
parent | 7f128000f078acd416d2d00bde03a0a719f70911 (diff) |
Merged revisions 59788,59803 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.2
........
r59788 | nadi | 2007-04-03 11:37:00 +0200 (Di, 03 Apr 2007) | 2 lines
Use the new sysfs way of mISDN 1.2 to check if a port is NT or not.
........
r59803 | nadi | 2007-04-03 12:40:58 +0200 (Di, 03 Apr 2007) | 2 lines
ptp is the 5th bit, not the 4th.
........
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@59804 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/misdn_config.c')
-rw-r--r-- | channels/misdn_config.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/channels/misdn_config.c b/channels/misdn_config.c index a56fbad89..27dfb3001 100644 --- a/channels/misdn_config.c +++ b/channels/misdn_config.c @@ -328,8 +328,10 @@ static const struct misdn_cfg_spec gen_spec[] = { "\t2 - Messages + Message specific Informations (e.g. bearer capability)\n" "\t3 - very Verbose, the above + lots of Driver specific infos\n" "\t4 - even more Verbose than 3" }, +#ifndef MISDN_1_2 { "misdn_init", MISDN_GEN_MISDN_INIT, MISDN_CTYPE_STR, "/etc/misdn-init.conf", NONE, "Set the path to the misdn-init.conf (for nt_ptp mode checking)." }, +#endif { "tracefile", MISDN_GEN_TRACEFILE, MISDN_CTYPE_STR, "/var/log/asterisk/misdn.log", NONE, "Set the path to the massively growing trace file, if you want that." }, { "bridging", MISDN_GEN_BRIDGING, MISDN_CTYPE_BOOL, "yes", NONE, @@ -978,6 +980,7 @@ static void _build_port_config (struct ast_variable *v, char *cat) void misdn_cfg_update_ptp (void) { +#ifndef MISDN_1_2 char misdn_init[BUFFERSIZE]; char line[BUFFERSIZE]; FILE *fp; @@ -1008,6 +1011,26 @@ void misdn_cfg_update_ptp (void) ast_log(LOG_WARNING,"Couldn't open %s: %s\n", misdn_init, strerror(errno)); } } +#else + int i; + int proto; + char filename[128]; + FILE *fp; + + for (i = 1; i <= max_ports; ++i) { + snprintf(filename, sizeof(filename), "/sys/class/mISDN-stacks/st-%08x/protocol", i << 8); + fp = fopen(filename, "r"); + if (!fp) { + ast_log(LOG_WARNING, "Could not open %s: %s\n", filename, strerror(errno)); + continue; + } + if (fscanf(fp, "0x%08x", &proto) != 1) + ast_log(LOG_WARNING, "Could not parse contents of %s!\n", filename); + else + ptp[i] = proto & 1<<5 ? 1 : 0; + fclose(fp); + } +#endif } static void _fill_defaults (void) |