Commit Graph

37 Commits

Author SHA1 Message Date
Vadim Yanitskiy 064ffe6563 host/mobile: use talloc for ms->name allocation
The approach of talloc memory management reduces memory usage,
and prevents some buffer overflows, which were possible before.

Change-Id: Icd6706117fdd7f1b3481b0e3817bbb3b31f12f60
2017-05-25 11:43:49 +00:00
Vadim Yanitskiy 03485409be mobile/gsm322.c: fix mcc/mnc typo
Change-Id: I4a3aaa0465598b17ccd30ec4cbeb90429216540e
2017-05-25 02:11:53 +03:00
Vadim Yanitskiy 06f44d3772 mobile/gsm322.c: check fwrite() return value
Change-Id: I74ad6e540c98ab4914e7a2ea725dd23f5a2fd034
2017-05-25 02:11:53 +03:00
Andreas Eversberg d72cb4401e Rename various "rxlev" variable to "rxlev_dbm" and correct their signess
All levels in range of 0..63 are now uint8_t and use "rxlev" as
variable name. All levels in range of -110..-47 are now int8_t and use
"rxlev_dbm" as variable name.
2012-11-22 16:00:33 +01:00
Harald Welte 85f4e1b3b8 fix previous commit: use dbm2rxlev()
As andreas points out, there are structure members that are called
'rxlev' but which don't use the scaling (0..63) of the GSM specs, but
which are already a signed type and in dBm.  So they need to be
converted.

TODO: Rename those structure members to rxlev_dbm or something that
explicitly states it is _not_ an 'RXLEV' value in terms of GSM.
2012-11-22 10:15:10 +01:00
Harald Welte 73a809e57b Tell L1CTL_FBSB_REQ the expected received signal level
As Dieter points out, this drastically improves the resiliance to high
receive levels on the C155.  We cannot blindly assume a received signal
level of -85 dBm if the BTS is 2m away and we actually receive -40 dBm.

This patch extends the L1CTL_FBSB_REQ data structure in layer 1 with the
respective field, as well as the l1ctl_tx_fbsb_req() API function called
from the various layer23 apps.

"mobile" and "bcch_scan" already did a PM request and thus know the
expected signal power.  "ccch_scan" and "cbch_sniff" apparently don't
do, so the -85 dBm constant is now hardcoded into the host-side source
code there, and should probably be fixed in a follow-up patch.
2012-11-20 10:13:44 +01:00
Pavel Baturko 2879e77bd3 Fix wrong print of scan freq when using gsm_print_arfcn twice for the same log message 2012-11-16 14:47:54 +01:00
Joshua Lackey 50c3ca922b Fix: Correctly convert ARFCN to index.
If you enable PCS, you'll never make it out of power-measurement without
this patch.
2012-11-15 10:42:18 +01:00
Kurtis Heimerl 987787f0cb Just a quick bug fix to gsm322.c.
Basically, there were two commands in an "else" block without brackets,
causing the

"end = 1023+299"

command to execute regardless of the state of index.

Signed-off-by: Andreas Eversberg <jolly@eversberg.eu>
2012-02-02 08:39:56 +01:00
Andreas Eversberg c2b823faf0 layer23/mobile: Fixed cell re-selection after loosing signal
Test showed that loosing the signal in dedicated mode caused a complete
rescann of all cells. By keeping the cell selected, the process can use
the neighbour cell informations to do a quick search for the best cell
afterwards.
2012-01-02 02:21:19 +01:00
Andreas Eversberg 8d24b2f395 [mobile] Added missing curly braces, as proposed by Harald 2011-07-17 12:23:59 +02:00
Andreas Eversberg 9548ac0a41 [layer23/mobile] Improvement and fixes of idle mode process
This patch introduces cell re-relection. When camping on a cell, it
scanns neighbour cells. If a 'better' cell is found, the cell is selected.
If the cell is in a different location area, a location upating is
performed under certain conditions.

The 'better' cell depends on various informations that are broadcasted on
the BCCH of a neihbour cell and of course the RX level. Most operators
don't set these informations, so the 'better' cell depend on a better
RX level for the same location area, or a much better RX level (6 dBm)
at a different location area.

There were many issues at the idle mode process that has been fixed.
Expecially when moving, the state machines got stuck, so no more cell search
was possible, or no further calls / location updating was possible.

