Neil Brown [Sat, 31 Jan 2009 20:13:27 +0000 (07:13 +1100)]
Add support for control and access over Unix Domain sockets.
Listen on /var/run/gsm-mux for connections.
Over these connections access commands
reset_modem
get_power
set_power {0,1}
alloc_channel
set_name
exit
connect
"connect" provides the significant new functionality.
Further IO on that socket goes directly to a channel to
the GSM controller. That way we can talk to it without needing
to use a pty - simply open as socket and use that.
EOF from a socket appears as a zero-byte read, so make sure to
check for that in pseudo_device_read.
Writing to a closed socket produces SIGPIPE, so we definitely don't want to
exit on that case.
In general, SIGPIPE is quite uninteresting, so universally ignore it.
do not attempt to close virtual channels during shutdown. First off,
the mainloop is no longer running, second, we're about to tell the
modem to completely turn off.
NOTE: Ideally this would be fixed properly, such as -- first closing
all the channels, _then_ flagging the mainloop to quit. After that,
running some -- modem specific -- power off command. We can't use it
like that on the mc75i.
Paul Fertser [Tue, 20 Jan 2009 22:44:39 +0000 (01:44 +0300)]
Implement proper channel allocation and dealloction
With this patch the muxer will allocate channels in a clean way, it will
not return a pts until the modem is really ready to operate on this
channel. It will also retry the command several times until the channel is
allocated.
Channel deallocation is also greatly improved, now we send a correct code to
close a channel and will repeat several times if the packet somehow (e.g.
modem was in power-saving state) lost.
root [Sun, 21 Dec 2008 22:21:22 +0000 (01:21 +0300)]
Implement write buffering for the ptys
If the receiving side of the pty is slow, the kernel pty buffer (of 4096
bytes) overflows and an unreported lossage occurs. This can be seen when
receiving a large SIM phonebook with busy frameworkd.
Paul Fertser [Thu, 4 Dec 2008 17:27:39 +0000 (20:27 +0300)]
Fixed a bug with a 2048-sized transfer from modem
As the circular buffer is used to hold the incoming data from the modem,
its free size must be one byte less than is actually available or we'll get
readp == writep and the buffer will be considered empty.