Commit Graph

772 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther c7ee5acba9 sysmobts: Fix the temperature log message alignment 2014-08-21 23:55:27 +02:00
Holger Hans Peter Freyther 9698570d47 sysmobts: Move ipaccess-find counterpart to a dedicated source file 2014-08-21 23:55:27 +02:00
Holger Hans Peter Freyther 7be58a173a sysmobts: Fix the build when no 2050 uc header file was found
Fix the build (provide empty stubs) when the header file is not
present.
2014-08-21 18:03:25 +02:00
Holger Hans Peter Freyther 631945a367 Merge branch 'sysmocom/features/sysmobts-mgr'
Add some VTY code to show the temperature on all devices and to
query the external micro controller for voltage/current and the
temperature in the "show manager" command. It should probably be
a "show system" command though.
2014-08-21 16:25:22 +02:00
Holger Hans Peter Freyther 5e1363071f sysmobts: Fix the power request result
We want to know which componets are enabled and the voltage and
current used by the components.
2014-08-21 16:25:07 +02:00
Holger Hans Peter Freyther 4059e29a29 sysmobts: Read the temperature sensors on the device
Read the sensors that are always present and the ones that
are only present on the sysmoBTS 2050.
2014-08-21 16:25:07 +02:00
Holger Hans Peter Freyther 46c085d794 sysmobts: Add is_sbts2050_master 2014-08-21 16:25:07 +02:00
Holger Hans Peter Freyther b1ceb40363 sysmobts: Read the model number and trx once from the device
Use it for the ipaccess-find response and for the sysmobts
classification code. This can be used by the vty in a second.
2014-08-21 16:25:07 +02:00
Holger Hans Peter Freyther 3ecb2bb604 sysmobts: Initialize fd with an invalid fd
Initialize the ucinfo with an invalid fd to prevent writing
on fd=0 by accident.
2014-08-21 16:25:07 +02:00
Holger Hans Peter Freyther ffe1d2e1e0 Merge commit 'sysmocom/features/sysmobts-mgr-vty'
Some re-factorings. Still a very long way to go. It should
work with haralds re-based but that wasn't verified due my
toolchain not having the most recent libosmocore. The service
file and screenrc change has not been verified either.
2014-08-21 15:50:40 +02:00
Holger Hans Peter Freyther 575f633483 sysmobts: Use another logp region as it is mostly related to remp 2014-08-21 15:49:06 +02:00
Holger Hans Peter Freyther 54a8b313b4 sysmobts: There is only one uc make it a singleton
Move the init and polling into the sysmoBTS related part. In the
future we should have _one_ temperature control.
2014-08-21 15:49:06 +02:00
Holger Hans Peter Freyther c84ca8c82f sysmobts: Clean-up the parsing routines 2014-08-21 15:49:06 +02:00
Holger Hans Peter Freyther 035187b44e sysmobts: Move the sysmoBTS 2050 controller handling
Move the code to a separate file to keep things nicely apart
of each other.
2014-08-21 15:49:06 +02:00
Holger Hans Peter Freyther 013df51ca8 sysmobts: Add VTY support to the sysmobts-mgr
Add VTY support to the manager. This way we can interactively
inspect the state of the system and trigger events.
2014-08-21 15:49:06 +02:00
Harald Welte 07198750b2 adopt to recent libosmocore ipa rename 2014-08-20 23:30:28 +02:00
Harald Welte ac76388c77 TLVP_PRES_LEN is now in libosmocore, avoid redefining it 2014-08-18 20:48:56 +02:00
Harald Welte bc82b0189a replace oml_{osmo,ipa}_magic[] with abis_nm_{osmo,ipa}_magic
the latter is now in libosmogsm.
2014-08-18 20:48:56 +02:00
Harald Welte fcd5c367d1 Migrate to osmo_get_macaddr() in recent libosmocore
get_mac_addr() is generally useful and shouldn't be hidden in
the osmo-bts/abis.c file
2014-08-18 20:48:56 +02:00
Holger Hans Peter Freyther 88d60a1f86 sysmobts: Add a unit test that checks of the behavior
We need to build a lot more code to be able to test these two
new routines. I didn't want to move the code to a utils file
as the check is called from a hot path. Add accessors to the
inlined variant to be used by the unit test.

