Transition all calls to hdlc_enqueue on the client out-queue to use
dm_send(). This reduces the need for clients to know the workings of the
transmition and knowledge of the diag_client struct.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Move common helpers related to "diag clients" into a "Diagnostics
Monitor" implementation. This becomes necessary in order to support
non-HDLC encoding between the DM and device transparently to the
rest of the implementation.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
In order to support any sort of fragmentation in a stream based
transport, such as TCP/IP, the data is read into a circular buffer and
the HDLC decoder is turned into a reentrant consumer of said circular
buffer.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This introduces a circular buffer and a read operation to store stream
data, from e.g. a TCP stream.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Split the two code paths related to handling of HDLC encoded vs raw
packets coming from the remote processor, this in order to facilitate
further rework of the HDLC decoder.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
As we don't support dropping the HDLC encoding on the pipe between diag
and the DM we should encode the messages before putting them on the
wire. This was accidentally changed in a previous commit, but QXDM on
Mac doesn't seem to care about this.
Fixes: ed3c97ac76 ("diag: Add dynamic peripheral support")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The choice of encoding for outgoing messages is that of the peripheral,
so move this to the peripheral implementation to hide this from the
router.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
As the code was moved around the wrong variable was used as read file
descriptor. Fix this.
Fixes: 258e749d6f ("diag: transport: Add support for UART connection to host PC")
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The mask pointer was not freed, do this and simplify the code by
replacing the malloc with alloca().
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The response object wasn't freed, use alloca() instead to allocate the
object on the stack. Also replace strncpy with strcpy as we specifically
allocate buffers sized to the two strings.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The version id response consists of a command id and a hard coded
version id, so simplify the implementation.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
This example of udev rules creates creates human readable names for
rpmsg_char control and endpoint device nodes as well as automatically
create endpoint devices for the various DIAG related channels found on
MSM8916.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The response definition for OP_GET_BUILD_MASK was missing the range,
so add this and the associated logic. And while reworking that tidy up
the implementation a little bit.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Moved the incoming peripheral packet handling to the scope of the
peripheral. Note that kept the essentially identical handlers separate
for debugging and possible future deviation in handling.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Implemented and registered a handler for the Event Report Control command
request.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved implementation to common_cmds.c,
removed uncessary error handling of unkown status values,
use return value to return bad command errors]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Implemented and registered a handler for the Event Set Mask command
request.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved implementation to common_cmds.c,
replaced posix_memalign with malloc,
use return value to send bad response,
provide broadcast helper]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Implemented and registered a handler for the Event Get Mask command
request.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved implementation to common_cmds.c,
replace posix_memalign with malloc,
use return code to signal errors]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Implemented and registered a handler for the Extended Message
Configuration command request.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Replace posix_memalign with malloc,
use return value to respond with error message,
moved implementation to common_cmds.c,
add peripheral broadcast helper for message masks,
reworked GET_MSG_MASK to not modify the incoming buffer]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Implemented and registered a handler for the Logging Configuration command
request.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Move handler to common_cmds.c,
abstract broadcasting the logmask to all peripherals,
replace posix_memalign with malloc]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Added initialisation of masks and broadcasting of MSG masks to new
peripherals.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Split out common_cmds handling to separate commit,
broadcast message masks when new peripherals arrive,
replace posix_memalign with malloc]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Increased buffer size to accommodate for masks in command packets.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Extracted from another patch]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
1) Added masks support to features mask.
2) Implemented a call to create and send LOG mask control response packet
for a specific equipment id to a peripheral.
3) Implemented a call to create and send MSG mask control response packet
for a specific ssid range to a peripheral.
4) Implemented a call to create and send EVENT mask control response packet
to a peripheral.
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Dropped posix_memalign usage, fixed up peripherial interfacing]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>