aboutsummaryrefslogtreecommitdiffstats
path: root/Transceiver52M/device/ipc/IPCDevice.cpp
diff options
context:
space:
mode:
authorEric <ewild@sysmocom.de>2020-05-06 12:54:08 +0200
committerEric <ewild@sysmocom.de>2020-05-06 14:00:37 +0200
commita670630cfe02662f15778caadcc0a33e293b2113 (patch)
tree6c9b4d7050d43e560abc448442cbe1c1e488a99c /Transceiver52M/device/ipc/IPCDevice.cpp
parent76c8846df991096ad089c428f7727cadc78c1e4a (diff)
ipc: add master socket number/path parametershoernchen/ipc
osmo-trx-ipc needs to know which master socket it should talk to, so pass this path in the config device args like this: dev-args ipc_msock=/path/to/socket Additionally, add a master socket suffix number parameter to the ipc backend, ipc-driver-test -n 0 to start serving /tmp/ipc_sock0 Change-Id: I24857fbb74e5fc808b2a218957c723291de2ba04
Diffstat (limited to 'Transceiver52M/device/ipc/IPCDevice.cpp')
-rw-r--r--Transceiver52M/device/ipc/IPCDevice.cpp20
1 files changed, 14 insertions, 6 deletions
diff --git a/Transceiver52M/device/ipc/IPCDevice.cpp b/Transceiver52M/device/ipc/IPCDevice.cpp
index eef79ee..8bddfb6 100644
--- a/Transceiver52M/device/ipc/IPCDevice.cpp
+++ b/Transceiver52M/device/ipc/IPCDevice.cpp
@@ -721,18 +721,26 @@ static int ipc_chan_sock_cb(struct osmo_fd *bfd, unsigned int flags)
int IPCDevice::open(const std::string &args, int ref, bool swap_channels)
{
- //float_type sr_host, sr_rf;
- //unsigned int i, n;
- //int rc, dev_id;
+ std::string k,v;
+ std::string::size_type keyend;
int rc;
- LOGC(DDEV, INFO) << "Opening IPC device..";
+ if ((keyend = args.find('=')) != std::string::npos) {
+ k = args.substr(0, keyend++);
+ v = args.substr(keyend);
+ }
+ if(k != "ipc_msock" || !v.length()) {
+ LOGC(DDEV, ERROR) << "Invalid device args provided, expected \"dev-args ipc_msock=/path/to/socket\"\n";
+ return -1;
+ }
+
+ LOGC(DDEV, INFO) << "Opening IPC device" << v << "..";
memset(&sk_state, 0x00, sizeof(sk_state));
INIT_LLIST_HEAD(&sk_state.upqueue);
- rc = osmo_sock_unix_init_ofd(&sk_state.conn_bfd, SOCK_SEQPACKET, 0, IPC_SOCK_PATH, OSMO_SOCK_F_CONNECT);
+ rc = osmo_sock_unix_init_ofd(&sk_state.conn_bfd, SOCK_SEQPACKET, 0, v.c_str(), OSMO_SOCK_F_CONNECT);
if (rc < 0) {
- LOGC(DDEV, ERROR) << "Failed to connect to the BTS (" << IPC_SOCK_PATH << "). "
+ LOGC(DDEV, ERROR) << "Failed to connect to the BTS (" << v << "). "
<< "Retrying...\n";
osmo_timer_setup(&sk_state.timer, ipc_sock_timeout, NULL);
osmo_timer_schedule(&sk_state.timer, 5, 0);