While writing the unit tests I noticed that a re-transmission
of the ciphering command would lead to an attempt to enable
ciphering again. I am not sure that this MphConfig is idempotent.
2014-08-09 09:42:56 +02:00
Holger Hans Peter Freyther 2cc37035d7 sysmobts: Deal with ciphering when we have a transport clash
The network is configured with early classmark sending. This means
that the phone might send a "classmark change" message at the same
time we send a ciphering mode command. When we received the CM
message we assumed we have just received the first ciphered message
and enabled ciphering for tx as well.

When we snoop the Ciphering Mode Command extract the N(S) variable
and when we receive an I frame from the MS see if it handled our
message by comparing the MS N(R) to BTS N(S) + 1.
2014-08-09 09:42:56 +02:00
Holger Hans Peter Freyther 6cf49380cd Merge branch 'sysmocom/features/oml-router' 2014-07-31 17:49:08 +02:00
Holger Hans Peter Freyther caca1899ce sysmobts: Make sure that the omlrouter is in a FHS path
I wondered if I should use the 'abstract namespace' feature
of Linux but just put the router into /var/run/ to make it
work out of the box. Change the signature to provide a sane
error message.
2014-07-31 17:43:08 +02:00
Holger Hans Peter Freyther fcdfb690ca sysmobts: Add testcase for ETSI/12.21 message 2014-07-31 16:59:06 +02:00
Holger Hans Peter Freyther dbc2731887 sysmobts: Extend the testcase for a Osmo message as well 2014-07-31 16:58:48 +02:00
Holger Hans Peter Freyther 0655cac6f1 sysmobts: Verify the structure of IPA and OML messages
Extend the router to verify that the message received is
properly encoded. The code can deal with the basic structure
of ETSI OML and vendor specific messages for ip.access and
the osmocom project.
2014-07-31 16:58:26 +02:00
Holger Hans Peter Freyther 9e1dbf532e sysmobts: Remove debug left over from enabling the RTP mode 2014-07-31 16:57:39 +02:00
Holger Hans Peter Freyther b05d72d21b sysmobts: Begin with an OML router that will be used by the manager
Begin with the basics of a OML Router. This is currently only
capable of accepting a connection and read messages but it will
evolve into a router in multiple stages. The first usage will
be by the sysmobts-mgr. An OML Error Indication will be sent by
the sysmobts-mgr and it will be forwarded to the BSC. In the
second step we will set a relative power reduction from the
sysmobts-mgr.

In the long-term this code will be used to communicate with a
second TRX.
2014-07-31 16:57:39 +02:00
Holger Hans Peter Freyther b3d1779b96 tests: Move the "pcu_direct" symbol into the stubs to be shared 2014-07-31 14:55:03 +02:00
Holger Hans Peter Freyther bc8de14671 oml: Make it possible to include the file directly
Fixes:
../../include/osmo-bts/oml.h:8:42: warning: ‘struct gsm_bts’ declared inside parameter list [enabled by default]
 int down_oml(struct gsm_bts *bts, struct msgb *msg);
                                          ^
../../include/osmo-bts/oml.h:8:42: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
../../include/osmo-bts/oml.h:12:52: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 int oml_mo_send_msg(struct gsm_abis_mo *mo, struct msgb *msg, uint8_t msg_type);
                                                    ^
../../include/osmo-bts/oml.h:13:31: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 int oml_mo_opstart_ack(struct gsm_abis_mo *mo);
                               ^
../../include/osmo-bts/oml.h:14:32: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 int oml_mo_opstart_nack(struct gsm_abis_mo *mo, uint8_t nack_cause);
                                ^
../../include/osmo-bts/oml.h:15:32: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 int oml_mo_statechg_ack(struct gsm_abis_mo *mo);
                                ^
../../include/osmo-bts/oml.h:16:33: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 int oml_mo_statechg_nack(struct gsm_abis_mo *mo, uint8_t nack_cause);
                                 ^
../../include/osmo-bts/oml.h:19:29: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 int oml_mo_state_chg(struct gsm_abis_mo *mo, int op_state, int avail_state);
                             ^
