[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-19 Thread laforge
laforge has submitted this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )

 (

5 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted 
one.
 )Change subject: Add command and client function to change transmitted Sa bits
..

Add command and client function to change transmitted Sa bits

Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
---
M include/osmocom/e1d/proto_clnt.h
M src/ctl.c
M src/e1d.h
M src/intf_line.c
M src/mux_demux.c
M src/proto_clnt.c
6 files changed, 87 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  tnt: Looks good to me, approved




diff --git a/include/osmocom/e1d/proto_clnt.h b/include/osmocom/e1d/proto_clnt.h
index 26bd44e..b5be2ce 100644
--- a/include/osmocom/e1d/proto_clnt.h
+++ b/include/osmocom/e1d/proto_clnt.h
@@ -43,6 +43,7 @@
uint8_t intf, uint8_t line, uint8_t ts);
 int osmo_e1dp_client_line_config(struct osmo_e1dp_client *clnt,
uint8_t intf, uint8_t line, enum osmo_e1dp_line_mode mode);
+int osmo_e1dp_client_set_sa_bits(struct osmo_e1dp_client *clnt, uint8_t intf, 
uint8_t line, uint8_t sa_bits);
 int osmo_e1dp_client_ts_open(struct osmo_e1dp_client *clnt,
uint8_t intf, uint8_t line, uint8_t ts,
enum osmo_e1dp_ts_mode mode, uint16_t read_bufsize);
diff --git a/src/ctl.c b/src/ctl.c
index 8ed4a69..331f2ad 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -430,6 +430,37 @@
return 0;
 }

