Commit Graph

39 Commits

Author SHA1 Message Date
Eyal Ilsar
2dfd76ed2b diag: router: Add handling of Event Report Control command (cmd_id=96)
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>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
b06f733fbb diag: router: Add handling of Event Set Mask (cmd_id=130)
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>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
c899297d36 diag: router: Add handling of Event Get Mask (cmd_id=129)
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>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
266bfc4a4f diag: router: Add handling of Extended Message Configuration (cmd_id=125)
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>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
2955443bcc diag: router: Add handling of Logging Configuration command (cmd_id=115)
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>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
c040e70aa9 diag: router: Added handling of common commands
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Split out from previous commit, added registration helper]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
2df3b16ae4 diag: router: Add support for centralised handling of masks commands
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>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
11b7deecf7 diag: router: Increase receive buffer sizes
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>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
d2d6ff67af diag: control: Add support for sending masks to peripherals
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>
2018-01-23 16:36:09 -08:00
Bjorn Andersson
3c0ec70b37 diag: Extract response forwarding code
Messages from the peripherals should be propagated to any registered
client, so extract this logic into its own function.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
d90a511b65 diag: masks: Add support for masks
Added support for managing masks.
Note that some masks are built from hardcoded lists but are also modified
at runtime and are kept in memory.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Omit debug prints, use malloc instead of posix_memalign]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
6edf2d5a0f diag: router: Add handling of Extended Build ID request (cmd_id=124)
Registered the Extended Build ID request command and implemented its
handler.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved implementation to app_cmds.c]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
20f2459f89 diag: router: Add handling of Version Number request (cmd_id=28)
Registered the Version Number request command and implemented its
handler.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved handler to app_cmds, changed registration function]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
465f028820 diag: router: Add infrastructure for apps command registration
1) Added command key generation macros.
2) Added a utility command registration call that creates a command
instance for a given key and adds it to the given commands list.

Change-Id: Ibc4f451cd60d7bb6a6e751137f50545a31645d5b
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
ce299a3b54 diag: router: Add support for subsystem dispatch command v2
Added support for handling subsystem dispatch command v2 with command
code of 128 (0x80).

Change-Id: I06d30d0ea6f529f9961095832e09ee3ee508ea6d
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
0474025c93 diag: router: Extend support for "bad" responses
Added support for generation of various error response packet with "bad"
command codes including:
0x13 - command not supported
0x14 - incorrect parameter value
0x15 - incorrect packet length

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Reworked mechanism for selecting error message]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
8e6ec12a65 diag: router: Separate the router layer
Move request command routing logic to separate file.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Omit debug mask pieces]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Bjorn Andersson
a8c793571f diag: Remove unused hdlc encoded buffer
Remove code that was left behind from prototyping, causing memory leaks
in some code paths.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:09 -08:00
Eyal Ilsar
eff5c09208 diag: transport: Add support for USB connection to host PC
Add the option to connect to a host PC connected via a USB cable.
Configure the USB via the following command line option:
-g <gadget device name[#serial number]>
The device name is typically /dev/ffs_diag.
Note that this is based on a user space erected driver using configfs and
requires a gadget and diag function file system nodes to be setup a priori.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved to usb.c, replaced transport wrapper]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:36:08 -08:00
Eyal Ilsar
258e749d6f diag: transport: Add support for UART connection to host PC
Add the option to connect to a host PC connected via a UART cable.
Configure the UART via the following command line option:
-u <uart device name[@baudrate]>
The device name is typically /dev/ttyMSM1 and the baud rate 115200.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Moved code to uart.c, modified initialization from main,
	made uart register iself as client]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:35:44 -08:00
Bjorn Andersson
a4f9c736a7 transport: Move client initialization to socket
Let the socket register itself as a client upon successfully connecting
to the remote, in order to isolate the interfacing with the socket from
the common code and group socket related handling in one place.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:35:24 -08:00
Eyal Ilsar
c8a0488edf diag: transport: Separate the socket read callback
Continued to consolidate the transport layer by moving the incoming
packet read to the separate file and delegating the command handling
back to the main code for now.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: omit new debug mask flags]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:35:24 -08:00
Eyal Ilsar
adcfe45ded diag: transport: Separate the socket connect call
First move in separating the transport layer from the main code so to
enable support for other connections besides socket based.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Retained original implementation,
	dropped now unnecessary includes from diag.c,
	moved implementation to socket.c]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:35:24 -08:00
Eyal Ilsar
99600316c1 diag: Respond to client's keep_alive
Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:35:24 -08:00
Eyal Ilsar
4b0a6e8dfe diag: Add missing command channel handler
Added a command channel handler similar to the data channel handler.

Signed-off-by: Eyal Ilsar <eilsar@codeaurora.org>
[bjorn: Wire up the new handler to the fd]
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-01-23 16:35:24 -08:00