Commit Graph

634 Commits

Author SHA1 Message Date
Aleksander Morgado 71e2858271 libqmi-glib: new header file for private enum/flag types 2012-10-09 15:23:47 +02:00
Aleksander Morgado bb1807c4ba build: include missing files in dist 2012-10-09 15:23:47 +02:00
Aleksander Morgado 148791b4ca docs: improve generated `libqmi-glib' documentation
Among the tons of fixes done here, we now generate some per-service .sections
file which we then concatenate to build the final libqmi-glib-sections.txt file.
2012-10-09 15:23:47 +02:00
Aleksander Morgado c0c06efb39 build: compile all generated code into a non-installable library
Also simplify the build by using BUILT_SOURCES to avoid needing to specify
custom dependency rules.
2012-10-09 12:20:55 +02:00
Aleksander Morgado 75ccb48f4d libmm-glib: fix multiple documentation issues 2012-10-09 12:20:55 +02:00
Dan Williams b0b1fe3221 cli: format fix 2012-09-27 11:03:39 -05:00
Aleksander Morgado 50ea36c699 nas: Ec/Io given always as a signed integer 2012-09-27 14:28:32 +02:00
Aleksander Morgado fed55d03d2 cli: skip printing network info for SINR and IO
Seems that SINR and IO, even if they are supposedly only meaningful in EV-DO,
may still be given for other networks.

[27 Sep 2012, 11:17:36] [Debug] [/dev/cdc-wdm0] Received message...
>>>>>> QMUX:
>>>>>>   length  = 49
>>>>>>   flags   = 0x80
>>>>>>   service = "nas"
>>>>>>   client  = 6
>>>>>> QMI:
>>>>>>   flags       = "response"
>>>>>>   transaction = 1
>>>>>>   tlv_length  = 37
>>>>>>   message     = "Get Signal Strength" (0x0020)
>>>>>> TLV:
>>>>>>   type       = "Result" (0x02)
>>>>>>   length     = 4
>>>>>>   value      = 00:00:00:00
>>>>>>   translated = SUCCESS
>>>>>> TLV:
>>>>>>   type       = "Signal Strength" (0x01)
>>>>>>   length     = 2
>>>>>>   value      = A8:05
>>>>>>   translated = [ strength = '-88' radio_interface = '5' ]
>>>>>> TLV:
>>>>>>   type       = "RSSI List" (0x11)
>>>>>>   length     = 4
>>>>>>   value      = 01:00:58:05
>>>>>>   translated = { [0] = '[ rssi = '88' radio_interface = '5' ] '}
>>>>>> TLV:
>>>>>>   type       = "ECIO List" (0x12)
>>>>>>   length     = 4
>>>>>>   value      = 01:00:FC:05
>>>>>>   translated = { [0] = '[ ecio = '252' radio_interface = '5' ] '}
>>>>>> TLV:
>>>>>>   type       = "IO" (0x13)
>>>>>>   length     = 4
>>>>>>   value      = 96:FF:FF:FF
>>>>>>   translated = -106
>>>>>> TLV:
>>>>>>   type       = "SINR" (0x14)
>>>>>>   length     = 1
>>>>>>   value      = 08
>>>>>>   translated = 8
2012-09-27 12:27:03 +02:00
Aleksander Morgado c3196323bc cli: avoid shadowing the global `index' variable 2012-09-26 18:44:38 +02:00
Aleksander Morgado bf406fdca0 libqmi-glib,utils: handle alignment issues when reading integers from the buffer
Some architectures require that the value of a pointer is aligned in memory.
Given that we're reading from a raw buffer, the integers in it may not end up
aligned so we cannot safely cast any address to a valid 16/32/64 bit integer
value. Handle this by copying the integer from the raw buffer directly into the
output variable, which is of course properly aligned. Also added new test cases
to check this.

Thanks to:
    Shawn J. Goff <shawnjgoff@gmail.com>
for reporting the issue and his endless tests.
2012-09-26 17:16:55 +02:00
Aleksander Morgado 20539c320f cli: new `--dms-select-stored-image' action
Can be run e.g. like:
$> sudo qmicli -d /dev/cdc-wdm0 --dms-select-stored-image="modem1,pri2"
2012-09-26 10:19:53 +02:00
Aleksander Morgado f8dc62149e cli: new `--dms-delete-stored-image' action
Can be run e.g. like:
$> sudo qmicli -d /dev/cdc-wdm0 --dms-delete-stored-image="pri2"