In order to see the process of cell selection, enter the VTY interface and
enable the network monitor:

enable
monitor network 1  (where '1' is the instance of the MS)

In order to see the current state of the processes, enter:

show ms
2011-07-17 11:12:15 +02:00
Harald Welte 5d65fcba6c add l1ctl_proto.h #includes to lots of files
this is apparently a result of no longer including it indirectly via lapdm.h
2011-06-22 23:08:55 +02:00
Andreas.Eversberg 58ac7e0e98 [layer23] Adding Quadband support and GSM 4x0 support
This makes it possible to use GSM 850 and PCS 1900 bands, as used in the
US. The support relies on the phone hardware.

Each band (900, DCS, 850, PCS, 480 and 450) can be enabled and
disabled individually for each setting.
2011-05-29 19:51:54 +02:00
Pablo Neira Ayuso d3ba2f6037 src: use namespace prefix osmo_timer*
Summary of changes:

s/struct timer_list/struct osmo_timer_list/g
s/bsc_add_timer/osmo_timer_add/g
s/bsc_schedule_timer/osmo_timer_schedule/g
s/bsc_del_timer/osmo_timer_del/g
s/bsc_timer_pending/osmo_timer_pending/g
s/bsc_nearest_timer/osmo_timers_nearest/g
s/bsc_prepare_timers/osmo_timers_prepare/g
s/bsc_update_timers/osmo_timers_update/g
s/bsc_timer_check/osmo_timers_check/g
2011-05-15 14:39:30 +02:00
Pablo Neira Ayuso ade79a0083 src: use new libosmogsm and include/osmocom/[gsm|core] path to headers
This patch changes include paths to get osmocom-bb working with
the current libosmocore tree.

Among all these renames, you can notice several tweaks that I
added on purpose, and that require some explanation, they are:

* hexdump() in osmocon.c and osmoload.c has been renamed to avoid
clashing with hexdump() defined in libosmocore.

* gsmmap now depends on libosmogsm. Actually I had to cleanup
Makefile.am because I was experiencing weird linking problems,
probably due to a bug in the autotools. With the change included
in this patch, I got it compiled and linked here correctly.

This patch has been tested with the phone Motorola C123 and the
following images files:

* firmware/board/compal_e88/hello_world.compalram.bin
* firmware/board/compal_e88/layer1.compalram.bin

Using the osmocon, bcch_scan and mobile tools.

Signed-off-by: Pablo Neira Ayuso <pablo@gnumonks.org>
2011-04-26 02:55:30 +02:00
Harald Welte cde3f7d2c6 mobile: Store N.ba files in same directory as config file
This should remove the last dependency to hard-coded system-wide /etc/osmocom
2011-03-02 11:00:59 +01:00
Andreas.Eversberg f8903f06d1 [layer23] Cleanup of mobile application
All functions for handling mobile instances and mobile relevant parts are
moved to mobile/app_mobile.c, the mobile/main.c and mobile/mncc.c become a
simple out-of-the-box mobile application. (making calls)

The mobile/main.c can be replaced easily by a different application now.
this application may have it's own call control implementation (layer 4).
Full configurations via VTY is still possible and required in this case.
2010-11-14 11:52:57 +00:00
Andreas.Eversberg 6f2b172780 [layer23] Added support for multiple MS instances
To create another instance: 'ms <name> create'

To remove an instance: 'no ms <name>'

If no instance exists, 'ms 1' is created automatically on startup.

Each instance can be enabled / disabled by using 'shutdown' or
'no shutdown'. Multiple instances may share the same layer2 socket (same
phone hardware), but in this case only one instance can be enabled at the
same time. This makes it much easier to select different settings without
modifying them.

A 'shutdown' initiates the IMSI detach procedure before shutdown is
completed. A 'shutdown force' will immidiately shutdown.

There is no need to restart the software anymore, if fundamental settings
are changed. In this case, a 'shutdown' followed by a 'no shutdown' will
do the job.

