After calling fdopendir "the file descriptor is under the control of the
system" and calling closedir(class_dir) already closes class_fd, so
let's not try to close it again.
Just close class_fd when fdopendir fails and remove the close call from
the regular exit path.
Null terminate firmware_value string to prevent
strlen() read past the end of buffer.
Change-Id: I57cd01c4d0c58c6057872bc4b36129f09bc034a3
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
On AOSP, /tmp is not available. Use /data/vendor instead
for temporary files.
Change-Id: I1d6ebd669573b3c3134e6da943ea9355ed83a3fe
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Signed-off-by: John Stultz <john.stultz@linaro.org>
The tftp clients in the modem requests files from either /readwrite or
/readonly/firmware/image, but as the wlanmdsp.mbn file requested is
signed with a vendor specific key these paths needs to be translated.
/readwrite is translated to /tmp/tqftpserv for now and the
/readonly/firmware/image is translated to a search for the requested
file alongside any of the remoteproc firmware files. The result is that
the wlanmdsp.mbn can be stored in linux-firmware alongside it's
device/vendor specific modem firmware.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Some mechanism for toggling the verbosity of the prints should be
introduced, but for now just comment out all the debug prints.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
When during a read we close the socket as we send the last block the
remote will be notified about the closure and consider the transfer
incomplete. Leave the socket open until we receive a EOF error from the
remote side.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
The two include files was dropped during development but lingered in my
repository, remove the include of them - and define MAX(x, y).
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Introduce a prototype of the tqftpserv, a server implementing trivial
file transfer protocol over AF_QIPCRTR.
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>