The passed index is the one given by a previous `--dms-list-stored-images'
action. Please note that if you delete a given image, the listed indexes will
change, so if you want to delete multiple images you'll need to first list
stored images and grab the index and then use that bew index to delete the new
image.

Also, don't try this command many times or you'll run out of images to delete!
2012-09-26 10:19:53 +02:00
Aleksander Morgado d2b7ea2eea cli: new `--dms-list-stored-images' action 2012-09-26 10:19:53 +02:00
Aleksander Morgado 4adcc1aa77 dms: implement "Set Firmware Preference" request/response 2012-09-26 09:46:13 +02:00
Aleksander Morgado 6b776b3d63 dms: implement "Delete Stored Image" request/response 2012-09-26 09:46:13 +02:00
Aleksander Morgado fb70a5f785 dms: implement "Get Stored Image Info" request/response 2012-09-26 09:45:43 +02:00
Aleksander Morgado 9ba71b7472 dms: implement "List Stored Images" request/response 2012-09-26 09:45:42 +02:00
Aleksander Morgado 45b3dfc67f dms: implement "Get Firmware Preference" request/response 2012-09-26 09:45:42 +02:00
Aleksander Morgado c4a85b1f96 qmi-codegen: don't issue the array element clear function on 'Input' arrays
When an array is required to be passed in an input TLV, the user who created it
is responsible for freeing it. Therefore, we should not dump the static array
element clear function in these cases, or these unused methods will end up
breaking the compilation.
2012-09-26 09:45:42 +02:00
Aleksander Morgado a336eca159 libqmi-glib,tests: new tests to check parsing valid/invalid QMI messages 2012-09-26 09:25:06 +02:00
Aleksander Morgado f9f91b7fe7 message: document the section 2012-09-26 09:25:06 +02:00
Aleksander Morgado 9bc830ed2b message: `QmiMessage' objects are always valid
We make sure that every `QmiMessage' object out there is valid according to our
now internal message_check(). Therefore, it's pointless to run the validity
checks in getters, so remove those.
2012-09-26 09:25:06 +02:00
Aleksander Morgado 48f5f06b20 message: the `QmiMessage' is now a `GByteArray'
Why have our own ref-counted byte array when we can use the default glib one?
2012-09-26 09:25:06 +02:00
Aleksander Morgado 2947d4f6e5 message: use a modifiable `GByteArray' in `qmi_message_new_from_raw ()'
Passing a modifiable `GByteArray' allows us to run the validity check as soon as
we create the `QmiMessage', given that we can remove the read chunk of data from
the input buffer directly. This removal takes place both when the QMI message is
valid and invalid.
2012-09-26 09:25:06 +02:00
Aleksander Morgado c3c3acb3e6 message: improve header readability 2012-09-26 09:25:06 +02:00
Aleksander Morgado 7d3b6b3385 message: cleanup `QmiMessage' content getters 2012-09-26 09:25:05 +02:00
Aleksander Morgado 06fc47d42a message: cleanup `QmiMessage' life cycle helpers 2012-09-26 09:25:05 +02:00
Aleksander Morgado 9979a484e5 message: don't expose implementation helper methods
Don't expose methods which aren't needed out of the QmiMessage implementation.
2012-09-26 09:25:05 +02:00
Aleksander Morgado 27ce79a38b message: swapped buffer/length variables in `qmi_message_get_tlv_printable()' 2012-09-26 09:25:05 +02:00
Aleksander Morgado f88c6029d0 message: renamed `qmi_message_tlv_foreach()' to `qmi_message_foreach_raw_tlv()' 2012-09-26 09:25:05 +02:00
Aleksander Morgado d6613195a9 message: renamed `qmi_message_tlv_add()' to `qmi_message_add_raw_tlv()'
Also swapped length and buffer variables; it no longer follows the 'TLV' name
(type,length,value), but it's more consistent with other interfaces where
buffer is given first and then the length.
2012-09-26 09:25:05 +02:00
Aleksander Morgado 3347c00dab message: renamed `qmi_message_tlv_get()' to `qmi_message_get_raw_tlv()'
Also made it return directly a pointer to the raw data buffer.
2012-09-26 09:25:05 +02:00
Aleksander Morgado d7b05576a9 libqmi-glib,utils: use constant buffer pointer when reading variables
The contents of the input buffer are never modified when reading variables from
it, so better use a constant pointer in the methods doing it.

What it does change is the pointer to the current position in the constant
buffer.
2012-09-26 09:25:05 +02:00
Shawn J. Goff b4f01b63dd libqmi-glib,tests: add suffixes to end of literals
The compiler doesn't know the type of literals and may try to fit it
into a slot that is too small.  This adds suffixes to the long long and
unsigned long long literals.
2012-09-25 17:34:56 +02:00
Aleksander Morgado ec138d4f8d qmi-message: fix minimum size of buffer needed to read a QMI message
The buffer must contain *at least* the initial 1-byte marker plus the length
reported by the QMUX header. The minimum size check was wrong for 2 bytes, which
could cause errors when trying to decode a message without all bytes.