If you already have an old osmocom.cfg, you need to "no shutdown" it.
Everything else behaves as before.
2010-11-13 18:45:09 +00:00
Andreas.Eversberg fbbb3ac953 [layer23] Fixed conditions for complete set of SYSTEM INFORMATION 2010-10-24 12:55:31 +00:00
Andreas.Eversberg 19807191b6 [layer23] If the mobile sticks to a cell, RXLEV_MIN is ignored 2010-10-15 18:50:25 +00:00
Andreas.Eversberg 513972c37d [layer23] If SIM is invalid, display that on the VTY 2010-10-13 18:33:16 +00:00
Andreas.Eversberg 3318b3f622 [layer23] Fix of signal loss handling
The cell must be kept "selected" in case of loosing radio link. It is
required to perform reselection of that cell or of the given neighbor
cells.
2010-10-13 18:30:59 +00:00
Andreas.Eversberg 218303d6ed [layer23] Bugfix: Loosing CCCH signal must cause unselection of cell. 2010-10-12 08:48:08 +00:00
Andreas.Eversberg 6d4915b91b [layer23] Implementation of signal loss criteria as defined in TS 05.08
There are two criterions for lossing a signal, idle mode and dedicated mode.
A counter counts down when a frame is dropped, and counts up when a valid
frame is received on  certain channel. The loss criterion is reached, if the
counter reaches 0. The values added to / removed from the counter and the
limits depend on the process.
2010-10-12 08:26:48 +00:00
Andreas.Eversberg 66ff1cb347 [layer23] Minimum RX-level is now a configuratio option
The default (if config not yet created/updated), is still taken from
settings.c.
2010-10-01 19:24:34 +00:00
Andreas.Eversberg bb6ff927da [layer23] Using loglevel to disable heavy debugging on cell selection 2010-10-01 19:21:33 +00:00
Andreas.Eversberg 0da908f3f1 [layer23] Disabled display of SYSINFO message at message handlers
This way the SYSINFO is logged once and not three times.
2010-09-29 13:29:31 +00:00
Andreas.Eversberg 6d2625ce0c [layer23] Added a workarround to ignore the first (invalid) PM result 2010-09-29 13:28:04 +00:00
Andreas.Eversberg 2926896143 [layer23] Disabled the scanning of maximum cells per band
This way all frequencies are scanned, in case they meat the minimum
receive level.
2010-09-29 13:26:34 +00:00
Andreas.Eversberg d2c862a849 [layer23] Disabled may debugging in cell selection process
This way the syncing and cell selection can be reviewed much better.
2010-09-29 13:24:12 +00:00
Andreas.Eversberg 942bfeab18 [layer23] Cleanup of various 'printf' debugging 2010-09-26 22:02:32 +00:00
Andreas.Eversberg 4ed601ae4e [layer23] Adding application generated measurement report
The cell provides SYSTEM INFORMATION 5* and 6. These are used to create a
list of neighbor cells to monitor. Because there is no neighbor cell
monitoring supported by layer1, the list has no valid results yet.

Currently the average RX level of received frames are used to generate a new
report every second. The report is transmitted to layer1 and used there
whenever a measurement report has to be transmitted.

The timing advance and the current transmit power (as requested by network),
is included with every report.
2010-09-26 10:35:46 +00:00
Andreas.Eversberg 0856c8a6a5 [layer23] SIM client completion
The SIM client is now complete. Because it usefull for multiple
applications, i moved it to the layer23/src/common directory.

The SIM reader works together with mobile process. Fixes were made.
Thanx to all for testing, finding bugs, and making it work as it is
supposed to do.

The current version uses special L1CTL messages to send and receive APDUs.
This will change in the future, when BTSAP interface is completed.

Please note that this client will not work until the layer1 SIM reader
fixes and extensions are committed.
2010-09-18 19:15:15 +00:00
Andreas.Eversberg f20a1c3de8 [layer23] Layer 3 now uses SIM client to request and update SIM data
The SIM reader can be selected via VTY, but because it is not yet
implemented in layer1, nothing happens when selecting it.
2010-08-28 09:46:36 +00:00
Sylvain Munaut 9e9f99c0a0 layer23: Split [2/2] -> The header files
This split the headers and adapt the source.

We use osmocom/bb as a prefix because libosomore also
uses osmocom and generic names such as misc & common could
conflict in the future.

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-07-27 20:49:27 +02:00
Sylvain Munaut de21ca4aaf layer23: Split [1/2] -> The source code
We split into :
 - common: Everything that can be shared
 - mobile: The real spec compliant mobile phones
 - misc:   Different test stuff

Signed-off-by: Sylvain Munaut <tnt@246tNt.com>
2010-07-27 20:49:04 +02:00