../../include/osmo-bts/oml.h:22:31: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 void oml_mo_state_init(struct gsm_abis_mo *mo, int op_state, int avail_state);
                               ^
../../include/osmo-bts/oml.h:26:10: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
          int success);
          ^
../../include/osmo-bts/oml.h:29:33: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 int oml_tx_state_changed(struct gsm_abis_mo *mo);
                                 ^
../../include/osmo-bts/oml.h:31:33: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
 int oml_mo_tx_sw_act_rep(struct gsm_abis_mo *mo);
                                 ^
../../include/osmo-bts/oml.h:36:4: warning: ‘struct gsm_abis_mo’ declared inside parameter list [enabled by default]
    uint8_t cause);
2014-07-31 14:54:51 +02:00
Holger Hans Peter Freyther a19912db34 sysmobts: Enable the direct RTP mode for firmware >= 3.11
We need to patch the CMR due wanting to support systems that still
have Audiocodes hardware in their chain. I have manually tested
and could listen to my own voice on:

TCH/H	&	AMR 5.9		& PTSN			& BSC
TCH/F	&	FR1		& Other subscriber	& NITB
TCH/F	&	EFR		& Other subscriber	& NITB
TCH/H	&	HR1		& Other subscriber	& NITB
TCH/H	&	AMR 5.9		& Other subscriber	& NITB

The tests were done using the Nokia E71, a Blackberry curve and
for the PTSN a HTC 8S were used.
2014-07-31 14:39:32 +02:00
Holger Hans Peter Freyther eececf5fa9 sysmobts: Make it possible to slowly ramp up the output power
For systems with a bigger PA enabling the full output power at
once might draw more current than a power supply can provide. This
code will step up the output power in smaller steps to avoid this
situation.
2014-07-30 18:22:12 +02:00
Holger Hans Peter Freyther bc24955e91 sysmobts: Provide VTY routines to do clock calibrations
The sysmoBTS2050 does not have a OCXO and we should not rely
on the GPS module to always have a fix. Instead use the TCXO
by default and from time to time (and we know we have a fix
calibrate the TCXO). This can be done by:

  trx 0 rf-clock-info reset
  wait...
  trx 0 rf-clock-info correct
  write

The output is currently only written to the log as the VTY
connection might go away during the operation. The reset will
set the approriate reference clock and the correct will attempt
to determine and apply the correction. The write terminal will
make sure that next on start a known good value will be used.
2014-07-25 14:45:52 +02:00
Holger Hans Peter Freyther bac0ff7f6d sysmobts: Free the message on older firmware releases
Seen while implementing a new functionality in the code.
2014-07-25 13:23:00 +02:00
Holger Hans Peter Freyther 94a63851b7 sysmobts: Include the model and master/slave in the unitid
Make it more easy to find the right BTS model and know what is
the master/slave.
2014-07-25 10:48:14 +02:00
Holger Hans Peter Freyther 3674645e20 amr: Avoid toggling the CMR from none and a set one
For LCR and other systems without out-of-band information we need
to indicate the CMR. Not every air message will include the mode
and we sent a stream that had the CMR set and not-set. This lead
to the AudioCodes MGW only playing every second frame.

Remember the last used mode and initialize it to _NONE when we
receive the multirate config. In case of a real error we will
still use AMR_CMR_NONE.

The initial patch is from Harald. I have added the initialization
and moving of the defines to amr.h.

Manually verified by enabling AMR5.9 and looking at two RTP
packages in sequence. In both cases the CMR was 2. I have looked
at "amr.nb.cmr != 2" in wireshark and only found the MGCP dummy
packet.
2014-07-25 09:22:29 +02:00
Holger Hans Peter Freyther a2b806c375 sysmobts: Fix typo in the comment 2014-06-22 16:23:59 +02:00
Holger Hans Peter Freyther a7f9b58e44 sysmobts: Fix the initialization of the BTS manager code
The code should only run for the sysmoBTS 2050 and TRX 0.
If the device is not marked as 2050 the code would attempt
to open /dev/ttyS0 and block forever.
2014-05-30 15:29:01 +02:00
Holger Hans Peter Freyther 0e2b624418 sysmobts: Revert all sysmobts-mgr related changes
Harald is right and that the code is generally not ready
for inclusion. I fell victim of trying to finish it while
the code is not ready at all. It is better to re-introduce
the patches in a smaller and more tested way.

