From 88c8bb722671e4f24ac58d4c37da6a11a26df41c Mon Sep 17 00:00:00 2001 From: Michael 'Mickey' Lauer Date: Tue, 23 Dec 2008 18:04:04 +0100 Subject: [PATCH] sync. with 1.7 upstream: * report a warning, if ptx buffer is full * enable additional SIEMENS C35 functionality --- src/gsm0710muxd.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/gsm0710muxd.c b/src/gsm0710muxd.c index 01eedd9..d522ad0 100644 --- a/src/gsm0710muxd.c +++ b/src/gsm0710muxd.c @@ -162,6 +162,7 @@ typedef struct Channel int remaining; unsigned char *tmp; guint g_source; + GIOChannel* g_channel; } Channel; typedef enum MuxerStates @@ -735,8 +736,8 @@ const int c_alloc_channel(const char* purpose, char** url) SYSCHECK(unlockpt(channellist[i].fd)); } channellist[i].v24_signals = GSM0710_SIGNAL_DV | GSM0710_SIGNAL_RTR | GSM0710_SIGNAL_RTC | GSM0710_EA; - GIOChannel* g_channel = g_io_channel_unix_new(channellist[i].fd); - channellist[i].g_source = g_io_add_watch(g_channel, G_IO_IN | G_IO_HUP, pseudo_device_read, channellist+i); + channellist[i].g_channel = g_io_channel_unix_new(channellist[i].fd); + channellist[i].g_source = g_io_add_watch(channellist[i].g_channel, G_IO_IN | G_IO_HUP, pseudo_device_read, channellist+i); write_frame(i, NULL, 0, GSM0710_TYPE_SABM | GSM0710_PF); LOG(LOG_INFO, "Connecting %s to virtual channel %d for %s on %s", channellist[i].ptsname, channellist[i].id, channellist[i].purpose, serial.devicename); @@ -1377,7 +1378,11 @@ int extract_frames( { LOG(LOG_DEBUG, "Frame channel > 0, pseudo channel"); //data from logical channel - write(channellist[frame->channel].fd, frame->data, frame->length); + int c; + SYSCHECK(c = write(channellist[frame->channel].fd, frame->data, frame->length)); + if (c != frame->length) + LOG(LOG_WARNING, "Couldn't write all data to the pseudo channel %d. Wrote only %d bytes", + frame->channel, c); } else { @@ -1406,9 +1411,12 @@ int extract_frames( if (frame->channel == 0) { LOG(LOG_DEBUG, "Control channel opened"); + if (additional_functionality & AF_SIEMENS_C35)// additional siemens c35 test + { //send version Siemens version test - //static unsigned char version_test[] = "\x23\x21\x04TEMUXVERSION2\0"; - //write_frame(0, version_test, sizeof(version_test), GSM0710_TYPE_UIH); + static unsigned char version_test[] = "\x23\x21\x04TEMUXVERSION2\0"; + write_frame(0, version_test, sizeof(version_test), GSM0710_TYPE_UIH); + } } else LOG(LOG_INFO, "Logical channel %d opened", frame->channel); -- 2.39.5