+static int
+_e1d_ctl_sabits(void *data, struct msgb *msgb, struct msgb *rmsgb, int *rfd)
+{
+   struct e1_daemon *e1d = (struct e1_daemon *)data;
+   struct osmo_e1dp_msg_hdr *hdr = msgb_l1(msgb);
+   uint8_t sa_bits = *(uint8_t *)msgb_l2(msgb);
+   struct e1_intf *intf = NULL;
+   struct e1_line *line = NULL;
+
+   /* Process query and find timeslot */
+   intf = e1d_find_intf(e1d, hdr->intf);
+   if (!intf) {
+   LOGP(DE1D, LOGL_NOTICE, "Client request for non-existant 
Interface %u\n", hdr->intf);
+   return 0;
+   }
+
+   line = e1_intf_find_line(intf, hdr->line);
+   if (!line) {
+   LOGPIF(intf, DE1D, LOGL_NOTICE, "Client request for 
non-existant line %u\n", hdr->line);
+   return 0;
+   }
+
+   line->ts0.tx_frame = ((sa_bits & 0x80) >> 7) | /* Bit 7 -> Sa8 */
+((sa_bits & 0x40) >> 5) | /* Bit 6 -> Sa7 */
+((sa_bits & 0x01) << 2) | /* Bit 0 -> Sa6 */
+((sa_bits & 0x20) >> 2) | /* Bit 5 -> Sa5 */
+(sa_bits & 0x10); /* Bit 4 -> Sa4 */
+
+   return 0;
+}
+

 struct osmo_e1dp_server_handler e1d_ctl_handlers[] = {
{
@@ -462,5 +493,11 @@
.payload_len = sizeof(struct osmo_e1dp_ts_config),
.fn = _e1d_ctl_ts_open,
},
+   {
+   .type = E1DP_CMD_SABITS,
+   .flags = E1DP_SF_INTF_REQ | E1DP_SF_LINE_REQ,
+   .payload_len = sizeof(uint8_t),
+   .fn = _e1d_ctl_sabits,
+   },
{ /* guard */ },
 };
diff --git a/src/e1d.h b/src/e1d.h
index 4b70c0f..bf1cbdf 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -148,6 +148,8 @@
uint8_t prev_errmask;
/*! timer to re-set the rx_crc4_err and rx_alarm above */
struct osmo_timer_list timer;
+   /*! current transmitting frame with Sa bits */
+   uint8_t tx_frame;
/*! last received frame with Sa bits */
uint8_t rx_frame;
} ts0;
diff --git a/src/intf_line.c b/src/intf_line.c
index b3dafff..8eac84d 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -272,6 +272,7 @@
line->intf = intf;
line->drv_data = drv_data;
line->mode = E1_LINE_MODE_CHANNELIZED;
+   line->ts0.tx_frame = 0xff;
line->ts0.rx_frame = 0xff;

for (int i = 0; i < 32; i++)
diff --git a/src/mux_demux.c b/src/mux_demux.c
index 71374ef..dd8ca45 100644
--- a/src/mux_demux.c
+++ b/src/mux_demux.c
@@ -149,11 +149,18 @@
 static void
 _e1_line_mux_out_channelized(struct e1_line *line, uint8_t *buf, int fts)
 {
+   struct e1_ts *ts;
+
OSMO_ASSERT(line->mode == E1_LINE_MODE_CHANNELIZED);

-   /* Scan timeslots */
+   /* Fill timeslot 0 */
+   ts = >ts[0];
+   for (int i = 0; i < fts; i++)
+   buf[(i*32)] = line->ts0.tx_frame;
+
+   /* Scan timeslots 1..31 */
for (int tsn = 1; tsn < 32; tsn++) {
-   struct e1_ts *ts = >ts[tsn];
+   ts = >ts[tsn];
uint8_t buf_ts[fts];
int l;

diff --git a/src/proto_clnt.c b/src/proto_clnt.c
index 99d1cc2..854b958 100644
--- a/src/proto_clnt.c
+++ b/src/proto_clnt.c
@@ -394,6 +394,34 @@
return 0;
 }

+/*! Set Sa-bits of a specific E1 line in osmo-e1d.
+ *  \param[in] clnt Client previously returned 

[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-19 Thread jolly
Attention is currently required from: jolly.

Hello Jenkins Builder, laforge, tnt,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email

to look at the new patch set (#6).

The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder

The change is no longer submittable: Verified is unsatisfied now.


Change subject: Add command and client function to change transmitted Sa bits
..

Add command and client function to change transmitted Sa bits

Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
---
M include/osmocom/e1d/proto_clnt.h
M src/ctl.c
M src/e1d.h
M src/intf_line.c
M src/mux_demux.c
M src/proto_clnt.c
6 files changed, 87 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/62/35562/6
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 6
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: jolly 
Gerrit-MessageType: newpatchset


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-19 Thread tnt
Attention is currently required from: jolly.

tnt has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )

Change subject: Add command and client function to change transmitted Sa bits
..


Patch Set 5: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 5
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: jolly 
Gerrit-Comment-Date: Fri, 19 Jan 2024 14:50:54 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-18 Thread tnt
Attention is currently required from: jolly.

tnt has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )

Change subject: Add command and client function to change transmitted Sa bits
..


Patch Set 5: Code-Review+1


--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 5
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: jolly 
Gerrit-Comment-Date: Thu, 18 Jan 2024 12:40:30 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-18 Thread jolly
Attention is currently required from: tnt.

jolly has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )

Change subject: Add command and client function to change transmitted Sa bits
..


Patch Set 3:

(1 comment)

File src/proto_clnt.c:

https://gerrit.osmocom.org/c/osmo-e1d/+/35562/comment/2ce19fa8_257fa3bf
PS3, Line 420:  if (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_line_info))
> Yes, this is a mess. I will do patches first and do tests before I can 
> provide fixes for that.
Done



--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 3
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: tnt 
Gerrit-Comment-Date: Thu, 18 Jan 2024 12:25:54 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: jolly 
Comment-In-Reply-To: tnt 
Gerrit-MessageType: comment


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-18 Thread jolly
Attention is currently required from: tnt.

Hello Jenkins Builder, laforge, tnt,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email

to look at the new patch set (#4).

The following approvals got outdated and were removed:
Verified+1 by Jenkins Builder


Change subject: Add command and client function to change transmitted Sa bits
..

Add command and client function to change transmitted Sa bits

Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
---
M include/osmocom/e1d/proto_clnt.h
M src/ctl.c
M src/e1d.h
M src/intf_line.c
M src/mux_demux.c
M src/proto_clnt.c
6 files changed, 87 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/62/35562/4
--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 4
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: tnt 
Gerrit-MessageType: newpatchset


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-18 Thread laforge
Attention is currently required from: tnt.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )

Change subject: Add command and client function to change transmitted Sa bits
..


Patch Set 3: -Code-Review


--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 3
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: tnt 
Gerrit-Comment-Date: Thu, 18 Jan 2024 08:57:01 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-16 Thread jolly
Attention is currently required from: tnt.

jolly has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )

Change subject: Add command and client function to change transmitted Sa bits
..


Patch Set 3:

(1 comment)

File src/proto_clnt.c:

https://gerrit.osmocom.org/c/osmo-e1d/+/35562/comment/7d08c952_cda276f1
PS3, Line 420:  if (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_line_info))
> This looks like a cut and paste error. […]
Yes, this is a mess. I will do patches first and do tests before I can provide 
fixes for that.



--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 3
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: tnt 
Gerrit-Comment-Date: Tue, 16 Jan 2024 21:00:24 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: tnt 
Gerrit-MessageType: comment


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-16 Thread tnt
Attention is currently required from: jolly.

tnt has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )

Change subject: Add command and client function to change transmitted Sa bits
..


Patch Set 3:

(1 comment)

File src/proto_clnt.c:

https://gerrit.osmocom.org/c/osmo-e1d/+/35562/comment/dae4ff1b_579852b2
PS3, Line 420:  if (msgb_l2len(msgb) != sizeof(struct osmo_e1dp_line_info))
This looks like a cut and paste error.

The command doesn't return a osmo_e1dp_line_info. It returns no data, so size 
of l2 should be 0.

Also I've just noticed that in that error handling path (which we use in other 
places above), we leak the msgb.



--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 3
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: jolly 
Gerrit-Comment-Date: Tue, 16 Jan 2024 07:59:58 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-14 Thread laforge
Attention is currently required from: jolly, tnt.

laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )

Change subject: Add command and client function to change transmitted Sa bits
..


Patch Set 1: Code-Review+1

(1 comment)

Patchset:

PS1:
it might be problematic if this capability is available to every client, and 
each of them can independently change those bits. But then, I don't really have 
a better idea, and in practice few users/applications will use it.



--
To view, visit https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-e1d
Gerrit-Branch: master
Gerrit-Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
Gerrit-Change-Number: 35562
Gerrit-PatchSet: 1
Gerrit-Owner: jolly 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: tnt 
Gerrit-Attention: jolly 
Gerrit-Attention: tnt 
Gerrit-Comment-Date: Sun, 14 Jan 2024 17:27:45 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


[M] Change in osmo-e1d[master]: Add command and client function to change transmitted Sa bits

2024-01-14 Thread jolly
jolly has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-e1d/+/35562?usp=email )


Change subject: Add command and client function to change transmitted Sa bits
..

Add command and client function to change transmitted Sa bits

Change-Id: I2608af7bbb8092fddd68d4f3bb36b10a1100ce0f
---
M include/osmocom/e1d/proto_clnt.h
M src/ctl.c
M src/e1d.h
M src/intf_line.c
M src/mux_demux.c
M src/proto_clnt.c
6 files changed, 90 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-e1d refs/changes/62/35562/1

diff --git a/include/osmocom/e1d/proto_clnt.h b/include/osmocom/e1d/proto_clnt.h
index 26bd44e..b5be2ce 100644
--- a/include/osmocom/e1d/proto_clnt.h
+++ b/include/osmocom/e1d/proto_clnt.h
@@ -43,6 +43,7 @@
uint8_t intf, uint8_t line, uint8_t ts);
 int osmo_e1dp_client_line_config(struct osmo_e1dp_client *clnt,
uint8_t intf, uint8_t line, enum osmo_e1dp_line_mode mode);
+int osmo_e1dp_client_set_sa_bits(struct osmo_e1dp_client *clnt, uint8_t intf, 
uint8_t line, uint8_t sa_bits);
 int osmo_e1dp_client_ts_open(struct osmo_e1dp_client *clnt,
uint8_t intf, uint8_t line, uint8_t ts,
enum osmo_e1dp_ts_mode mode, uint16_t read_bufsize);
diff --git a/src/ctl.c b/src/ctl.c
index 8ed4a69..331f2ad 100644
--- a/src/ctl.c
+++ b/src/ctl.c
@@ -430,6 +430,37 @@
return 0;
 }

+static int
+_e1d_ctl_sabits(void *data, struct msgb *msgb, struct msgb *rmsgb, int *rfd)
+{
+   struct e1_daemon *e1d = (struct e1_daemon *)data;
+   struct osmo_e1dp_msg_hdr *hdr = msgb_l1(msgb);
+   uint8_t sa_bits = *(uint8_t *)msgb_l2(msgb);
+   struct e1_intf *intf = NULL;
+   struct e1_line *line = NULL;
+
+   /* Process query and find timeslot */
+   intf = e1d_find_intf(e1d, hdr->intf);
+   if (!intf) {
+   LOGP(DE1D, LOGL_NOTICE, "Client request for non-existant 
Interface %u\n", hdr->intf);
+   return 0;
+   }
+
+   line = e1_intf_find_line(intf, hdr->line);
+   if (!line) {
+   LOGPIF(intf, DE1D, LOGL_NOTICE, "Client request for 
non-existant line %u\n", hdr->line);
+   return 0;
+   }
+
+   line->ts0.tx_frame = ((sa_bits & 0x80) >> 7) | /* Bit 7 -> Sa8 */
+((sa_bits & 0x40) >> 5) | /* Bit 6 -> Sa7 */
+((sa_bits & 0x01) << 2) | /* Bit 0 -> Sa6 */
+((sa_bits & 0x20) >> 2) | /* Bit 5 -> Sa5 */
+(sa_bits & 0x10); /* Bit 4 -> Sa4 */
+
+   return 0;
+}
+

 struct osmo_e1dp_server_handler e1d_ctl_handlers[] = {
{
@@ -462,5 +493,11 @@
.payload_len = sizeof(struct osmo_e1dp_ts_config),
.fn = _e1d_ctl_ts_open,
},
+   {
+   .type = E1DP_CMD_SABITS,
+   .flags = E1DP_SF_INTF_REQ | E1DP_SF_LINE_REQ,
+   .payload_len = sizeof(uint8_t),
+   .fn = _e1d_ctl_sabits,
+   },
{ /* guard */ },
 };
diff --git a/src/e1d.h b/src/e1d.h
index 74010ba..4da463b 100644
--- a/src/e1d.h
+++ b/src/e1d.h
@@ -148,6 +148,8 @@
uint8_t prev_errmask;
/*! timer to re-set the rx_crc4_err and rx_alarm above */
struct osmo_timer_list timer;
+   /*! current transmitting frame with Sa bits */
+   uint8_t tx_frame;
/*! last received frame with Sa bits */
uint8_t rx_frame;
} ts0;
diff --git a/src/intf_line.c b/src/intf_line.c
index b3dafff..8eac84d 100644
--- a/src/intf_line.c
+++ b/src/intf_line.c
@@ -272,6 +272,7 @@
line->intf = intf;
line->drv_data = drv_data;
line->mode = E1_LINE_MODE_CHANNELIZED;
+   line->ts0.tx_frame = 0xff;
line->ts0.rx_frame = 0xff;

for (int i = 0; i < 32; i++)
diff --git a/src/mux_demux.c b/src/mux_demux.c
index 71374ef..dd8ca45 100644
--- a/src/mux_demux.c
+++ b/src/mux_demux.c
@@ -149,11 +149,18 @@
 static void
 _e1_line_mux_out_channelized(struct e1_line *line, uint8_t *buf, int fts)
 {
+   struct e1_ts *ts;
+
OSMO_ASSERT(line->mode == E1_LINE_MODE_CHANNELIZED);

-   /* Scan timeslots */
+   /* Fill timeslot 0 */
+   ts = >ts[0];
+   for (int i = 0; i < fts; i++)
+   buf[(i*32)] = line->ts0.tx_frame;
+
+   /* Scan timeslots 1..31 */
for (int tsn = 1; tsn < 32; tsn++) {
-   struct e1_ts *ts = >ts[tsn];
+   ts = >ts[tsn];
uint8_t buf_ts[fts];
int l;

diff --git a/src/proto_clnt.c b/src/proto_clnt.c
index d922e4a..aba6ae3 100644
--- a/src/proto_clnt.c
+++ b/src/proto_clnt.c
@@ -393,6 +393,37 @@
return 0;
 }

+/*! Set Sa-bits of a specific E1 line in osmo-e1d.
+ *  \param[in] clnt Client previously returned from osmo_e1dp_client_create().
+ *  \param[in] intf E1 interface number to configure.
+ *  \param[in] line E1 line