The right way would have been a branch were ready things
are split-off the main/wip commit until everything is ready.

Revert "sysmobts: Have a common prefix for the enum"
This reverts commit 44980347f3.

Revert "utils: Used the enum manuf_type_id in the parameter of add_manufacturer_id_label"
This reverts commit 7d36e5ed46.

Revert "utils: Classify the OML message using the return type"
This reverts commit afee0b7929.

Revert "sysmobts: Do not access out of bound string"
This reverts commit f5f41e8051.

Revert "sysmobts: Separate IPA and OML check into two methods"
This reverts commit 13a224063d.

Revert "screenrc: osmobts-mgr now needs a config file"
This reverts commit 0a1699ff8a.

Revert "make sure osmobts-mgr.cfg file is included in tarballs"
This reverts commit 14c60b425f.

Revert "sysmobts-mgr: Add VTY support for configuring it"
This reverts commit c5fedd24c9.

Revert "sysmobts: Add beginnings of an OML router and create Failure Messages in the sysmobts-manager"
This reverts commit c6ab90b270.
2014-05-25 13:48:33 +02:00
Holger Hans Peter Freyther 7996134d2a common: Ignore "si.valid" outside of _MAX_SYSINFO_TYPE
Limit the range from 0 to (_MAX_SYSINFO_TYPE - 1) instead of
0 to 31. This way we will never access the lchan->si.buf[] out
of bounds. This is only a theoretical issue though as the code
filling the lchan->si.buf for the SACCH will not have valid
>= _MAX_SYSINFO_TYPE. Add a small regression test to check we
still schedule all SIs.

Fixes: CID 1040765
2014-05-22 21:17:49 +02:00
Holger Hans Peter Freyther ac26607fe4 common: Remove unused gsm_time parameter from lchan_sacch_get 2014-05-22 20:42:33 +02:00
Holger Hans Peter Freyther 9d8aeab0b6 sysmobts: Avoid memleak when multiple -c arguments are passed
Rely on optarg pointing to an address that will be valid for
the run of the entire application.

Fixes: CID 1206578
2014-05-22 19:50:39 +02:00
Holger Hans Peter Freyther 44980347f3 sysmobts: Have a common prefix for the enum
Make the manuf_type_id enum have a common prefix for the
symbols.
2014-05-20 09:47:02 +02:00
Álvaro Neira Ayuso 7d36e5ed46 utils: Used the enum manuf_type_id in the parameter of add_manufacturer_id_label
Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-20 09:47:02 +02:00
Álvaro Neira Ayuso afee0b7929 utils: Classify the OML message using the return type
Classify the OML message and return the manufacturer type
or an error. Currently ETSI, ip.access and Osmocom are known.

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-20 09:45:36 +02:00
Álvaro Neira Ayuso f5f41e8051 sysmobts: Do not access out of bound string
One can either use "strlen(str) + 1" but not add one to the
result of the sizeof.
2014-05-20 09:43:38 +02:00
Álvaro Neira Ayuso 13a224063d sysmobts: Separate IPA and OML check into two methods
I have split the function check_oml_msg, in two functions. One for
checking if the ipa header is well-formed and in check_oml_msg,

Signed-off-by: Alvaro Neira Ayuso <anayuso@sysmocom.de>
2014-05-20 09:37:30 +02:00
Harald Welte 0a1699ff8a screenrc: osmobts-mgr now needs a config file 2014-05-19 13:01:20 +02:00
Harald Welte 14c60b425f make sure osmobts-mgr.cfg file is included in tarballs 2014-05-19 12:58:31 +02:00
Harald Welte b4280963c0 Revert "sysmobts: Add support for changing the transmit power in sbts2050"
This reverts commit c64d425738.

There are unfrtunately still too many problems with this patch to be
merged at this point.
2014-05-19 11:22:38 +02:00