Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/13723 ) Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence .. Patch Set 5: > > I would appreciate if you remove comparison [...] > > We also discussed this at OsmoDevCon with Harald, and as it turns > out, modern compilers can perfectly optimize out this comparison > (i.e. the cmp instruction), since it's a static function and the > synch. sequences are defined as a static array. We've compiled > OsmoBTS with clang-8 and checked the results using 'objdump -d -S'. > > However, it doesn't mean that I'm against removing the comparison. > This is simply not the main problem at the moment. Thanks again for > your comments and tips, the initial version of this change was much > worse from performance point of view... Great. I don't have much experience with modern compilers. Just curious - have you checked whether gcc is optimizing it as well? And which compiler is used to build Osmocom builds? -- To view, visit https://gerrit.osmocom.org/13723 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284 Gerrit-Change-Number: 13723 Gerrit-PatchSet: 5 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Vadim Yanitskiy Gerrit-CC: Max Gerrit-Comment-Date: Thu, 09 May 2019 17:03:56 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence
Alexander Chemeris has submitted this change and it was merged. ( https://gerrit.osmocom.org/13723 ) Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence .. osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence Thanks to both TC_rach_content and TC_rach_count TTCN-3 test cases, it was discovered that there are possible collisions when trying to decode a regular 8-bit Access Burst as an 11-bit one. This is exactly what we are doing in rx_rach_fn(): - calling gsm0503_rach_ext_decode_ber() first, - if it failed, falling-back to gsm0503_rach_decode_ber(). With default BSIC=63, the following 8-bit RA values are being misinterpreted as 11-bit Access Bursts: Successfully decoded 8-bit (0x00) RACH as 11-bit (0x): bsic=0x3f Successfully decoded 8-bit (0xbe) RACH as 11-bit (0x0388): bsic=0x3f Successfully decoded 8-bit (0xcf) RACH as 11-bit (0x0036): bsic=0x3f According to 3GPP TS 05.02, section 5.2.7, there are two alternative synch. (training) sequences for Access Bursts: TS1 & TS2. By default, TS0 synch. sequence is used, unless explicitly stated otherwise (see 3GPP TS 04.60). According to 3GPP TS 04.60, section 11.2.5a, the EGPRS capability can be indicated by the MS using one of the alternative training sequences (i.e. TS1 or TS2) and the 11-bit RACH coding scheme. In other words, knowing the synch. sequence of a received Access Burst would allow to decide whether it's extended (11-bit) or a regular (8-bit) one. As a result, we would avoid possible collisions and save some CPU power. Unfortunately, due to the limitations of the current TRXD protocol, there is no easy way to expose such information from the transceiver. A proper solution would be to extend the TRX protocol, but for now, let's do the synch. sequence detection in rx_rach_fn(). As soon as the TRX protocol is extended with info about the synch. sequence, this code would serve for the backwards-compatibility. This change makes the both TC_rach_content and TC_rach_count happy, as well as the new TC_pcu_ext_rach_content() test case aimed to verify extended (11-bit) Access Burst decoding. Related (TTCN-3) I8fe156aeac9de3dc1e71a4950821d4942ba9a253 Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284 Related: OS#1854 --- M src/osmo-bts-trx/scheduler_trx.c 1 file changed, 123 insertions(+), 42 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, approved; Verified Jenkins Builder: Verified diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c index 32bdb98..ade3cff 100644 --- a/src/osmo-bts-trx/scheduler_trx.c +++ b/src/osmo-bts-trx/scheduler_trx.c @@ -22,6 +22,7 @@ */ #include #include +#include #include #include #include @@ -709,72 +710,152 @@ * RX on uplink (indication to upper layer) */ +/* 3GPP TS 05.02, section 5.2.7 */ +#define RACH_EXT_TAIL_LEN 8 +#define RACH_SYNCH_SEQ_LEN 41 + +enum rach_synch_seq_t { + RACH_SYNCH_SEQ_UNKNOWN = -1, + RACH_SYNCH_SEQ_TS0, /* GSM, GMSK (default) */ + RACH_SYNCH_SEQ_TS1, /* EGPRS, 8-PSK */ + RACH_SYNCH_SEQ_TS2, /* EGPRS, GMSK */ + RACH_SYNCH_SEQ_NUM +}; + +static struct value_string rach_synch_seq_names[] = { + { RACH_SYNCH_SEQ_UNKNOWN, "UNKNOWN" }, + { RACH_SYNCH_SEQ_TS0, "TS0: GSM, GMSK" }, + { RACH_SYNCH_SEQ_TS1, "TS1: EGPRS, 8-PSK" }, + { RACH_SYNCH_SEQ_TS2, "TS2: EGPRS, GMSK" }, + { 0, NULL }, +}; + +static enum rach_synch_seq_t rach_get_synch_seq(sbit_t *bits, int *best_score) +{ + sbit_t *synch_seq_burst = bits + RACH_EXT_TAIL_LEN; + enum rach_synch_seq_t seq = RACH_SYNCH_SEQ_TS0; + int score[RACH_SYNCH_SEQ_NUM] = { 0 }; + int max_score = INT_MIN; + int i, j; + + /* 3GPP TS 05.02, section 5.2.7 "Access burst (AB)", synch. sequence bits */ + static const char synch_seq_ref[RACH_SYNCH_SEQ_NUM][RACH_SYNCH_SEQ_LEN] = { + [RACH_SYNCH_SEQ_TS0] = "01001011000110011010101000000", + [RACH_SYNCH_SEQ_TS1] = "01010100100011100010001001101", + [RACH_SYNCH_SEQ_TS2] = "111000100111010101101101101110111", + }; + + /* Get a multiplier for j-th bit of i-th synch. sequence */ +#define RACH_SYNCH_SEQ_MULT \ + (synch_seq_ref[i][j] == '1' ? -1 : 1) + + /* For each synch. sequence, count the bit match score. Since we deal with +* soft-bits (-127...127), we sum the absolute values of matching ones, +* and subtract the absolute values of different ones, so the resulting +* score is more accurate than it could be with hard-bits. */ + for (i = 0; i < RACH_SYNCH_SEQ_NUM; i++) { + for (j = 0; j < RACH_SYNCH_SEQ_LEN; j++) + score[i] += RAC
Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/13723 ) Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence .. Patch Set 4: > I really appreciate all the comments, and will consider yet not > addressed ones as the points of further improvements, but now I > really need to move this fix forward. It's really annoying to see > 11-bit Access Bursts decoded as 8-bit ones, and vice versa. Adding > my CR+2 & V+1 for now, going to merge in a few hours (unless > anybody has any strong objections). I would appreciate if you remove comparison from the weight calculation code as we discussed. You'd be surprised how many RACHs can a BTS get in a congested situation. -- To view, visit https://gerrit.osmocom.org/13723 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284 Gerrit-Change-Number: 13723 Gerrit-PatchSet: 4 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Vadim Yanitskiy Gerrit-CC: Max Gerrit-Comment-Date: Thu, 09 May 2019 16:22:14 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/13723 ) Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence .. Patch Set 4: (1 comment) https://gerrit.osmocom.org/#/c/13723/4/src/osmo-bts-trx/scheduler_trx.c File src/osmo-bts-trx/scheduler_trx.c: https://gerrit.osmocom.org/#/c/13723/4/src/osmo-bts-trx/scheduler_trx.c@750 PS4, Line 750: (synch_seq_ref[i][j] == '1' ? -1 : 1) > In general, I am agree. […] Just add the 0/1 sequence as a comment. Given that 1/-1 sequence can be produced from a 0/1 sequence with a regexp, I don't see any practical issues with this - comparing 1/-1 to 0/1 sequence is super easy and straightforward, and if you want to see it with your eyes - here it is, in the comment. You can do this but it's ugly: #define b0 1 #define b1 -1 [RACH_SYNCH_SEQ_TS2] = [b1,b1,b1,b0,b1,b1,b1,b1,b0,b0,b1,b0,b0,b1,b1,b1,b0,b1,b0,b1,b0,b1,b1,b0,b0,b0,b0,b0,b1,b1,b0,b1,b1,b0,b1,b1,b1,b0,b1,b1,b1] #undef b0 #undef b1 or (no less ugly): #define O 1 #define I -1 [RACH_SYNCH_SEQ_TS2] = [I,I,I,O,I,I,I,I,O,O,I,O,O,I,I,I,O,I,O,I,O,I,I,O,O,O,O,O,I,I,O,I,I,O,I,I,I,O,I,I,I] #undef O #undef I Just an 1/-1 array and a comment with 0/1 string is the best choice. -- To view, visit https://gerrit.osmocom.org/13723 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284 Gerrit-Change-Number: 13723 Gerrit-PatchSet: 4 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Comment-Date: Wed, 24 Apr 2019 20:44:48 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in osmo-bts[master]: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/13723 ) Change subject: osmo-bts-trx: distinguish 11-bit Access Bursts by synch. sequence .. Patch Set 4: (1 comment) https://gerrit.osmocom.org/#/c/13723/4/src/osmo-bts-trx/scheduler_trx.c File src/osmo-bts-trx/scheduler_trx.c: https://gerrit.osmocom.org/#/c/13723/4/src/osmo-bts-trx/scheduler_trx.c@750 PS4, Line 750: (synch_seq_ref[i][j] == '1' ? -1 : 1) Why not just have an array of 1/-1's instead of a string? This is probably not a very hot code path but still, it's better to avoid conditional branching in DSP code. -- To view, visit https://gerrit.osmocom.org/13723 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ibb6d27c6589965c8b59a6d2598a7c43fd860f284 Gerrit-Change-Number: 13723 Gerrit-PatchSet: 4 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-Reviewer: Pau Espin Pedrol Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Comment-Date: Tue, 23 Apr 2019 17:06:29 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in libosmocore[master]: gprs_ns: Don't use initial IP/port for anything but SNS
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/13291 ) Change subject: gprs_ns: Don't use initial IP/port for anything but SNS .. Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/13291/1/src/gb/gprs_ns.c File src/gb/gprs_ns.c: https://gerrit.osmocom.org/#/c/13291/1/src/gb/gprs_ns.c@483 PS1, Line 483: i Typo -- To view, visit https://gerrit.osmocom.org/13291 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I16a91a07e5914d123b2ea2f8413b94e7cd518628 Gerrit-Change-Number: 13291 Gerrit-PatchSet: 1 Gerrit-Owner: Harald Welte Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Alexander Chemeris Gerrit-Comment-Date: Sat, 16 Mar 2019 14:00:34 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
Change in libosmocore[master]: coding: Correctly count bits when decoding EDGE bursts with MCS >= 7.
Alexander Chemeris has submitted this change and it was merged. ( https://gerrit.osmocom.org/9997 ) Change subject: coding: Correctly count bits when decoding EDGE bursts with MCS >= 7. .. coding: Correctly count bits when decoding EDGE bursts with MCS >= 7. They consist of two blocks, so we should count both blocks. Change-Id: I560de192212dae4705054a1665726369b83d213a --- M src/coding/gsm0503_coding.c 1 file changed, 8 insertions(+), 1 deletion(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index c72aabc..088b8bb 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -979,6 +979,9 @@ if (rc < 0) return -EFAULT; } else { + /* Bit counters for the second block */ + int n_errors2, n_bits_total2; + /* MCS-7,8,9 block 1 */ rc = egprs_decode_data(l2_data, c1, cps.mcs, cps.p[0], 0, n_errors, n_bits_total); @@ -987,7 +990,11 @@ /* MCS-7,8,9 block 2 */ rc = egprs_decode_data(l2_data, c2, cps.mcs, cps.p[1], - 1, n_errors, n_bits_total); + 1, _errors2, _bits_total2); + if (n_errors) + *n_errors += n_errors2; + if (n_bits_total) + *n_bits_total += n_bits_total2; if (rc < 0) return -EFAULT; } -- To view, visit https://gerrit.osmocom.org/9997 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I560de192212dae4705054a1665726369b83d213a Gerrit-Change-Number: 9997 Gerrit-PatchSet: 3 Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder (102)
Change in libosmocore[master]: coding: Always initialize bit counters in gsm0503_pdtch_egprs_decode().
Alexander Chemeris has submitted this change and it was merged. ( https://gerrit.osmocom.org/9996 ) Change subject: coding: Always initialize bit counters in gsm0503_pdtch_egprs_decode(). .. coding: Always initialize bit counters in gsm0503_pdtch_egprs_decode(). Previsouly there were a lot of valid code paths which returned from the function before setting bit counters which led to bogus BER output in osmo-bts-trx logs when those code paths were hit. Change-Id: I4722cae3794ccbb12001113c991d9cf345a52a96 --- M src/coding/gsm0503_coding.c 1 file changed, 5 insertions(+), 0 deletions(-) Approvals: Jenkins Builder: Verified Harald Welte: Looks good to me, approved diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 088b8bb..7385d23 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -938,6 +938,11 @@ struct egprs_cps cps; union gprs_rlc_ul_hdr_egprs *hdr; + if (n_errors) + *n_errors = 0; + if (n_bits_total) + *n_bits_total = 0; + if ((nbits != GSM0503_GPRS_BURSTS_NBITS) && (nbits != GSM0503_EGPRS_BURSTS_NBITS)) { /* Invalid EGPRS bit length */ -- To view, visit https://gerrit.osmocom.org/9996 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I4722cae3794ccbb12001113c991d9cf345a52a96 Gerrit-Change-Number: 9996 Gerrit-PatchSet: 2 Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Ivan Kluchnikov Gerrit-Reviewer: Jenkins Builder (102) Gerrit-CC: Vadim Yanitskiy
Change in libosmocore[master]: coding: Fix (E)GPRS BER calculation to correctly account for puncturing.
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/9994 ) Change subject: coding: Fix (E)GPRS BER calculation to correctly account for puncturing. .. Patch Set 1: Hi, Harald. This is an internal function, it's not exported and is not declared in .h -- To view, visit https://gerrit.osmocom.org/9994 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I9da22e7051522d06d923fcec3b63cbed8db93910 Gerrit-Change-Number: 9994 Gerrit-PatchSet: 1 Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Comment-Date: Mon, 16 Jul 2018 08:17:58 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in libosmocore[master]: coding: Correctly count bits when decoding EDGE bursts with MCS >= 7.
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/9997 to look at the new patch set (#2). Change subject: coding: Correctly count bits when decoding EDGE bursts with MCS >= 7. .. coding: Correctly count bits when decoding EDGE bursts with MCS >= 7. They consist of two blocks, so we should count both blocks. Change-Id: I560de192212dae4705054a1665726369b83d213a --- M src/coding/gsm0503_coding.c 1 file changed, 6 insertions(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/97/9997/2 -- To view, visit https://gerrit.osmocom.org/9997 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I560de192212dae4705054a1665726369b83d213a Gerrit-Change-Number: 9997 Gerrit-PatchSet: 2 Gerrit-Owner: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder
Change in libosmocore[master]: coding: Correctly count bits when decoding EDGE bursts with MCS >= 7.
Alexander Chemeris has uploaded this change for review. ( https://gerrit.osmocom.org/9997 Change subject: coding: Correctly count bits when decoding EDGE bursts with MCS >= 7. .. coding: Correctly count bits when decoding EDGE bursts with MCS >= 7. They consist of two blocks, so we should count both blocks. Change-Id: I560de192212dae4705054a1665726369b83d213a --- M src/coding/gsm0503_coding.c 1 file changed, 5 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/97/9997/1 diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 6be4001..527e9cb 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -982,6 +982,9 @@ if (rc < 0) return -EFAULT; } else { + /* Bit counters for the second block */ + int n_errors2, n_bits_total2; + /* MCS-7,8,9 block 1 */ rc = egprs_decode_data(l2_data, c1, cps.mcs, cps.p[0], 0, n_errors, n_bits_total); @@ -991,6 +994,8 @@ /* MCS-7,8,9 block 2 */ rc = egprs_decode_data(l2_data, c2, cps.mcs, cps.p[1], 1, n_errors, n_bits_total); + if (n_errors) *n_errors += n_errors2; + if (n_bits_total) *n_bits_total += n_bits_total2; if (rc < 0) return -EFAULT; } -- To view, visit https://gerrit.osmocom.org/9997 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I560de192212dae4705054a1665726369b83d213a Gerrit-Change-Number: 9997 Gerrit-PatchSet: 1 Gerrit-Owner: Alexander Chemeris
Change in libosmocore[master]: coding: Fix (E)GPRS BER calculation to correctly account for puncturing.
Alexander Chemeris has uploaded this change for review. ( https://gerrit.osmocom.org/9994 Change subject: coding: Fix (E)GPRS BER calculation to correctly account for puncturing. .. coding: Fix (E)GPRS BER calculation to correctly account for puncturing. Previously we didn't take into account puncturing and BER was always around 30% for GPRS/EDGE bursts because of they use puncturing coding unlike "classical" GSM bursts. Change-Id: I9da22e7051522d06d923fcec3b63cbed8db93910 --- M src/coding/gsm0503_coding.c 1 file changed, 24 insertions(+), 5 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/94/9994/1 diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 215cc6d..1d06adb 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -528,16 +528,18 @@ }, }; -/*! Convolutional Decode + compute BER +/*! Convolutional Decode + compute BER for punctured codes * \param[in] code Description of Convolutional Code * \param[in] input Input soft-bits (-127...127) * \param[out] output bits * \param[out] n_errors Number of bit-errors * \param[out] n_bits_total Number of bits + * \param[in] data_punc Puncturing mask array. Can be NULL. */ -static int osmo_conv_decode_ber(const struct osmo_conv_code *code, +static int osmo_conv_decode_ber_punctured(const struct osmo_conv_code *code, const sbit_t *input, ubit_t *output, - int *n_errors, int *n_bits_total) + int *n_errors, int *n_bits_total, + const uint8_t *data_punc) { int res, i, coded_len; ubit_t recoded[EGPRS_DATA_C_MAX]; @@ -553,7 +555,8 @@ if (n_errors) { *n_errors = 0; for (i = 0; i < coded_len; i++) { - if (!((recoded[i] && input[i] < 0) || + if (((!data_punc) || (data_punc && !data_punc[i])) && + !((recoded[i] && input[i] < 0) || (!recoded[i] && input[i] > 0)) ) *n_errors += 1; } @@ -565,6 +568,21 @@ return res; } +/*! Convolutional Decode + compute BER for non-punctured codes + * \param[in] code Description of Convolutional Code + * \param[in] input Input soft-bits (-127...127) + * \param[out] output bits + * \param[out] n_errors Number of bit-errors + * \param[out] n_bits_total Number of bits + */ +static int osmo_conv_decode_ber(const struct osmo_conv_code *code, + const sbit_t *input, ubit_t *output, + int *n_errors, int *n_bits_total) +{ + return osmo_conv_decode_ber_punctured(code, input, output, + n_errors, n_bits_total, NULL); +} + /*! convenience wrapper for decoding coded bits * \param[out] l2_data caller-allocated buffer for L2 Frame * \param[in] cB 456 coded (soft) bits as per TS 05.03 4.1.3 @@ -884,7 +902,8 @@ C[i] = 0; } - osmo_conv_decode_ber(code->data_conv, C, u, n_errors, n_bits_total); + osmo_conv_decode_ber_punctured(code->data_conv, C, u, + n_errors, n_bits_total, code->data_punc[p]); rc = osmo_crc16gen_check_bits(_mcs_crc12, u, data_len, u + data_len); if (rc) -- To view, visit https://gerrit.osmocom.org/9994 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I9da22e7051522d06d923fcec3b63cbed8db93910 Gerrit-Change-Number: 9994 Gerrit-PatchSet: 1 Gerrit-Owner: Alexander Chemeris
Change in libosmocore[master]: coding: Always initialize bit counters in gsm0503_pdtch_egprs_decode().
Alexander Chemeris has uploaded this change for review. ( https://gerrit.osmocom.org/9996 Change subject: coding: Always initialize bit counters in gsm0503_pdtch_egprs_decode(). .. coding: Always initialize bit counters in gsm0503_pdtch_egprs_decode(). Previsouly there were a lot of valid code paths which returned from the function before setting bit counters which led to bogus BER output in osmo-bts-trx logs when those code paths were hit. Change-Id: I4722cae3794ccbb12001113c991d9cf345a52a96 --- M src/coding/gsm0503_coding.c 1 file changed, 3 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/96/9996/1 diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 2eb8cba..6be4001 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -938,6 +938,9 @@ struct egprs_cps cps; union gprs_rlc_ul_hdr_egprs *hdr; + if (n_errors) *n_errors = 0; + if (n_bits_total) *n_bits_total = 0; + if ((nbits != GSM0503_GPRS_BURSTS_NBITS) && (nbits != GSM0503_EGPRS_BURSTS_NBITS)) { /* Invalid EGPRS bit length */ -- To view, visit https://gerrit.osmocom.org/9996 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I4722cae3794ccbb12001113c991d9cf345a52a96 Gerrit-Change-Number: 9996 Gerrit-PatchSet: 1 Gerrit-Owner: Alexander Chemeris
Change in libosmocore[master]: coding: Documentation typo fix.
Alexander Chemeris has uploaded this change for review. ( https://gerrit.osmocom.org/9995 Change subject: coding: Documentation typo fix. .. coding: Documentation typo fix. Change-Id: I6ca873b3decaf50e7b79b5ab2269919c862a4fe0 --- M src/coding/gsm0503_coding.c 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/95/9995/1 diff --git a/src/coding/gsm0503_coding.c b/src/coding/gsm0503_coding.c index 1d06adb..2eb8cba 100644 --- a/src/coding/gsm0503_coding.c +++ b/src/coding/gsm0503_coding.c @@ -927,7 +927,7 @@ * \param[in] nbits number of bits in \a bursts * \param usf_p unused argument ?!? * \param[out] n_errors number of detected bit-errors - * \param[out] n_bits_total total number of dcoded bits + * \param[out] n_bits_total total number of decoded bits * \returns 0 on success; negative on error */ int gsm0503_pdtch_egprs_decode(uint8_t *l2_data, const sbit_t *bursts, uint16_t nbits, uint8_t *usf_p, int *n_errors, int *n_bits_total) -- To view, visit https://gerrit.osmocom.org/9995 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: newchange Gerrit-Change-Id: I6ca873b3decaf50e7b79b5ab2269919c862a4fe0 Gerrit-Change-Number: 9995 Gerrit-PatchSet: 1 Gerrit-Owner: Alexander Chemeris
Change in osmo-msc[master]: libmsc/gsm_09_11.c: introduce counter for active sessions
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/9745 ) Change subject: libmsc/gsm_09_11.c: introduce counter for active sessions .. Patch Set 1: > > I wonder if it's possible to split SS from USSD but that's a > minor issue. > > Unfortunately, this is impossible because we don't parse the > GSM 04.80 payload of Facility IE in OsmoMSC. Should be possible > in OsmoHLR meanwhile ;) I see. Please add it to OsmoHLR when you get to that point! -- To view, visit https://gerrit.osmocom.org/9745 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ia17e7c747fffb5267d3ca5bc4193c1be4a57ef3a Gerrit-Change-Number: 9745 Gerrit-PatchSet: 1 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Comment-Date: Tue, 26 Jun 2018 13:00:51 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-msc[master]: libmsc/gsm_09_11.c: introduce counter for active sessions
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/9745 ) Change subject: libmsc/gsm_09_11.c: introduce counter for active sessions .. Patch Set 1: Code-Review+1 Looks great! I wonder if it's possible to split SS from USSD but that's a minor issue. -- To view, visit https://gerrit.osmocom.org/9745 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ia17e7c747fffb5267d3ca5bc4193c1be4a57ef3a Gerrit-Change-Number: 9745 Gerrit-PatchSet: 1 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Comment-Date: Tue, 26 Jun 2018 12:24:44 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in osmo-msc[master]: libmsc/gsm_09_11.c: introduce rate counters for NC_SS sessions
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/9711 ) Change subject: libmsc/gsm_09_11.c: introduce rate counters for NC_SS sessions .. Patch Set 1: I don't think something can be deprecated until there is a replacement? So it's either not deprecated, or there is another way to do this I assume. Let's wait for Harald to clarify. -- To view, visit https://gerrit.osmocom.org/9711 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I23c9475abc9951d82f3342fdc5aaa367836f7741 Gerrit-Change-Number: 9711 Gerrit-PatchSet: 1 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Comment-Date: Sat, 23 Jun 2018 09:51:01 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-msc[master]: libmsc/gsm_09_11.c: introduce rate counters for NC_SS sessions
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/9711 ) Change subject: libmsc/gsm_09_11.c: introduce rate counters for NC_SS sessions .. Patch Set 1: Is there a counter which shows a number of currently active SS/USSD connections? I.e. active at the moment of querying. That's an important metric. -- To view, visit https://gerrit.osmocom.org/9711 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I23c9475abc9951d82f3342fdc5aaa367836f7741 Gerrit-Change-Number: 9711 Gerrit-PatchSet: 1 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Comment-Date: Fri, 22 Jun 2018 21:57:58 + Gerrit-HasComments: No Gerrit-HasLabels: No
Change in osmo-msc[master]: libmsc/gsm_09_11.c: properly handle MS-initiated release
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/9703 ) Change subject: libmsc/gsm_09_11.c: properly handle MS-initiated release .. Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/9703 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: I76fc277bf9db614a97824b1541cd5bb75aa3e29d Gerrit-Change-Number: 9703 Gerrit-PatchSet: 1 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Jenkins Builder Gerrit-Comment-Date: Fri, 22 Jun 2018 21:58:37 + Gerrit-HasComments: No Gerrit-HasLabels: Yes
Change in libosmocore[master]: GSUP: introduce new messages for SS/USSD payloads
Alexander Chemeris has posted comments on this change. ( https://gerrit.osmocom.org/7600 ) Change subject: GSUP: introduce new messages for SS/USSD payloads .. Patch Set 5: (1 comment) https://gerrit.osmocom.org/#/c/7600/5/tests/gsup/gsup_test.c File tests/gsup/gsup_test.c: https://gerrit.osmocom.org/#/c/7600/5/tests/gsup/gsup_test.c@323 PS5, Line 323: maximal s/maximal/maximum/ -- To view, visit https://gerrit.osmocom.org/7600 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-MessageType: comment Gerrit-Change-Id: Ie17a78043a35fffbdd59e80fd2b2da39cce5e532 Gerrit-Change-Number: 7600 Gerrit-PatchSet: 5 Gerrit-Owner: Vadim Yanitskiy Gerrit-Reviewer: Alexander Chemeris Gerrit-Reviewer: Harald Welte Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr Gerrit-Reviewer: Vadim Yanitskiy Gerrit-Comment-Date: Wed, 30 May 2018 22:28:57 + Gerrit-HasComments: Yes Gerrit-HasLabels: No
osmo-trx[master]: doc: examples: Add umtrx sample config
Patch Set 1: Yes, Pau is correct. -- To view, visit https://gerrit.osmocom.org/7890 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id38de0bbbe75e5e6bbb0de2eecb7d1984786d528 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: ttsou <t...@tsou.cc> Gerrit-HasComments: No
osmo-trx[master]: doc: examples: Add umtrx sample config
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/7890/1/doc/examples/osmo-trx-umtrx.cfg File doc/examples/osmo-trx-umtrx.cfg: Line 22: chan 1 > Well, this way let's have the following: If this enforces an "antenna" (in UHD terms) then you should not do that because (1) it's not correct and (2) antennas are selected correctly by default. -- To view, visit https://gerrit.osmocom.org/7890 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id38de0bbbe75e5e6bbb0de2eecb7d1984786d528 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: ttsou <t...@tsou.cc> Gerrit-HasComments: Yes
osmo-trx[master]: doc: examples: Add umtrx sample config
Patch Set 1: Code-Review+1 Looks good to me. -- To view, visit https://gerrit.osmocom.org/7890 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id38de0bbbe75e5e6bbb0de2eecb7d1984786d528 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: ttsou <t...@tsou.cc> Gerrit-HasComments: No
osmo-trx[master]: doc: examples: Add umtrx sample config
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/7890/1/doc/examples/osmo-trx-umtrx.cfg File doc/examples/osmo-trx-umtrx.cfg: Line 22: chan 1 Am I correct that this enables dual-channel mode same as the old "-c 2" command line option? -- To view, visit https://gerrit.osmocom.org/7890 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Id38de0bbbe75e5e6bbb0de2eecb7d1984786d528 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: Yes
osmo-msc[master]: Delete expired SMS automatically.
Patch Set 2: Just curious - have validity time calculation been fixed in mainline? I remember my patches for it have not been merged when i looked into it several months ago. -- To view, visit https://gerrit.osmocom.org/5996 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I56cbe716e52b679c4b94f6cbb4a171306975be2e Gerrit-PatchSet: 2 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: Stefan Sperling <ssperl...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: expose the gsm0480_parse_ss_facility_ie()
Patch Set 9: I don't remember off the top of my head. If it's not used in OpenBSC or in the SIP proxy, then I guess this is not required. -- To view, visit https://gerrit.osmocom.org/3381 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I35d3360f36c48eb1295610ab96ff264c45af77eb Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
osmo-trx[master]: tests: convolve: Disable due to difference in output in diff...
Patch Set 1: I think you should send an e-mail to the mailing list, as not everyone is reading Gerrit. I've stumbled upon this patch completely accidentally and I haven't seen any discussions. -- To view, visit https://gerrit.osmocom.org/5817 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2320309bc8c1c20e2de6ef2e0f17472c68de80cb Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: fixeria <axilira...@gmail.com> Gerrit-Reviewer: ttsou <t...@tsou.cc> Gerrit-HasComments: No
osmo-trx[master]: Remove unneeded libdl dependency
Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/5819 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I0caea2a2a8e6bd07432fd73bae72b42b1ce022cd Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmo-trx[master]: tests: convolve: Disable due to difference in output in diff...
Patch Set 1: Code-Review-1 I don't think to disable it is a good idea. Why not improve it? I think Thomas Tsou and/or Vadim had suggestions how to do that. -- To view, visit https://gerrit.osmocom.org/5817 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2320309bc8c1c20e2de6ef2e0f17472c68de80cb Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: handle GSM0480_CTYPE_RETURN_RESULT
Patch Set 9: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3378 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: clean up the parse_process_uss_req() code
Patch Set 9: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88 Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
Patch Set 9: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 9 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: fix USSD OCTET STRING length confusion
Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/5712 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6dead74f9ecea079752ff2400cdaf7c30187784e Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
libosmocore[master]: gsm0480: handle UnstructuredSS Request with DSC != 0x0F
Patch Set 8: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3376 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I73d602f6f20b0afe7600d16bbd432069ae7be788 Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: clean up the parse_process_uss_req() code
Patch Set 8: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88 Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: skip length check for 'RELEASE COMPLETE' message
Patch Set 8: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3373 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I63b7f8ce403169a9dbdbdb031db16693de2196d6 Gerrit-PatchSet: 8 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-HasComments: No
libosmocore[master]: gsm0480: fix USSD OCTET STRING length confusion
Patch Set 5: Code-Review+1 Looks good now -- To view, visit https://gerrit.osmocom.org/5712 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6dead74f9ecea079752ff2400cdaf7c30187784e Gerrit-PatchSet: 5 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
pysim[master]: pySim-prog: Replace magic numbers with a readable EF file name.
Patch Set 2: Verified+1 -- To view, visit https://gerrit.osmocom.org/5720 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ibda7d5a4132971e884f6d760baf20cd33025a2af Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
[MERGED] pysim[master]: Add methods to get ATR for a card or a link.
Alexander Chemeris has submitted this change and it was merged. Change subject: Add methods to get ATR for a card or a link. .. Add methods to get ATR for a card or a link. Implemented for both serial and PCSC readers. Change-Id: Ic12e4b115d24a8b7e483a5603dd6cec90ad289cc --- M pySim/commands.py M pySim/transport/pcsc.py M pySim/transport/serial.py 3 files changed, 19 insertions(+), 2 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim/commands.py b/pySim/commands.py index 777dd24..eba915c 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -31,6 +31,9 @@ self._cla_byte = "a0" self.sel_ctrl = "" + def get_atr(self): + return self._tp.get_atr() + @property def cla_byte(self): return self._cla_byte diff --git a/pySim/transport/pcsc.py b/pySim/transport/pcsc.py index dc040c5..47c4185 100644 --- a/pySim/transport/pcsc.py +++ b/pySim/transport/pcsc.py @@ -56,6 +56,9 @@ except NoCardException: raise NoCardError() + def get_atr(self): + return self._con.getATR() + def disconnect(self): self._con.disconnect() diff --git a/pySim/transport/serial.py b/pySim/transport/serial.py index 825c458..5b15b2f 100644 --- a/pySim/transport/serial.py +++ b/pySim/transport/serial.py @@ -46,6 +46,7 @@ ) self._rst_pin = rst self._debug = debug + self._atr = None def __del__(self): self._sl.close() @@ -91,6 +92,9 @@ def connect(self): self.reset_card() + def get_atr(self): + return self._atr + def disconnect(self): pass # Nothing to do really ... @@ -102,6 +106,7 @@ raise ProtocolError() def _reset_card(self): + self._atr = None rst_meth_map = { 'rts': self._sl.setRTS, 'dtr': self._sl.setDTR, @@ -133,18 +138,24 @@ return -1 t0 = ord(b) self._dbg_print("T0: 0x%x" % t0) + self._atr = [0x3b, ord(b)] for i in range(4): if t0 & (0x10 << i): - self._dbg_print("T%si = %x" % (chr(ord('A')+i), ord(self._rx_byte( + b = self._rx_byte() + self._atr.apend(ord(b)) + self._dbg_print("T%si = %x" % (chr(ord('A')+i), ord(b))) for i in range(0, t0 & 0xf): - self._dbg_print("Historical = %x" % ord(self._rx_byte())) + b = self._rx_byte() + self._atr.apend(ord(b)) + self._dbg_print("Historical = %x" % ord(b)) while True: x = self._rx_byte() if not x: break + self._atr.apend(ord(x)) self._dbg_print("Extra: %x" % ord(x)) return 1 -- To view, visit https://gerrit.osmocom.org/5717 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ic12e4b115d24a8b7e483a5603dd6cec90ad289cc Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
[MERGED] pysim[master]: Make derive_milenage_opc and calculate_luhn publicly availab...
Alexander Chemeris has submitted this change and it was merged. Change subject: Make derive_milenage_opc and calculate_luhn publicly available through utils.py .. Make derive_milenage_opc and calculate_luhn publicly available through utils.py Change-Id: I2effc85fd55da0981de0ada74dcb28b7e8e56a01 --- M pySim-prog.py M pySim/utils.py 2 files changed, 22 insertions(+), 19 deletions(-) Approvals: Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim-prog.py b/pySim-prog.py index 44ca1fd..c08f43b 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -39,7 +39,7 @@ from pySim.commands import SimCardCommands from pySim.cards import _cards_classes -from pySim.utils import h2b, swap_nibbles, rpad +from pySim.utils import h2b, swap_nibbles, rpad, derive_milenage_opc, calculate_luhn def parse_options(): @@ -233,24 +233,6 @@ out.append(chr(x)) return ''.join(out) - -def calculate_luhn(cc): - num = map(int, str(cc)) - check_digit = 10 - sum(num[-2::-2] + [sum(divmod(d * 2, 10)) for d in num[::-2]]) % 10 - return 0 if check_digit == 10 else check_digit - -def derive_milenage_opc(ki_hex, op_hex): - """ - Run the milenage algorithm. - """ - from Crypto.Cipher import AES - from Crypto.Util.strxor import strxor - from pySim.utils import b2h - - # We pass in hex string and now need to work on bytes - aes = AES.new(h2b(ki_hex)) - opc_bytes = aes.encrypt(h2b(op_hex)) - return b2h(strxor(opc_bytes, h2b(op_hex))) def gen_parameters(opts): """Generates Name, ICCID, MCC, MNC, IMSI, SMSP, Ki, PIN-ADM from the diff --git a/pySim/utils.py b/pySim/utils.py index 43d52dd..17dc693 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -92,3 +92,24 @@ if hplmn_disp: byte1 = byte1|0x01 if oplmn_disp: byte1 = byte1|0x02 return i2h([byte1])+s2h(name) + +def derive_milenage_opc(ki_hex, op_hex): + """ + Run the milenage algorithm to calculate OPC from Ki and OP + """ + from Crypto.Cipher import AES + from Crypto.Util.strxor import strxor + from pySim.utils import b2h + + # We pass in hex string and now need to work on bytes + aes = AES.new(h2b(ki_hex)) + opc_bytes = aes.encrypt(h2b(op_hex)) + return b2h(strxor(opc_bytes, h2b(op_hex))) + +def calculate_luhn(cc): + """ + Calculate Luhn checksum used in e.g. ICCID and IMEI + """ + num = map(int, str(cc)) + check_digit = 10 - sum(num[-2::-2] + [sum(divmod(d * 2, 10)) for d in num[::-2]]) % 10 + return 0 if check_digit == 10 else check_digit -- To view, visit https://gerrit.osmocom.org/5745 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2effc85fd55da0981de0ada74dcb28b7e8e56a01 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
[MERGED] pysim[master]: cards: Implement card type autodetection based on ATR.
Alexander Chemeris has submitted this change and it was merged. Change subject: cards: Implement card type autodetection based on ATR. .. cards: Implement card type autodetection based on ATR. Change-Id: I1099a96626c0ce74243b47a8fdfa25b0d76a1ef3 --- M pySim/cards.py 1 file changed, 21 insertions(+), 2 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim/cards.py b/pySim/cards.py index db63d2b..046766e 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -25,6 +25,7 @@ from pySim.ts_51_011 import EF, DF from pySim.utils import * +from smartcard.util import toBytes class Card(object): @@ -418,7 +419,12 @@ @classmethod def autodetect(kls, scc): - # TODO: look for ATR 3B 7D 94 00 00 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68 + try: + # Look for ATR + if scc.get_atr() == toBytes("3B 7D 94 00 00 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68"): + return kls(scc) + except: + return None return None def program(self, p): @@ -494,7 +500,12 @@ @classmethod def autodetect(kls, scc): - # TODO: look for ATR 3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5 + try: + # Look for ATR + if scc.get_atr() == toBytes("3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5"): + return kls(scc) + except: + return None return None def program(self, p): @@ -537,3 +548,11 @@ # In order for autodetection ... _cards_classes = [ FakeMagicSim, SuperSim, MagicSim, GrcardSim, SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1 ] + +def card_autodetect(scc): + for kls in _cards_classes: + card = kls.autodetect(scc) + if card is not None: + card.reset() + return card + return None -- To view, visit https://gerrit.osmocom.org/5721 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I1099a96626c0ce74243b47a8fdfa25b0d76a1ef3 Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
[MERGED] pysim[master]: pySim-prog: ADM code can be longer 8 digits, it's implementa...
Alexander Chemeris has submitted this change and it was merged. Change subject: pySim-prog: ADM code can be longer 8 digits, it's implementation specific. .. pySim-prog: ADM code can be longer 8 digits, it's implementation specific. E.g. Fairwaves SIM cards have longer ADM codes. Change-Id: I87d61764eeba4bcf7525ee4778cb8f244930db9b --- M pySim-prog.py 1 file changed, 3 insertions(+), 4 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim-prog.py b/pySim-prog.py index 728949e..2177d8c 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -379,10 +379,9 @@ opc = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]) if opts.pin_adm is not None: - if len(opts.pin_adm) > 8: - raise ValueError("PIN-ADM needs to be <=8 digits") - pin_adm = ''.join(['%02x'%(ord(x)) for x in opts.pin_adm]) - pin_adm = rpad(pin_adm, 16) + pin_adm = opts.pin_adm + if not re.match('^([0-9a-fA-F][0-9a-fA-F])+$', pin_adm): + raise ValueError('ADM pin needs to be in hex format (even number of hex digits)') else: pin_adm = None -- To view, visit https://gerrit.osmocom.org/5719 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I87d61764eeba4bcf7525ee4778cb8f244930db9b Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
[MERGED] pysim[master]: cards: Add Fairwaves SIM implementation.
Alexander Chemeris has submitted this change and it was merged. Change subject: cards: Add Fairwaves SIM implementation. .. cards: Add Fairwaves SIM implementation. Change-Id: Ia10ac433d3b0482bdf727c31f65a10042152797b --- M pySim/cards.py 1 file changed, 145 insertions(+), 2 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim/cards.py b/pySim/cards.py index 046766e..e324857 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -539,15 +539,158 @@ r = self._scc.select_file(['3f00', '7f10']) data, sw = self._scc.update_record('6f42', 1, lpad(p['smsp'], 104), force_len=True) + def erase(self): + return + + +class FairwavesSIM(Card): + """ + FairwavesSIM + + The SIM card is operating according to the standard. + For Ki/OP/OPC programming the following files are additionally open for writing: + 3F00/7F20/FF01 – OP/OPC: + byte 1 = 0x01, bytes 2-17: OPC; + byte 1 = 0x00, bytes 2-17: OP; + 3F00/7F20/FF02: Ki + """ + + name = 'Fairwaves SIM' + # Propriatary files + _EF_num = { + 'Ki': 'FF02', + 'OP/OPC': 'FF01', + } + _EF = { + 'Ki': DF['GSM']+[_EF_num['Ki']], + 'OP/OPC': DF['GSM']+[_EF_num['OP/OPC']], + } + + def __init__(self, ssc): + super(FairwavesSIM, self).__init__(ssc) + self._adm_chv_num = 0x11 + self._adm2_chv_num = 0x12 + + + @classmethod + def autodetect(kls, scc): + try: + # Look for ATR + if scc.get_atr() == toBytes("3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 44 22 06 10 00 00 01 A9"): + return kls(scc) + except: + return None + return None + + + def verify_adm2(self, key): + ''' + Authenticate with ADM2 key. + + Fairwaves SIM cards support hierarchical key structure and ADM2 key + is a key which has access to proprietary files (Ki and OP/OPC). + That said, ADM key inherits permissions of ADM2 key and thus we rarely + need ADM2 key per se. + ''' + (res, sw) = self._scc.verify_chv(self._adm2_chv_num, key) + return sw + + + def read_ki(self): + """ + Read Ki in proprietary file. + + Requires ADM1 access level + """ + return self._scc.read_binary(self._EF['Ki']) + + + def update_ki(self, ki): + """ + Set Ki in proprietary file. + + Requires ADM1 access level + """ + data, sw = self._scc.update_binary(self._EF['Ki'], ki) + return sw + + + def read_op_opc(self): + """ + Read Ki in proprietary file. + + Requires ADM1 access level + """ + (ef, sw) = self._scc.read_binary(self._EF['OP/OPC']) + type = 'OP' if ef[0:2] == '00' else 'OPC' + return ((type, ef[2:]), sw) + + + def update_op(self, op): + """ + Set OP in proprietary file. + + Requires ADM1 access level + """ + content = '00' + op + data, sw = self._scc.update_binary(self._EF['OP/OPC'], content) + return sw + + + def update_opc(self, opc): + """ + Set OPC in proprietary file. + + Requires ADM1 access level + """ + content = '01' + opc + data, sw = self._scc.update_binary(self._EF['OP/OPC'], content) + return sw + + + def program(self, p): + # authenticate as ADM1 + if not p['pin_adm']: + raise ValueError("Please provide a PIN-ADM as there is no default one") + sw = self.verify_adm(h2b(p['pin_adm'])) + if sw != '9000': + raise RuntimeError('Failed to authenticate with ADM key %s'%(p['pin_adm'],)) + + # TODO: Set operator name + if p.get('smsp') is not None: + sw = self.update_smsp(p['smsp']) + if sw != '9000': + print("Programming SMSP failed with code %s"%sw) + # This SIM doesn't support changing ICCID + if p.get('
pysim[master]: cards: Implement card type autodetection based on ATR.
Patch Set 2: Verified+1 -- To view, visit https://gerrit.osmocom.org/5721 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1099a96626c0ce74243b47a8fdfa25b0d76a1ef3 Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
[MERGED] pysim[master]: cards: Extend Card class with access functions for some of t...
Alexander Chemeris has submitted this change and it was merged. Change subject: cards: Extend Card class with access functions for some of the standard EF files. .. cards: Extend Card class with access functions for some of the standard EF files. Change-Id: Icb7227fa7ebc837fccab456cbfad529f6ee81a28 --- M pySim/cards.py 1 file changed, 67 insertions(+), 2 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim/cards.py b/pySim/cards.py index 9f678ab..db63d2b 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -7,6 +7,7 @@ # # Copyright (C) 2009-2010 Sylvain Munaut <t...@246tnt.com> # Copyright (C) 2011 Harald Welte <lafo...@gnumonks.org> +# Copyright (C) 2017 Alexander.Chemeris <alexander.cheme...@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,17 +23,81 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -from pySim.utils import b2h, h2b, swap_nibbles, rpad, lpad, enc_imsi, enc_iccid, enc_plmn - +from pySim.ts_51_011 import EF, DF +from pySim.utils import * class Card(object): def __init__(self, scc): self._scc = scc + self._adm_chv_num = 4 def reset(self): self._scc.reset_card() + def verify_adm(self, key): + ''' + Authenticate with ADM key + ''' + (res, sw) = self._scc.verify_chv(self._adm_chv_num, key) + return sw + + def read_iccid(self): + (res, sw) = self._scc.read_binary(EF['ICCID']) + if sw == '9000': + return (dec_iccid(res), sw) + else: + return (None, sw) + + def read_imsi(self): + (res, sw) = self._scc.read_binary(EF['IMSI']) + if sw == '9000': + return (dec_imsi(res), sw) + else: + return (None, sw) + + def update_imsi(self, imsi): + data, sw = self._scc.update_binary(EF['IMSI'], enc_imsi(imsi)) + return sw + + def update_acc(self, acc): + data, sw = self._scc.update_binary(EF['ACC'], lpad(acc, 4)) + return sw + + def update_hplmn_act(self, mcc, mnc, access_tech=''): + """ + Update Home PLMN with access technology bit-field + + See Section "10.3.37 EFHPLMNwAcT (HPLMN Selector with Access Technology)" + in ETSI TS 151 011 for the details of the access_tech field coding. + Some common values: + access_tech = '0080' # Only GSM is selected + access_tech = '' # All technologues selected, even Reserved for Future Use ones + """ + # get size and write EF.HPLMNwAcT + r = self._scc.select_file(EF['HPLMNwAcT']) + size = int(r[-1][4:8], 16) + hplmn = enc_plmn(mcc, mnc) + content = hplmn + access_tech + data, sw = self._scc.update_binary(EF['HPLMNwAcT'], content + 'ff' * (size/5-1)) + return sw + + def update_smsp(self, smsp): + data, sw = self._scc.update_record(EF['SMSP'], 1, rpad(smsp, 84)) + return sw + + def read_spn(self): + (spn, sw) = self._scc.read_binary(EF['SPN']) + if sw == '9000': + return (dec_spn(spn), sw) + else: + return (None, sw) + + def update_spn(self, name, hplmn_disp=False, oplmn_disp=False): + content = enc_spn(name, hplmn_disp, oplmn_disp) + data, sw = self._scc.update_binary(EF['SPN'], rpad(content, 32)) + return sw + class _MagicSimBase(Card): """ -- To view, visit https://gerrit.osmocom.org/5718 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Icb7227fa7ebc837fccab456cbfad529f6ee81a28 Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
pysim[master]: Make derive_milenage_opc and calculate_luhn publicly availab...
Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/5745 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2effc85fd55da0981de0ada74dcb28b7e8e56a01 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-HasComments: No
[MERGED] pysim[master]: pySim-prog: Replace magic numbers with a readable EF file name.
Alexander Chemeris has submitted this change and it was merged. Change subject: pySim-prog: Replace magic numbers with a readable EF file name. .. pySim-prog: Replace magic numbers with a readable EF file name. Change-Id: Ibda7d5a4132971e884f6d760baf20cd33025a2af --- M pySim-prog.py 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim-prog.py b/pySim-prog.py index 2177d8c..44ca1fd 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -618,7 +618,7 @@ # Connect transport print "Insert card now (or CTRL-C to cancel)" sl.wait_for_card(newcardonly=not first) - (res,_) = scc.read_binary(['3f00', '7f20', '6f07']) + (res,_) = scc.read_binary(EF['IMSI']) imsi = swap_nibbles(res)[3:] else: imsi = opts.imsi -- To view, visit https://gerrit.osmocom.org/5720 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ibda7d5a4132971e884f6d760baf20cd33025a2af Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
pysim[master]: Add methods to get ATR for a card or a link.
Patch Set 2: Verified+1 -- To view, visit https://gerrit.osmocom.org/5717 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic12e4b115d24a8b7e483a5603dd6cec90ad289cc Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
pysim[master]: cards: Extend Card class with access functions for some of t...
Patch Set 2: Verified+1 -- To view, visit https://gerrit.osmocom.org/5718 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icb7227fa7ebc837fccab456cbfad529f6ee81a28 Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
pysim[master]: utils: Fix documentation. 3+3=6 digits equals 3 bytes, not 6
Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/5716 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I2722d788a69976e1c64a9caf6cf3049af27f9a30 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
[MERGED] pysim[master]: utils: Functions to encode/decode EF SPN.
Alexander Chemeris has submitted this change and it was merged. Change subject: utils: Functions to encode/decode EF SPN. .. utils: Functions to encode/decode EF SPN. According to TS 51 011. Change-Id: Ida184bc5c81cc8c228b8981b703f77d017e53334 --- M pySim/utils.py 1 file changed, 19 insertions(+), 0 deletions(-) Approvals: Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim/utils.py b/pySim/utils.py index 84b613f..8463581 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -34,6 +34,12 @@ def i2h(s): return ''.join(['%02x'%(x) for x in s]) +def h2s(s): + return ''.join([chr((int(x,16)<<4)+int(y,16)) for x,y in zip(s[0::2], s[1::2]) if not (x == 'f' and y == 'f') ]) + +def s2h(s): + return b2h(s) + def swap_nibbles(s): return ''.join([x+y for x,y in zip(s[1::2], s[0::2])]) @@ -73,3 +79,16 @@ def enc_plmn(mcc, mnc): """Converts integer MCC/MNC into 6 bytes for EF""" return swap_nibbles(lpad('%d' % mcc, 3) + lpad('%d' % mnc, 3)) + +def dec_spn(ef): + byte1 = int(ef[0:2]) + hplmn_disp = (byte1&0x01 == 0x01) + oplmn_disp = (byte1&0x02 == 0x02) + name = h2s(ef[2:]) + return (name, hplmn_disp, oplmn_disp) + +def enc_spn(name, hplmn_disp=False, oplmn_disp=False): + byte1 = 0x00 + if hplmn_disp: byte1 = byte1|0x01 + if oplmn_disp: byte1 = byte1|0x02 + return i2h([byte1])+s2h(name) -- To view, visit https://gerrit.osmocom.org/5715 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: Ida184bc5c81cc8c228b8981b703f77d017e53334 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
[MERGED] pysim[master]: utils: Fix documentation. 3+3=6 digits equals 3 bytes, not 6
Alexander Chemeris has submitted this change and it was merged. Change subject: utils: Fix documentation. 3+3=6 digits equals 3 bytes, not 6 .. utils: Fix documentation. 3+3=6 digits equals 3 bytes, not 6 Change-Id: I2722d788a69976e1c64a9caf6cf3049af27f9a30 --- M pySim/utils.py 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim/utils.py b/pySim/utils.py index 8463581..43d52dd 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -77,7 +77,7 @@ return swap_nibbles(rpad(iccid, 20)) def enc_plmn(mcc, mnc): - """Converts integer MCC/MNC into 6 bytes for EF""" + """Converts integer MCC/MNC into 3 bytes for EF""" return swap_nibbles(lpad('%d' % mcc, 3) + lpad('%d' % mnc, 3)) def dec_spn(ef): -- To view, visit https://gerrit.osmocom.org/5716 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2722d788a69976e1c64a9caf6cf3049af27f9a30 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
pysim[master]: utils: Functions to encode/decode EF SPN.
Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/5715 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ida184bc5c81cc8c228b8981b703f77d017e53334 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-HasComments: No
pysim[master]: ts_51_011: A file with MF/DF/EF constants from TS 51 011
Patch Set 1: Verified+1 -- To view, visit https://gerrit.osmocom.org/5714 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I38f5d36d16b41b5d516a6a3e2ec1d09637883932 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
[MERGED] pysim[master]: ts_51_011: A file with MF/DF/EF constants from TS 51 011
Alexander Chemeris has submitted this change and it was merged. Change subject: ts_51_011: A file with MF/DF/EF constants from TS 51 011 .. ts_51_011: A file with MF/DF/EF constants from TS 51 011 pySim has been using magic numbers to access various files which makes it hard to read, maintain and extend. With this file in place we can start replacing all those magic numbers with human readable names lile EF['IMSI'] instead of ['3F00', '7F20', '6F07']. Change-Id: I38f5d36d16b41b5d516a6a3e2ec1d09637883932 --- A pySim/ts_51_011.py 1 file changed, 251 insertions(+), 0 deletions(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Alexander Chemeris: Verified Harald Welte: Looks good to me, approved diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py new file mode 100644 index 000..754d57f --- /dev/null +++ b/pySim/ts_51_011.py @@ -0,0 +1,251 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" Various constants from ETSI TS 151.011 +""" + +# +# Copyright (C) 2017 Alexander.Chemeris <alexander.cheme...@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +MF_num = '3F00' + +DF_num = { +'TELECOM': '7F10', + +'GSM': '7F20', +'IS-41': '7F22', +'FP-CTS': '7F23', + +'GRAPHICS': '5F50', + +'IRIDIUM': '5F30', +'GLOBST': '5F31', +'ICO': '5F32', +'ACeS': '5F33', + +'EIA/TIA-553': '5F40', +'CTS': '5F60', +'SOLSA': '5F70', + +'MExE': '5F3C', +} + +EF_num = { +# MF +'ICCID': '2FE2', +'ELP': '2F05', + +# DF_TELECOM +'ADN': '6F3A', +'FDN': '6F3B', +'SMS': '6F3C', +'CCP': '6F3D', +'MSISDN': '6F40', +'SMSP': '6F42', +'SMSS': '6F43', +'LND': '6F44', +'SMSR': '6F47', +'SDN': '6F49', +'EXT1': '6F4A', +'EXT2': '6F4B', +'EXT3': '6F4C', +'BDN': '6F4D', +'EXT4': '6F4E', +'CMI': '6F58', +'ECCP': '6F4F', + +# DF_GRAPHICS +'IMG': '4F20', + +# DF_SoLSA +'SAI': '4F30', +'SLL': '4F31', + +# DF_MExE +'MExE-ST': '4F40', +'ORPK': '4F41', +'ARPK': '4F42', +'TPRPK': '4F43', + +# DF_GSM +'LP': '6F05', +'IMSI': '6F07', +'Kc': '6F20', +'DCK': '6F2C', +'PLMNsel': '6F30', +'HPPLMN': '6F31', +'CNL': '6F32', +'ACMmax': '6F37', +'SST': '6F38', +'ACM': '6F39', +'GID1': '6F3E', +'GID2': '6F3F', +'PUCT': '6F41', +'CBMI': '6F45', +'SPN': '6F46', +'CBMID': '6F48', +'BCCH': '6F74', +'ACC': '6F78', +'FPLMN': '6F7B', +'LOCI': '6F7E', +'AD': '6FAD', +'PHASE': '6FAE', +'VGCS': '6FB1', +'VGCSS': '6FB2', +'VBS': '6FB3', +'VBSS': '6FB4', +'eMLPP': '6FB5', +'AAeM': '6FB6', +'ECC': '6FB7', +'CBMIR': '6F50', +'NIA': '6F51', +'KcGPRS': '6F52', +'LOCIGPRS': '6F53', +'SUME': '6F54', +'PLMNwAcT': '6F60', +'OPLMNwAcT': '6F61', +# Figure 8 names it HPLMNAcT, but in the text it's names it HPLMNwAcT +'HPLMNAcT': '6F62', +'HPLMNwAcT': '6F62', +'CPBCCH': '6F63', +'INVSCAN': '6F64', +'PNN': '6FC5', +'OPL': '6FC6', +'MBDN': '6FC7', +'EXT6': '6FC8', +'MBI': '6FC9', +'MWIS': '6FCA', +'CFIS': '6FCB', +'EXT7': '6FCC', +'SPDI': '6FCD', +'MMSN': '6FCE', +'EXT8': '6FCF', +'MMSICP': '6FD0', +'MMSUP': '6FD1', +'MMSUCP': '6FD2', +} + +DF = { +'TELECOM': [MF_num, DF_num['TELECOM']], + +'GSM': [MF_num, DF_num['GSM']], +'IS-41':[MF_num, DF_num['IS-41']], +'FP-CTS': [MF_num, DF_num['FP-CTS']], + +'GRAPHICS': [MF_num, DF_num['GRAPHICS']], + +'IRIDIUM': [MF_num, DF_num['IRIDIUM']], +'GLOBST': [MF_num, DF_num['GLOBST']], +'ICO': [MF_num, DF_num['ICO']], +'ACeS': [MF_num, DF_num['ACeS']], + +'EIA/TIA-553': [MF_num, DF_num['EIA/TIA-553']], +'CTS': [MF_num, DF_num['CTS']], +'SoLSA':[MF_num, DF_num['SOLSA']], + +'MExE': [MF_num, DF_num['MExE']], +} + + +EF = { +'ICCID': [MF_num, EF_num['ICCID']], +'ELP':[MF_num, EF_num['ELP']], + +'ADN':DF['TELECOM']+[EF_num['ADN']], +'FDN':DF['TELECOM']+[EF_num['FDN']], +'SMS':DF['TELECOM']+[EF_num['SMS']], +'CCP':DF['TELECOM']+[EF_num['CCP']], +'MSISDN': DF['TELECOM']+[EF_num['MSISDN']], +'SMSP': DF['TELECOM']+[EF_num['SMSP']], +'SMSS': DF['TELECOM']+[EF_num['SMSS']], +'LND':DF['TELECOM']+[EF_num['LND']], +'SMSR': DF['TELECOM']+[EF_num['SMSR']], +'SDN':DF['TELECOM']+[EF_num['SDN']], +'EXT1': DF['TELECOM']+[EF_num['EXT1']], +'EXT2': DF['TELECOM']+[EF_num['EXT2']], +'EXT3': DF['TELECOM']+[EF_num['EXT3']], +'BDN':DF['TELECOM']+[EF_num['BDN']], +'EXT4': DF['TELECOM']+[EF_num['EXT4']], +'CMI':DF['TELECOM']+[EF_num['CMI'
[MERGED] pysim[master]: Fix comment: Ki -> OPC
Alexander Chemeris has submitted this change and it was merged. Change subject: Fix comment: Ki -> OPC .. Fix comment: Ki -> OPC Change-Id: I566cf7bc658c730b4381c0f145bfc4f805cca42a --- M pySim-prog.py 1 file changed, 1 insertion(+), 1 deletion(-) Approvals: Vadim Yanitskiy: Looks good to me, but someone else must approve Harald Welte: Looks good to me, approved; Verified diff --git a/pySim-prog.py b/pySim-prog.py index 3df18ba..728949e 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -367,7 +367,7 @@ else: ki = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]) - # Ki (random) + # OPC (random) if opts.opc is not None: opc = opts.opc if not re.match('^[0-9a-fA-F]{32}$', opc): -- To view, visit https://gerrit.osmocom.org/5713 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I566cf7bc658c730b4381c0f145bfc4f805cca42a Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
libosmocore[master]: gsm0480: modify USSD structures to support external handling
Patch Set 4: Code-Review+1 Sorry,missed that patch -- To view, visit https://gerrit.osmocom.org/3374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
libosmocore[master]: gsm0480: increase the MAX_LEN_USSD_STRING to 182
Patch Set 3: Code-Review-1 Please move the description of this calculation from the commit message to a comment. It should be easily understood when you browse the code. -- To view, visit https://gerrit.osmocom.org/5712 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6dead74f9ecea079752ff2400cdaf7c30187784e Gerrit-PatchSet: 3 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
[PATCH] pysim[master]: Checking in pySim-fairwaves-prog.py utility.
Review at https://gerrit.osmocom.org/5746 Checking in pySim-fairwaves-prog.py utility. This utility is an example utility for programming Fairwaves SIM cards. The original pySim-prog.py utility is already bloated with features and is difficult to modify so we decided to create a leaner and easier to maintain and modify version. Change-Id: I9f58e1b45d1785d59cef161eab1388332a97936b --- A pySim-fairwaves-prog.py 1 file changed, 272 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/46/5746/1 diff --git a/pySim-fairwaves-prog.py b/pySim-fairwaves-prog.py new file mode 100755 index 000..b709af9 --- /dev/null +++ b/pySim-fairwaves-prog.py @@ -0,0 +1,272 @@ +#!/usr/bin/env python + +# +# Utility to update SPN field of a SIM card +# +# Copyright (C) 2017-2018 Alexander Chemeris <alexander.cheme...@gmail.com> +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# + +from optparse import OptionParser +import os +import sys +import csv +import random + +from pySim.commands import SimCardCommands +from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, derive_milenage_opc +from pySim.cards import card_autodetect + + +def load_sim_db(filename): + sim_db = {} + with open(filename, 'r') as f: + reader = csv.reader(f, delimiter=' ') + # Skip the header + reader.next() + for l in reader: + sim_db[l[0]] = l + return sim_db + +def write_params_csv(filename, sim_keys): + with open(filename, 'a') as f: + cw = csv.writer(f, delimiter=' ') + cw.writerow([x for x in sim_keys]) + + +def program_sim_card(card, sim_db, opts): + # Program the card + print("Reading SIM card ...") + + # EF.ICCID + (iccid, sw) = card.read_iccid() + if sw != '9000': + print("ICCID: Can't read, response code = %s" % (sw,)) + sys.exit(1) + print("ICCID: %s" % (iccid)) + + # Find SIM card keys in the DB + sim_keys = sim_db.get(iccid+'F') + if sim_keys == None: + print("Can't find SIM card in the SIM DB.") + sys.exit(1) + + # EF.IMSI + (imsi, sw) = card.read_imsi() + if sw != '9000': + print("IMSI: Can't read, response code = %s" % (sw,)) + sys.exit(1) + print("IMSI: %s" % (imsi)) + + # EF.SPN + ((name, hplmn_disp, oplmn_disp), sw) = card.read_spn() + if sw == '9000': + print("Service Provider Name:%s" % name) + print(" display for HPLMN %s" % hplmn_disp) + print(" display for other PLMN %s" % oplmn_disp) + else: + print("Old SPN: Can't read, response code = %s" % (sw,)) + + print("Entring ADM code...") + + # Enter ADM code to get access to proprietary files + sw = card.verify_adm(h2b(sim_keys[6])) + if sw != '9000': + print("Fail to verify ADM code with result = %s" % (sw,)) + sys.exit(1) + + # Read EF.Ki + (ki, sw) = card.read_ki() + if sw == '9000': + ki = ki.upper() + print("Ki: %s" % ki) + else: + print("Ki: Can't read, response code = %s" % (sw,)) + + # Read EF.OP/OPC + ((op_opc_type, op_opc), sw) = card.read_op_opc() + if sw == '9000': + op_opc = op_opc.upper() + print("%s: %s" % (op_opc_type, op_opc)) + else: + print("Ki: Can't read, response code = %s" % (sw,)) + + print("Programming...") + + # Update SPN + sw = card.update_spn(opts.name, False, False) + if sw != '9000': + print("SPN: Fail to update with result = %s" % (sw,)) + sys.exit(1) + + # Update Ki + ki = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]).upper() + sim_keys[8] = ki + sw = card.update_ki(sim_keys[8]) + if sw != '9000': + print("Ki: Fail to update with result = %s" % (sw,)) + sys.exit(1) + + # Update
[PATCH] pysim[master]: Make derive_milenage_opc and calculate_luhn publicly availab...
Review at https://gerrit.osmocom.org/5745 Make derive_milenage_opc and calculate_luhn publicly available through utils.py Change-Id: I2effc85fd55da0981de0ada74dcb28b7e8e56a01 --- M pySim-prog.py M pySim/utils.py 2 files changed, 22 insertions(+), 19 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/45/5745/1 diff --git a/pySim-prog.py b/pySim-prog.py index 44ca1fd..c08f43b 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -39,7 +39,7 @@ from pySim.commands import SimCardCommands from pySim.cards import _cards_classes -from pySim.utils import h2b, swap_nibbles, rpad +from pySim.utils import h2b, swap_nibbles, rpad, derive_milenage_opc, calculate_luhn def parse_options(): @@ -233,24 +233,6 @@ out.append(chr(x)) return ''.join(out) - -def calculate_luhn(cc): - num = map(int, str(cc)) - check_digit = 10 - sum(num[-2::-2] + [sum(divmod(d * 2, 10)) for d in num[::-2]]) % 10 - return 0 if check_digit == 10 else check_digit - -def derive_milenage_opc(ki_hex, op_hex): - """ - Run the milenage algorithm. - """ - from Crypto.Cipher import AES - from Crypto.Util.strxor import strxor - from pySim.utils import b2h - - # We pass in hex string and now need to work on bytes - aes = AES.new(h2b(ki_hex)) - opc_bytes = aes.encrypt(h2b(op_hex)) - return b2h(strxor(opc_bytes, h2b(op_hex))) def gen_parameters(opts): """Generates Name, ICCID, MCC, MNC, IMSI, SMSP, Ki, PIN-ADM from the diff --git a/pySim/utils.py b/pySim/utils.py index 43d52dd..17dc693 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -92,3 +92,24 @@ if hplmn_disp: byte1 = byte1|0x01 if oplmn_disp: byte1 = byte1|0x02 return i2h([byte1])+s2h(name) + +def derive_milenage_opc(ki_hex, op_hex): + """ + Run the milenage algorithm to calculate OPC from Ki and OP + """ + from Crypto.Cipher import AES + from Crypto.Util.strxor import strxor + from pySim.utils import b2h + + # We pass in hex string and now need to work on bytes + aes = AES.new(h2b(ki_hex)) + opc_bytes = aes.encrypt(h2b(op_hex)) + return b2h(strxor(opc_bytes, h2b(op_hex))) + +def calculate_luhn(cc): + """ + Calculate Luhn checksum used in e.g. ICCID and IMEI + """ + num = map(int, str(cc)) + check_digit = 10 - sum(num[-2::-2] + [sum(divmod(d * 2, 10)) for d in num[::-2]]) % 10 + return 0 if check_digit == 10 else check_digit -- To view, visit https://gerrit.osmocom.org/5745 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2effc85fd55da0981de0ada74dcb28b7e8e56a01 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
libosmocore[master]: gsm0480: modify USSD structures to support external handling
Patch Set 4: Code-Review-1 Sorry, forgot to ask this: What happened to this change? Do you plan to submit it as a separate patch? > #define MAX_LEN_USSD_STRING 182 -- To view, visit https://gerrit.osmocom.org/3374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
libosmocore[master]: gsm0480: parse GSM0480_MTYPE_FACILITY separately
Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3377 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I6e029c436a50fa8c2823ea39c5d123ee701becfa Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: handle GSM0480_CTYPE_RETURN_RESULT
Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3378 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8fb2856acbbf4c53e7d53200a37bc8f79e763bcf Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: expose the gsm0480_parse_ss_facility_ie()
Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3381 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I35d3360f36c48eb1295610ab96ff264c45af77eb Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
libosmocore[master]: gsm0480: skip length check for 'RELEASE COMPLETE' message
Patch Set 6: Code-Review+1 The code looks proper now. -- To view, visit https://gerrit.osmocom.org/3373 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I63b7f8ce403169a9dbdbdb031db16693de2196d6 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-HasComments: No
libosmocore[master]: gsm0480: modify USSD structures to support external handling
Patch Set 4: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073 Gerrit-PatchSet: 4 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
libosmocore[master]: gsm0480: clean up the parse_process_uss_req() code
Patch Set 6: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3375 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I467f75794c5ac9df75c001245b18bbdfcfaadd88 Gerrit-PatchSet: 6 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
pysim[master]: cards: Add Fairwaves SIM implementation.
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/5722/1/pySim/cards.py File pySim/cards.py: Line 589: > Whitespace... Fixed -- To view, visit https://gerrit.osmocom.org/5722 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ia10ac433d3b0482bdf727c31f65a10042152797b Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: Yes
[PATCH] pysim[master]: cards: Add Fairwaves SIM implementation.
if p.get('imsi') is not None: + sw = self.update_imsi(p['imsi']) + if sw != '9000': + print("Programming IMSI failed with code %s"%sw) + if p.get('ki') is not None: + sw = self.update_ki(p['ki']) + if sw != '9000': + print("Programming Ki failed with code %s"%sw) + if p.get('opc') is not None: + sw = self.update_opc(p['opc']) + if sw != '9000': + print("Programming OPC failed with code %s"%sw) + if p.get('acc') is not None: + sw = self.update_acc(p['acc']) + if sw != '9000': + print("Programming ACC failed with code %s"%sw) def erase(self): return - # In order for autodetection ... _cards_classes = [ FakeMagicSim, SuperSim, MagicSim, GrcardSim, - SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1 ] + SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1, + FairwavesSIM ] def card_autodetect(scc): for kls in _cards_classes: -- To view, visit https://gerrit.osmocom.org/5722 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ia10ac433d3b0482bdf727c31f65a10042152797b Gerrit-PatchSet: 3 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
pysim[master]: Add methods to get ATR for a card or a link.
Patch Set 1: (1 comment) https://gerrit.osmocom.org/#/c/5717/1/pySim/transport/serial.py File pySim/transport/serial.py: Line 94: > Whitespace... Thanks, fixed. -- To view, visit https://gerrit.osmocom.org/5717 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ic12e4b115d24a8b7e483a5603dd6cec90ad289cc Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: Yes
[PATCH] pysim[master]: Add methods to get ATR for a card or a link.
Add methods to get ATR for a card or a link. Implemented for both serial and PCSC readers. Change-Id: Ic12e4b115d24a8b7e483a5603dd6cec90ad289cc --- M pySim/commands.py M pySim/transport/pcsc.py M pySim/transport/serial.py 3 files changed, 19 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/17/5717/2 diff --git a/pySim/commands.py b/pySim/commands.py index 777dd24..eba915c 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -31,6 +31,9 @@ self._cla_byte = "a0" self.sel_ctrl = "" + def get_atr(self): + return self._tp.get_atr() + @property def cla_byte(self): return self._cla_byte diff --git a/pySim/transport/pcsc.py b/pySim/transport/pcsc.py index dc040c5..47c4185 100644 --- a/pySim/transport/pcsc.py +++ b/pySim/transport/pcsc.py @@ -56,6 +56,9 @@ except NoCardException: raise NoCardError() + def get_atr(self): + return self._con.getATR() + def disconnect(self): self._con.disconnect() diff --git a/pySim/transport/serial.py b/pySim/transport/serial.py index 825c458..5b15b2f 100644 --- a/pySim/transport/serial.py +++ b/pySim/transport/serial.py @@ -46,6 +46,7 @@ ) self._rst_pin = rst self._debug = debug + self._atr = None def __del__(self): self._sl.close() @@ -91,6 +92,9 @@ def connect(self): self.reset_card() + def get_atr(self): + return self._atr + def disconnect(self): pass # Nothing to do really ... @@ -102,6 +106,7 @@ raise ProtocolError() def _reset_card(self): + self._atr = None rst_meth_map = { 'rts': self._sl.setRTS, 'dtr': self._sl.setDTR, @@ -133,18 +138,24 @@ return -1 t0 = ord(b) self._dbg_print("T0: 0x%x" % t0) + self._atr = [0x3b, ord(b)] for i in range(4): if t0 & (0x10 << i): - self._dbg_print("T%si = %x" % (chr(ord('A')+i), ord(self._rx_byte( + b = self._rx_byte() + self._atr.apend(ord(b)) + self._dbg_print("T%si = %x" % (chr(ord('A')+i), ord(b))) for i in range(0, t0 & 0xf): - self._dbg_print("Historical = %x" % ord(self._rx_byte())) + b = self._rx_byte() + self._atr.apend(ord(b)) + self._dbg_print("Historical = %x" % ord(b)) while True: x = self._rx_byte() if not x: break + self._atr.apend(ord(x)) self._dbg_print("Extra: %x" % ord(x)) return 1 -- To view, visit https://gerrit.osmocom.org/5717 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: Ic12e4b115d24a8b7e483a5603dd6cec90ad289cc Gerrit-PatchSet: 2 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com>
[PATCH] pysim[master]: pySim-prog: ADM code can be longer 8 digits, it's implementa...
Review at https://gerrit.osmocom.org/5719 pySim-prog: ADM code can be longer 8 digits, it's implementation specific. E.g. Fairwaves SIM cards have longer ADM codes. Change-Id: I87d61764eeba4bcf7525ee4778cb8f244930db9b --- M pySim-prog.py 1 file changed, 3 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/19/5719/1 diff --git a/pySim-prog.py b/pySim-prog.py index 728949e..2177d8c 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -379,10 +379,9 @@ opc = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]) if opts.pin_adm is not None: - if len(opts.pin_adm) > 8: - raise ValueError("PIN-ADM needs to be <=8 digits") - pin_adm = ''.join(['%02x'%(ord(x)) for x in opts.pin_adm]) - pin_adm = rpad(pin_adm, 16) + pin_adm = opts.pin_adm + if not re.match('^([0-9a-fA-F][0-9a-fA-F])+$', pin_adm): + raise ValueError('ADM pin needs to be in hex format (even number of hex digits)') else: pin_adm = None -- To view, visit https://gerrit.osmocom.org/5719 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I87d61764eeba4bcf7525ee4778cb8f244930db9b Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] pysim[master]: cards: Implement card type autodetection based on ATR.
Review at https://gerrit.osmocom.org/5721 cards: Implement card type autodetection based on ATR. Change-Id: I1099a96626c0ce74243b47a8fdfa25b0d76a1ef3 --- M pySim/cards.py 1 file changed, 21 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/21/5721/1 diff --git a/pySim/cards.py b/pySim/cards.py index db63d2b..046766e 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -25,6 +25,7 @@ from pySim.ts_51_011 import EF, DF from pySim.utils import * +from smartcard.util import toBytes class Card(object): @@ -418,7 +419,12 @@ @classmethod def autodetect(kls, scc): - # TODO: look for ATR 3B 7D 94 00 00 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68 + try: + # Look for ATR + if scc.get_atr() == toBytes("3B 7D 94 00 00 55 55 53 0A 74 86 93 0B 24 7C 4D 54 68"): + return kls(scc) + except: + return None return None def program(self, p): @@ -494,7 +500,12 @@ @classmethod def autodetect(kls, scc): - # TODO: look for ATR 3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5 + try: + # Look for ATR + if scc.get_atr() == toBytes("3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5"): + return kls(scc) + except: + return None return None def program(self, p): @@ -537,3 +548,11 @@ # In order for autodetection ... _cards_classes = [ FakeMagicSim, SuperSim, MagicSim, GrcardSim, SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1 ] + +def card_autodetect(scc): + for kls in _cards_classes: + card = kls.autodetect(scc) + if card is not None: + card.reset() + return card + return None -- To view, visit https://gerrit.osmocom.org/5721 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I1099a96626c0ce74243b47a8fdfa25b0d76a1ef3 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] pysim[master]: pySim-prog: Replace magic numbers with a readable EF file name.
Review at https://gerrit.osmocom.org/5720 pySim-prog: Replace magic numbers with a readable EF file name. Change-Id: Ibda7d5a4132971e884f6d760baf20cd33025a2af --- M pySim-prog.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/20/5720/1 diff --git a/pySim-prog.py b/pySim-prog.py index 2177d8c..44ca1fd 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -618,7 +618,7 @@ # Connect transport print "Insert card now (or CTRL-C to cancel)" sl.wait_for_card(newcardonly=not first) - (res,_) = scc.read_binary(['3f00', '7f20', '6f07']) + (res,_) = scc.read_binary(EF['IMSI']) imsi = swap_nibbles(res)[3:] else: imsi = opts.imsi -- To view, visit https://gerrit.osmocom.org/5720 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ibda7d5a4132971e884f6d760baf20cd33025a2af Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] pysim[master]: cards: Add Fairwaves SIM implementation.
MCC/MNC failed with code %s"%sw) + if p.get('imsi') is not None: + sw = self.update_imsi(p['imsi']) + if sw != '9000': + print("Programming IMSI failed with code %s"%sw) + if p.get('ki') is not None: + sw = self.update_ki(p['ki']) + if sw != '9000': + print("Programming Ki failed with code %s"%sw) + if p.get('opc') is not None: + sw = self.update_opc(p['opc']) + if sw != '9000': + print("Programming OPC failed with code %s"%sw) + if p.get('acc') is not None: + sw = self.update_acc(p['acc']) + if sw != '9000': + print("Programming ACC failed with code %s"%sw) def erase(self): return - # In order for autodetection ... _cards_classes = [ FakeMagicSim, SuperSim, MagicSim, GrcardSim, - SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1 ] + SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1, + FairwavesSIM ] def card_autodetect(scc): for kls in _cards_classes: -- To view, visit https://gerrit.osmocom.org/5722 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia10ac433d3b0482bdf727c31f65a10042152797b Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] pysim[master]: utils: Functions to encode/decode EF SPN.
Review at https://gerrit.osmocom.org/5715 utils: Functions to encode/decode EF SPN. According to TS 51 011. Change-Id: Ida184bc5c81cc8c228b8981b703f77d017e53334 --- M pySim/utils.py 1 file changed, 19 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/15/5715/1 diff --git a/pySim/utils.py b/pySim/utils.py index 84b613f..8463581 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -34,6 +34,12 @@ def i2h(s): return ''.join(['%02x'%(x) for x in s]) +def h2s(s): + return ''.join([chr((int(x,16)<<4)+int(y,16)) for x,y in zip(s[0::2], s[1::2]) if not (x == 'f' and y == 'f') ]) + +def s2h(s): + return b2h(s) + def swap_nibbles(s): return ''.join([x+y for x,y in zip(s[1::2], s[0::2])]) @@ -73,3 +79,16 @@ def enc_plmn(mcc, mnc): """Converts integer MCC/MNC into 6 bytes for EF""" return swap_nibbles(lpad('%d' % mcc, 3) + lpad('%d' % mnc, 3)) + +def dec_spn(ef): + byte1 = int(ef[0:2]) + hplmn_disp = (byte1&0x01 == 0x01) + oplmn_disp = (byte1&0x02 == 0x02) + name = h2s(ef[2:]) + return (name, hplmn_disp, oplmn_disp) + +def enc_spn(name, hplmn_disp=False, oplmn_disp=False): + byte1 = 0x00 + if hplmn_disp: byte1 = byte1|0x01 + if oplmn_disp: byte1 = byte1|0x02 + return i2h([byte1])+s2h(name) -- To view, visit https://gerrit.osmocom.org/5715 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ida184bc5c81cc8c228b8981b703f77d017e53334 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] pysim[master]: utils: Fix documentation. 3+3=6 digits equals 3 bytes, not 6
Review at https://gerrit.osmocom.org/5716 utils: Fix documentation. 3+3=6 digits equals 3 bytes, not 6 Change-Id: I2722d788a69976e1c64a9caf6cf3049af27f9a30 --- M pySim/utils.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/16/5716/1 diff --git a/pySim/utils.py b/pySim/utils.py index 8463581..43d52dd 100644 --- a/pySim/utils.py +++ b/pySim/utils.py @@ -77,7 +77,7 @@ return swap_nibbles(rpad(iccid, 20)) def enc_plmn(mcc, mnc): - """Converts integer MCC/MNC into 6 bytes for EF""" + """Converts integer MCC/MNC into 3 bytes for EF""" return swap_nibbles(lpad('%d' % mcc, 3) + lpad('%d' % mnc, 3)) def dec_spn(ef): -- To view, visit https://gerrit.osmocom.org/5716 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2722d788a69976e1c64a9caf6cf3049af27f9a30 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] pysim[master]: cards: Extend Card class with access functions for some of t...
Review at https://gerrit.osmocom.org/5718 cards: Extend Card class with access functions for some of the standard EF files. Change-Id: Icb7227fa7ebc837fccab456cbfad529f6ee81a28 --- M pySim/cards.py 1 file changed, 67 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/18/5718/1 diff --git a/pySim/cards.py b/pySim/cards.py index 9f678ab..db63d2b 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -7,6 +7,7 @@ # # Copyright (C) 2009-2010 Sylvain Munaut <t...@246tnt.com> # Copyright (C) 2011 Harald Welte <lafo...@gnumonks.org> +# Copyright (C) 2017 Alexander.Chemeris <alexander.cheme...@gmail.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -22,17 +23,81 @@ # along with this program. If not, see <http://www.gnu.org/licenses/>. # -from pySim.utils import b2h, h2b, swap_nibbles, rpad, lpad, enc_imsi, enc_iccid, enc_plmn - +from pySim.ts_51_011 import EF, DF +from pySim.utils import * class Card(object): def __init__(self, scc): self._scc = scc + self._adm_chv_num = 4 def reset(self): self._scc.reset_card() + def verify_adm(self, key): + ''' + Authenticate with ADM key + ''' + (res, sw) = self._scc.verify_chv(self._adm_chv_num, key) + return sw + + def read_iccid(self): + (res, sw) = self._scc.read_binary(EF['ICCID']) + if sw == '9000': + return (dec_iccid(res), sw) + else: + return (None, sw) + + def read_imsi(self): + (res, sw) = self._scc.read_binary(EF['IMSI']) + if sw == '9000': + return (dec_imsi(res), sw) + else: + return (None, sw) + + def update_imsi(self, imsi): + data, sw = self._scc.update_binary(EF['IMSI'], enc_imsi(imsi)) + return sw + + def update_acc(self, acc): + data, sw = self._scc.update_binary(EF['ACC'], lpad(acc, 4)) + return sw + + def update_hplmn_act(self, mcc, mnc, access_tech=''): + """ + Update Home PLMN with access technology bit-field + + See Section "10.3.37 EFHPLMNwAcT (HPLMN Selector with Access Technology)" + in ETSI TS 151 011 for the details of the access_tech field coding. + Some common values: + access_tech = '0080' # Only GSM is selected + access_tech = '' # All technologues selected, even Reserved for Future Use ones + """ + # get size and write EF.HPLMNwAcT + r = self._scc.select_file(EF['HPLMNwAcT']) + size = int(r[-1][4:8], 16) + hplmn = enc_plmn(mcc, mnc) + content = hplmn + access_tech + data, sw = self._scc.update_binary(EF['HPLMNwAcT'], content + 'ff' * (size/5-1)) + return sw + + def update_smsp(self, smsp): + data, sw = self._scc.update_record(EF['SMSP'], 1, rpad(smsp, 84)) + return sw + + def read_spn(self): + (spn, sw) = self._scc.read_binary(EF['SPN']) + if sw == '9000': + return (dec_spn(spn), sw) + else: + return (None, sw) + + def update_spn(self, name, hplmn_disp=False, oplmn_disp=False): + content = enc_spn(name, hplmn_disp, oplmn_disp) + data, sw = self._scc.update_binary(EF['SPN'], rpad(content, 32)) + return sw + class _MagicSimBase(Card): """ -- To view, visit https://gerrit.osmocom.org/5718 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icb7227fa7ebc837fccab456cbfad529f6ee81a28 Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] pysim[master]: Fix comment: Ki -> OPC
Review at https://gerrit.osmocom.org/5713 Fix comment: Ki -> OPC Change-Id: I566cf7bc658c730b4381c0f145bfc4f805cca42a --- M pySim-prog.py 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/13/5713/1 diff --git a/pySim-prog.py b/pySim-prog.py index 3df18ba..728949e 100755 --- a/pySim-prog.py +++ b/pySim-prog.py @@ -367,7 +367,7 @@ else: ki = ''.join(['%02x' % random.randrange(0,256) for i in range(16)]) - # Ki (random) + # OPC (random) if opts.opc is not None: opc = opts.opc if not re.match('^[0-9a-fA-F]{32}$', opc): -- To view, visit https://gerrit.osmocom.org/5713 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I566cf7bc658c730b4381c0f145bfc4f805cca42a Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] pysim[master]: Add methods to get ATR for a card or a link.
Review at https://gerrit.osmocom.org/5717 Add methods to get ATR for a card or a link. Implemented for both serial and PCSC readers. Change-Id: Ic12e4b115d24a8b7e483a5603dd6cec90ad289cc --- M pySim/commands.py M pySim/transport/pcsc.py M pySim/transport/serial.py 3 files changed, 19 insertions(+), 2 deletions(-) git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/17/5717/1 diff --git a/pySim/commands.py b/pySim/commands.py index 777dd24..eba915c 100644 --- a/pySim/commands.py +++ b/pySim/commands.py @@ -31,6 +31,9 @@ self._cla_byte = "a0" self.sel_ctrl = "" + def get_atr(self): + return self._tp.get_atr() + @property def cla_byte(self): return self._cla_byte diff --git a/pySim/transport/pcsc.py b/pySim/transport/pcsc.py index dc040c5..47c4185 100644 --- a/pySim/transport/pcsc.py +++ b/pySim/transport/pcsc.py @@ -56,6 +56,9 @@ except NoCardException: raise NoCardError() + def get_atr(self): + return self._con.getATR() + def disconnect(self): self._con.disconnect() diff --git a/pySim/transport/serial.py b/pySim/transport/serial.py index 825c458..c0b5b54 100644 --- a/pySim/transport/serial.py +++ b/pySim/transport/serial.py @@ -46,6 +46,7 @@ ) self._rst_pin = rst self._debug = debug + self._atr = None def __del__(self): self._sl.close() @@ -90,6 +91,9 @@ def connect(self): self.reset_card() + + def get_atr(self): + return self._atr def disconnect(self): pass # Nothing to do really ... @@ -102,6 +106,7 @@ raise ProtocolError() def _reset_card(self): + self._atr = None rst_meth_map = { 'rts': self._sl.setRTS, 'dtr': self._sl.setDTR, @@ -133,18 +138,24 @@ return -1 t0 = ord(b) self._dbg_print("T0: 0x%x" % t0) + self._atr = [0x3b, ord(b)] for i in range(4): if t0 & (0x10 << i): - self._dbg_print("T%si = %x" % (chr(ord('A')+i), ord(self._rx_byte( + b = self._rx_byte() + self._atr.apend(ord(b)) + self._dbg_print("T%si = %x" % (chr(ord('A')+i), ord(b))) for i in range(0, t0 & 0xf): - self._dbg_print("Historical = %x" % ord(self._rx_byte())) + b = self._rx_byte() + self._atr.apend(ord(b)) + self._dbg_print("Historical = %x" % ord(b)) while True: x = self._rx_byte() if not x: break + self._atr.apend(ord(x)) self._dbg_print("Extra: %x" % ord(x)) return 1 -- To view, visit https://gerrit.osmocom.org/5717 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ic12e4b115d24a8b7e483a5603dd6cec90ad289cc Gerrit-PatchSet: 1 Gerrit-Project: pysim Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
osmo-trx[master]: UHDDevice.cpp: add USRP B205mini support
Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/5150 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iee575121248ea541f7abc49055e49ec2d30904c0 Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmo-bts[master]: osmo-bts-trx: Fix reported frame number during PRIM_INFO_MEAS
Patch Set 3: Code-Review+1 I don't have equipment right now to test this, but the code looks good on the first glance. Just one comment - is this requirement of sending the first frame number documented in the parameters of the relevant functions? That would be great to have it there to avoid mistakes in future. -- To view, visit https://gerrit.osmocom.org/5136 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1065ae9c400bb5240a63ab8213aee59aeb9ceeff Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: dexter <pma...@sysmocom.de> Gerrit-HasComments: No
openbsc[master]: libmsc: db_subscriber_alloc_exten() remove infinite loop
Patch Set 5: Code-Review-1 (1 comment) We hit this issue in one of our installations, so I'm glad to see a work to resolve this. In that case though, we just increased the length of the automatically generated extensions to make sure they never overflow. https://gerrit.osmocom.org/#/c/3910/5/openbsc/src/libmsc/db.c File openbsc/src/libmsc/db.c: Line 1425: "WHERE extension IS NOT NULL"); This way of counting will give wrong results when you have a mix of automatically assigned extension numbers and manually assigned ones (with a different length) like we have in some of our installations. You can probably limit the SELECT here to extensions of a given length or between MIN and MAX to make this more robust. -- To view, visit https://gerrit.osmocom.org/3910 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Icf0f1e5a7f360bc27592a55890f74a9a12bc9f42 Gerrit-PatchSet: 5 Gerrit-Project: openbsc Gerrit-Branch: master Gerrit-Owner: Keith Whyte <ke...@rhizomatica.org> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Keith Whyte <ke...@rhizomatica.org> Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-Reviewer: Pablo Neira Ayuso <pa...@gnumonks.org> Gerrit-HasComments: Yes
libosmocore[master]: gsm0480: modify USSD structures to support external handling
Patch Set 2: > I thought the idea was to use TODO-RELEASE file to track API/ABI > breakage until release. I've documented it here > https://osmocom.org/projects/cellular-infrastructure/wiki/Make_a_new_release Looks like a good option to me -- To view, visit https://gerrit.osmocom.org/3374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
libosmocore[master]: gsm0480: modify USSD structures to support external handling
Patch Set 2: > Hi Harald, > > Sorry for late response. Regarding to the ABI / API breaking > problem, > we have discussed suggested solution with Alexander: adding an > 'osmo' > prefix that is currently missed for exposed symbols would be great. We may want to change the structure again in near future, e.g. to allow partial message decoding. So I think there should be a more long term sustainable way than adding prefixes. I think incrementing minor library version is a recommended way for libraries? Harald - your input would be greatly appreciated. -- To view, visit https://gerrit.osmocom.org/3374 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I5f8972b86cd4dcb54b643a24b5794a87c8758073 Gerrit-PatchSet: 2 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Ivan Kluchnikov <kluchnik...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Vadim Yanitskiy <axilira...@gmail.com> Gerrit-HasComments: No
osmo-msc[master]: libmsc: Fix VTY output for handover counters.
Patch Set 1: I've received a ping about this patch, but I don't think I need to do anything here. Please let me know if you need anything -- To view, visit https://gerrit.osmocom.org/3614 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9512330f2e91d2f526751c5228e6e8e0fe17d579 Gerrit-PatchSet: 1 Gerrit-Project: osmo-msc Gerrit-Branch: master Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de> Gerrit-HasComments: No
osmo-bts[master]: osmo-bts-trx: remove global variables from loops
Patch Set 2: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3601 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I01d7c1abad67e51b886a4ecf2de072929d67da27 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max <msur...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msur...@sysmocom.de> Gerrit-HasComments: No
[MERGED] osmo-bts[master]: Fix static build of osmo-bts-trx and osmo-bts-virtual.
Alexander Chemeris has submitted this change and it was merged. Change subject: Fix static build of osmo-bts-trx and osmo-bts-virtual. .. Fix static build of osmo-bts-trx and osmo-bts-virtual. New libosmocore has some plugin system which requires dlopen(). So we need to make sure we always link with libdl, even when building statically. Note that this doesn't fix static build of tests - they are still failing with some errors. Change-Id: I8315d6e032e34528def268a49fd88d07bc06ab2e --- M src/osmo-bts-trx/Makefile.am M src/osmo-bts-virtual/Makefile.am 2 files changed, 2 insertions(+), 2 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bts-trx/Makefile.am b/src/osmo-bts-trx/Makefile.am index 8676685..0a97251 100644 --- a/src/osmo-bts-trx/Makefile.am +++ b/src/osmo-bts-trx/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR) AM_CFLAGS = -Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOCODEC_CFLAGS) $(LIBOSMOCODING_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(ORTP_CFLAGS) -LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) $(LIBOSMOCODING_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOCTRL_LIBS) $(ORTP_LIBS) +LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOCODEC_LIBS) $(LIBOSMOCODING_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOCTRL_LIBS) $(ORTP_LIBS) -ldl EXTRA_DIST = trx_if.h l1_if.h loops.h diff --git a/src/osmo-bts-virtual/Makefile.am b/src/osmo-bts-virtual/Makefile.am index 30069d4..d1f05af 100644 --- a/src/osmo-bts-virtual/Makefile.am +++ b/src/osmo-bts-virtual/Makefile.am @@ -1,6 +1,6 @@ AM_CFLAGS = -Wall -fno-strict-aliasing $(LIBOSMOCORE_CFLAGS) $(LIBOSMOGSM_CFLAGS) $(LIBOSMOVTY_CFLAGS) $(LIBOSMOTRAU_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(LIBOSMOCTRL_CFLAGS) $(LIBOSMOABIS_CFLAGS) $(LIBGPS_CFLAGS) $(ORTP_CFLAGS) AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(OPENBSC_INCDIR) -Iinclude -COMMON_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOCTRL_LIBS) $(ORTP_LIBS) +COMMON_LDADD = $(LIBOSMOCORE_LIBS) $(LIBOSMOGSM_LIBS) $(LIBOSMOVTY_LIBS) $(LIBOSMOTRAU_LIBS) $(LIBOSMOABIS_LIBS) $(LIBOSMOCTRL_LIBS) $(ORTP_LIBS) -ldl noinst_HEADERS = l1_if.h osmo_mcast_sock.h virtual_um.h -- To view, visit https://gerrit.osmocom.org/3552 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I8315d6e032e34528def268a49fd88d07bc06ab2e Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder
osmo-bts[master]: Fix static build of osmo-bts-trx and osmo-bts-virtual.
Patch Set 1: > I'm not sure what's "new" about it? dlopen() has been introduced into > libosmocore in 2010: Not sure. May be somehow it wasn't used previously and was optimized out by the linker and now it's used? Frankly I haven't looked at the reasons - I just noticed that it was building fine previously and now it requires -ldl. -- To view, visit https://gerrit.osmocom.org/3552 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I8315d6e032e34528def268a49fd88d07bc06ab2e Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmo-bts[master]: osmo-bts-trx: Increase a maximum allowed MS power reduction ...
Patch Set 3: > you mention 2dB here, but your change seems to change it from 2 to 4dB ? Thank you! That's clearly a typo. Fixed in the new patch. -- To view, visit https://gerrit.osmocom.org/3562 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I58785513e5739474b881ed7f2a312ecc690e7e60 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[PATCH] osmo-bts[master]: osmo-bts-trx: Increase a maximum allowed MS power reduction ...
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3562 to look at the new patch set (#3). osmo-bts-trx: Increase a maximum allowed MS power reduction step from 2dB to 4dB. We tend to start MS with high power to make sure distant phones get good QoS, but this also means that we need to reduce their power rather quickly. OTOH we can't make this step too high because this may lead to power output oscillation. From my (manual, limited) testing 4dB looks like a reasonable compromise. Change-Id: I58785513e5739474b881ed7f2a312ecc690e7e60 --- M src/osmo-bts-trx/loops.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/62/3562/3 diff --git a/src/osmo-bts-trx/loops.h b/src/osmo-bts-trx/loops.h index 613d2d0..c0458c5 100644 --- a/src/osmo-bts-trx/loops.h +++ b/src/osmo-bts-trx/loops.h @@ -7,7 +7,7 @@ /* how much power levels do we raise/lower as maximum (1 level = 2 dB) */ #define MS_RAISE_MAX 4 -#define MS_LOWER_MAX 1 +#define MS_LOWER_MAX 2 /* * loops api -- To view, visit https://gerrit.osmocom.org/3562 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58785513e5739474b881ed7f2a312ecc690e7e60 Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder
[PATCH] osmo-bts[master]: osmo-bts-trx: Increase a maximum allowed MS power reduction ...
Hello Jenkins Builder, I'd like you to reexamine a change. Please visit https://gerrit.osmocom.org/3562 to look at the new patch set (#2). osmo-bts-trx: Increase a maximum allowed MS power reduction step from 2dB to 4dB. We tend to start MS with high power to make sure distant phones get good QoS, but this also means that we need to reduce their power rather quickly. OTOH we can't make this step too high because this may lead to power output oscillation. From my (manual, limited) testing 4dB look like a reasonable compromise. Change-Id: I58785513e5739474b881ed7f2a312ecc690e7e60 --- M src/osmo-bts-trx/loops.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/62/3562/2 diff --git a/src/osmo-bts-trx/loops.h b/src/osmo-bts-trx/loops.h index 613d2d0..c0458c5 100644 --- a/src/osmo-bts-trx/loops.h +++ b/src/osmo-bts-trx/loops.h @@ -7,7 +7,7 @@ /* how much power levels do we raise/lower as maximum (1 level = 2 dB) */ #define MS_RAISE_MAX 4 -#define MS_LOWER_MAX 1 +#define MS_LOWER_MAX 2 /* * loops api -- To view, visit https://gerrit.osmocom.org/3562 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newpatchset Gerrit-Change-Id: I58785513e5739474b881ed7f2a312ecc690e7e60 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder
[MERGED] osmo-bts[master]: osmo-bts-trx: Remove an unused variable. Resolves a compiler...
Alexander Chemeris has submitted this change and it was merged. Change subject: osmo-bts-trx: Remove an unused variable. Resolves a compiler warning. .. osmo-bts-trx: Remove an unused variable. Resolves a compiler warning. Change-Id: I2464e872f81021cbc3ccbc4e2e32c394d6afcf70 --- M src/osmo-bts-trx/loops.c 1 file changed, 0 insertions(+), 4 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bts-trx/loops.c b/src/osmo-bts-trx/loops.c index 8d6e5d7..3da805c 100644 --- a/src/osmo-bts-trx/loops.c +++ b/src/osmo-bts-trx/loops.c @@ -251,7 +251,6 @@ struct gsm_bts_trx *trx = l1t->trx; struct gsm_lchan *lchan = >ts[L1SAP_CHAN2TS(chan_nr)] .lchan[l1sap_chan2ss(chan_nr)]; - int c_i; /* check if loop is enabled */ if (!chan_state->amr_loop) @@ -276,9 +275,6 @@ /* calculate average (reuse ber variable) */ ber = chan_state->ber_sum / chan_state->ber_num; - - /* FIXME: calculate C/I from BER */ - c_i = ber * 100; /* reset bit errors */ chan_state->ber_num = 0; -- To view, visit https://gerrit.osmocom.org/3561 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I2464e872f81021cbc3ccbc4e2e32c394d6afcf70 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder
osmo-bts[master]: osmo-bts-trx: Fix MS power control loop.
Patch Set 2: > Please also see http://osmocom.org/issues/1851 and > http://osmocom.org/issues/1622 in this context Thanks for pointing! I didn't realize we don't even follow the standard.. -- To view, visit https://gerrit.osmocom.org/3560 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
[MERGED] osmo-bts[master]: osmo-bts-trx: Fix MS power control loop.
Alexander Chemeris has submitted this change and it was merged. Change subject: osmo-bts-trx: Fix MS power control loop. .. osmo-bts-trx: Fix MS power control loop. The following two commits from 2014-12-06 introduced a new variable to control MS power - ms_power_ctrl, but kept the old ms_power variable in place. They have also changed the meaning of the ms_power variable - it now keeps original RSL configured value. So when much later osmo-trx-bts code was merged to master the code was compiling fine and this change in the meaning was overlooked. In osmo-bts: 579651bf300de002731dfd3bd39985c9fd15616c power/sysmobts: Add a manual ms power level control In OpenBSC: f6f86b0eec18da165db136b14bf2db87fde4b4ac osmo-bts: Introduce new struct for a power loop in the BTS code Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1 --- M src/osmo-bts-trx/l1_if.c M src/osmo-bts-trx/loops.c 2 files changed, 12 insertions(+), 12 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index f69e587..c629a61 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -509,7 +509,7 @@ LOGP(DMEAS, LOGL_DEBUG, "RX L1 frame %s fn=%u chan_nr=0x%02x MS pwr=%ddBm rssi=%.1f dBFS " "ber=%.2f%% (%d/%d bits) L1_ta=%d rqd_ta=%d toa=%.2f\n", - gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power), + gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.current), rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], lchan->rqd_ta, toa); l1if_fill_meas_res(, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn); diff --git a/src/osmo-bts-trx/loops.c b/src/osmo-bts-trx/loops.c index 8070e80..8d6e5d7 100644 --- a/src/osmo-bts-trx/loops.c +++ b/src/osmo-bts-trx/loops.c @@ -48,7 +48,7 @@ uint16_t arfcn = trx->arfcn; int8_t new_power; - new_power = lchan->ms_power - (diff >> 1); + new_power = lchan->ms_power_ctrl.current - (diff >> 1); if (diff == 0) return 0; @@ -66,12 +66,12 @@ } /* a higher value means a lower level (and vice versa) */ - if (new_power > lchan->ms_power + MS_LOWER_MAX) - new_power = lchan->ms_power + MS_LOWER_MAX; - else if (new_power < lchan->ms_power - MS_RAISE_MAX) - new_power = lchan->ms_power - MS_RAISE_MAX; + if (new_power > lchan->ms_power_ctrl.current + MS_LOWER_MAX) + new_power = lchan->ms_power_ctrl.current + MS_LOWER_MAX; + else if (new_power < lchan->ms_power_ctrl.current - MS_RAISE_MAX) + new_power = lchan->ms_power_ctrl.current - MS_RAISE_MAX; - if (lchan->ms_power == new_power) { + if (lchan->ms_power_ctrl.current == new_power) { LOGP(DLOOP, LOGL_INFO, "Keeping MS new_power of trx=%u " "chan_nr=0x%02x at control level %d (%d dBm)\n", trx->nr, chan_nr, new_power, @@ -83,11 +83,11 @@ LOGP(DLOOP, LOGL_INFO, "%s MS new_power of trx=%u chan_nr=0x%02x from " "control level %d (%d dBm) to %d (%d dBm)\n", (diff > 0) ? "Raising" : "Lowering", - trx->nr, chan_nr, lchan->ms_power, - MS_PWR_DBM(arfcn, lchan->ms_power), new_power, + trx->nr, chan_nr, lchan->ms_power_ctrl.current, + MS_PWR_DBM(arfcn, lchan->ms_power_ctrl.current), new_power, MS_PWR_DBM(arfcn, new_power)); - lchan->ms_power = new_power; + lchan->ms_power_ctrl.current = new_power; return 0; } @@ -159,8 +159,8 @@ /* change RSSI */ LOGP(DLOOP, LOGL_DEBUG, "Lowest RSSI: %d Target RSSI: %d Current " "MS power: %d (%d dBm) of trx=%u chan_nr=0x%02x\n", rssi, - trx_target_rssi, lchan->ms_power, - MS_PWR_DBM(trx->arfcn, lchan->ms_power), + trx_target_rssi, lchan->ms_power_ctrl.current, + MS_PWR_DBM(trx->arfcn, lchan->ms_power_ctrl.current), trx->nr, chan_nr); ms_power_diff(lchan, chan_nr, trx_target_rssi - rssi); -- To view, visit https://gerrit.osmocom.org/3560 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1 Gerrit-PatchSet: 2 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder
[PATCH] osmo-bts[master]: osmo-bts-trx: Increase a maximum allowed MS power reduction ...
Review at https://gerrit.osmocom.org/3562 osmo-bts-trx: Increase a maximum allowed MS power reduction step from 2dB to 4dB. We tend to start MS with high power to make sure distant phones get good QoS, but this also means that we need to reduce their power rather quickly. OTOH we can't make this step too high because this may lead to power output oscilation. From my (manual, limited) testing 2dB look like a reasonable compromise. Change-Id: I58785513e5739474b881ed7f2a312ecc690e7e60 --- M src/osmo-bts-trx/loops.h 1 file changed, 1 insertion(+), 1 deletion(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/62/3562/1 diff --git a/src/osmo-bts-trx/loops.h b/src/osmo-bts-trx/loops.h index 613d2d0..c0458c5 100644 --- a/src/osmo-bts-trx/loops.h +++ b/src/osmo-bts-trx/loops.h @@ -7,7 +7,7 @@ /* how much power levels do we raise/lower as maximum (1 level = 2 dB) */ #define MS_RAISE_MAX 4 -#define MS_LOWER_MAX 1 +#define MS_LOWER_MAX 2 /* * loops api -- To view, visit https://gerrit.osmocom.org/3562 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I58785513e5739474b881ed7f2a312ecc690e7e60 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] osmo-bts[master]: osmo-bts-trx: Remove an unused variable. Resolves a compiler...
Review at https://gerrit.osmocom.org/3561 osmo-bts-trx: Remove an unused variable. Resolves a compiler warning. Change-Id: I2464e872f81021cbc3ccbc4e2e32c394d6afcf70 --- M src/osmo-bts-trx/loops.c 1 file changed, 0 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/61/3561/1 diff --git a/src/osmo-bts-trx/loops.c b/src/osmo-bts-trx/loops.c index 8070e80..5710049 100644 --- a/src/osmo-bts-trx/loops.c +++ b/src/osmo-bts-trx/loops.c @@ -251,7 +251,6 @@ struct gsm_bts_trx *trx = l1t->trx; struct gsm_lchan *lchan = >ts[L1SAP_CHAN2TS(chan_nr)] .lchan[l1sap_chan2ss(chan_nr)]; - int c_i; /* check if loop is enabled */ if (!chan_state->amr_loop) @@ -276,9 +275,6 @@ /* calculate average (reuse ber variable) */ ber = chan_state->ber_sum / chan_state->ber_num; - - /* FIXME: calculate C/I from BER */ - c_i = ber * 100; /* reset bit errors */ chan_state->ber_num = 0; -- To view, visit https://gerrit.osmocom.org/3561 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I2464e872f81021cbc3ccbc4e2e32c394d6afcf70 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
[PATCH] osmo-bts[master]: osmo-bts-trx: Fix MS power control loop.
Review at https://gerrit.osmocom.org/3560 osmo-bts-trx: Fix MS power control loop. The following two commits from 2014-12-06 introduced a new variable to control MS power - ms_power_ctrl, but kept the old ms_power variable in place. They have also changed the meaning of the ms_power variable - it now keeps original RSL configured value. So when much later osmo-trx-bts code was merged to master the code was compiling fine and this change in the meaning was overlooked. In osmo-bts: 579651bf300de002731dfd3bd39985c9fd15616c power/sysmobts: Add a manual ms power level control In OpenBSC: f6f86b0eec18da165db136b14bf2db87fde4b4ac osmo-bts: Introduce new struct for a power loop in the BTS code Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1 --- M src/osmo-bts-trx/l1_if.c M src/osmo-bts-trx/loops.c 2 files changed, 12 insertions(+), 12 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/60/3560/1 diff --git a/src/osmo-bts-trx/l1_if.c b/src/osmo-bts-trx/l1_if.c index f69e587..c629a61 100644 --- a/src/osmo-bts-trx/l1_if.c +++ b/src/osmo-bts-trx/l1_if.c @@ -509,7 +509,7 @@ LOGP(DMEAS, LOGL_DEBUG, "RX L1 frame %s fn=%u chan_nr=0x%02x MS pwr=%ddBm rssi=%.1f dBFS " "ber=%.2f%% (%d/%d bits) L1_ta=%d rqd_ta=%d toa=%.2f\n", - gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power), + gsm_lchan_name(lchan), fn, chan_nr, ms_pwr_dbm(lchan->ts->trx->bts->band, lchan->ms_power_ctrl.current), rssi, ber*100, n_errors, n_bits_total, lchan->meas.l1_info[1], lchan->rqd_ta, toa); l1if_fill_meas_res(, chan_nr, lchan->rqd_ta + toa, ber, rssi, fn); diff --git a/src/osmo-bts-trx/loops.c b/src/osmo-bts-trx/loops.c index 8070e80..8d6e5d7 100644 --- a/src/osmo-bts-trx/loops.c +++ b/src/osmo-bts-trx/loops.c @@ -48,7 +48,7 @@ uint16_t arfcn = trx->arfcn; int8_t new_power; - new_power = lchan->ms_power - (diff >> 1); + new_power = lchan->ms_power_ctrl.current - (diff >> 1); if (diff == 0) return 0; @@ -66,12 +66,12 @@ } /* a higher value means a lower level (and vice versa) */ - if (new_power > lchan->ms_power + MS_LOWER_MAX) - new_power = lchan->ms_power + MS_LOWER_MAX; - else if (new_power < lchan->ms_power - MS_RAISE_MAX) - new_power = lchan->ms_power - MS_RAISE_MAX; + if (new_power > lchan->ms_power_ctrl.current + MS_LOWER_MAX) + new_power = lchan->ms_power_ctrl.current + MS_LOWER_MAX; + else if (new_power < lchan->ms_power_ctrl.current - MS_RAISE_MAX) + new_power = lchan->ms_power_ctrl.current - MS_RAISE_MAX; - if (lchan->ms_power == new_power) { + if (lchan->ms_power_ctrl.current == new_power) { LOGP(DLOOP, LOGL_INFO, "Keeping MS new_power of trx=%u " "chan_nr=0x%02x at control level %d (%d dBm)\n", trx->nr, chan_nr, new_power, @@ -83,11 +83,11 @@ LOGP(DLOOP, LOGL_INFO, "%s MS new_power of trx=%u chan_nr=0x%02x from " "control level %d (%d dBm) to %d (%d dBm)\n", (diff > 0) ? "Raising" : "Lowering", - trx->nr, chan_nr, lchan->ms_power, - MS_PWR_DBM(arfcn, lchan->ms_power), new_power, + trx->nr, chan_nr, lchan->ms_power_ctrl.current, + MS_PWR_DBM(arfcn, lchan->ms_power_ctrl.current), new_power, MS_PWR_DBM(arfcn, new_power)); - lchan->ms_power = new_power; + lchan->ms_power_ctrl.current = new_power; return 0; } @@ -159,8 +159,8 @@ /* change RSSI */ LOGP(DLOOP, LOGL_DEBUG, "Lowest RSSI: %d Target RSSI: %d Current " "MS power: %d (%d dBm) of trx=%u chan_nr=0x%02x\n", rssi, - trx_target_rssi, lchan->ms_power, - MS_PWR_DBM(trx->arfcn, lchan->ms_power), + trx_target_rssi, lchan->ms_power_ctrl.current, + MS_PWR_DBM(trx->arfcn, lchan->ms_power_ctrl.current), trx->nr, chan_nr); ms_power_diff(lchan, chan_nr, trx_target_rssi - rssi); -- To view, visit https://gerrit.osmocom.org/3560 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I713e39b882db32a0d17aa04790d16fa79afa1fb1 Gerrit-PatchSet: 1 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Alexander Chemeris <alexander.cheme...@gmail.com>
osmo-trx[master]: Add -j option to bind to specific address
Patch Set 1: Code-Review+1 -- To view, visit https://gerrit.osmocom.org/3539 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I9ba184a1251c823e413a9230943ed263e52142ec Gerrit-PatchSet: 1 Gerrit-Project: osmo-trx Gerrit-Branch: master Gerrit-Owner: Pau Espin Pedrol <pes...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-HasComments: No
osmo-bts[master]: Check for suitable lchan type when detecting HO
Patch Set 3: Tom - do you think we can avoid RACH detection for non-SACCH and DCCH in osmo-trx, following the same logic as here? Right now we're detecting RACH on every burst IIRC. -- To view, visit https://gerrit.osmocom.org/1960 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Iacbcc8441d6cfbb8f808948a8baddde1ebca488a Gerrit-PatchSet: 3 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max <msur...@sysmocom.de> Gerrit-Reviewer: Alexander Chemeris <alexander.cheme...@gmail.com> Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Tom Tsou <t...@tsou.cc> Gerrit-HasComments: No