Can easily be triggered using 1 for the BUFFER_SIZE in QmiDevice.
2012-09-24 12:08:27 +02:00
Aleksander Morgado 170d8548e7 dms: new 'unknown' operating mode
Modems seem to report 0xFF when the operating mode is unknown or if it cannot
be retrieved.
2012-09-24 11:52:05 +02:00
Aleksander Morgado 8c76524f26 dms: rename the 'resetting' operating mode to 'reset'
This mode is not just used for notiying a transition, it can also be used to
wake up the modem from an 'offline' state:

    $ sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode=offline
    [/dev/cdc-wdm0] Operating mode set successfully

    $ sudo qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode
    [/dev/cdc-wdm0] Operating mode retrieved:
    	Mode: 'offline'
    	Reason: 'unknown'
    	HW restricted: 'no'

    $ sudo qmicli -d /dev/cdc-wdm0 --dms-set-operating-mode=reset
    [/dev/cdc-wdm0] Operating mode set successfully

    $ sudo qmicli -d /dev/cdc-wdm0 --dms-get-operating-mode
    [/dev/cdc-wdm0] Operating mode retrieved:
    	Mode: 'online'
    	HW restricted: 'no'
2012-09-24 09:17:07 +02:00
Aleksander Morgado 8cdc317238 qmi-codegen: fix error reporting when failed parsing JSON
If we get an error parsing a JSON file we really want to have the exact line
number where the error happened, so don't just skip the comment lines and
substitute them with an empty line instead so that the line numbers don't
change.
2012-09-24 07:46:01 +02:00
Aleksander Morgado 0331ddf28f qmi-codegen: ensure helper methods get always generated
For those variables which are containers of other variables (struct, sequence
and array), ensure we call `emit_helper_methods()' in order to generate variable
specific dispose() helpers and such.

This fixes the case of nested arrays of structs (arrays of structs with arrays of
structs whithin).
2012-09-24 07:45:57 +02:00
Mike Frysinger e853e761db use $PKG_CONFIG
The build system sets up this variable for us, so use it rather than
hardcoding "pkg-config" which might be the wrong one.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-09-24 04:30:44 +02:00
Aleksander Morgado 201e0cea5f qmi-codegen: for strings, use 'size-prefix-format' instead of 'length-prefix-size'
Use the new 'size-prefix-format' property to specify whether the length prefix
variable is a 'guint8' or a 'guint16'.

We therefore consolidate the way how this length prefix variable is specified in
both arrays and strings.

So, instead of:
    "length-prefix-size" : "16"

We now just do:
    "size-prefix-format" : "guint16"
2012-09-19 12:06:28 +02:00
Aleksander Morgado 7345ca6aaf qmi-codegen: for arrays, use a new 'size-prefix-format' instead of 'array-size'
The 'array-size' property was used to define an implicit variable to be found at
the beginning of every array. This property expected a dictionary with one
single 'format' key.

Instead of this setup, create a new 'size-prefix-format' property which directly
expects the format string of the variable to be used as array-length indicator.

So, instead of:
    "array-size" : { "format" : "guint16" }

We can now just use:
    "size-prefix-format" : "guint16"

Also, remove the explicit size definitions when the format is "guint8", as that
is the default already when none specified and the array is not of fixed size.
2012-09-19 12:06:28 +02:00
Aleksander Morgado dd82d6c92d qmi-codegen: fix invalid `g_array_unref()' calls in generated code 2012-09-19 08:52:02 +02:00
Aleksander Morgado c0bdb9df56 qmi-device: plug memleak, always need to free input containers 2012-09-18 18:55:59 +02:00
Aleksander Morgado 8a90c928a7 qmi-codegen: fix printable indications 2012-09-18 18:51:53 +02:00
Aleksander Morgado a2844ab041 qmi-codegen: fix memleak in generated code
The contents of the containers were not being freed properly.
2012-09-18 18:51:34 +02:00
Aleksander Morgado 243686a044 pds: NMEA string length is given as a 16 bit uint in the extended version
This seems quite useless, as we know that the maximum NMEA trace length is 200
characters, but anyway.
2012-09-18 13:14:38 +02:00
Aleksander Morgado f4321400c1 pds: implement "Get/Set Auto Tracking State" requests/responses 2012-09-18 13:14:38 +02:00
Aleksander Morgado 202acdbdd2 pds: implement "Get/Set GPS Service State" requests/responses 2012-09-18 13:14:38 +02:00
Aleksander Morgado c8137b6d0f pds: new TODO to include parsing all TLVs in the "Event Report" indication
The GPS module can give us already processed information in addition to the raw
NMEA traces, including GPS/UTC date, latitude/longitude, DOPs...

Add a TODO task to process these additional TLVs, which will require changes in
the codegen in order to handle single-precision and double-precision float
number reading.
2012-09-18 13:14:38 +02:00