Andy Green [Sun, 23 Mar 2014 04:02:52 +0000 (12:02 +0800)]
ssl output handle want read write
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 23 Mar 2014 03:53:07 +0000 (11:53 +0800)]
ssl add SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER to server and client
gaby64 at githib found this option is necessary when using SSL with the
truncated send support
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 23 Mar 2014 03:41:15 +0000 (11:41 +0800)]
truncated send keep and grow truncation buffer
Also change from looking at wsi->truncated_send_malloc to see if we are in the middle of
dealing with a truncated send to looking for nonzero wsi->truncated_send_len
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 23 Mar 2014 03:21:51 +0000 (11:21 +0800)]
clean output.c a little
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Mon, 17 Mar 2014 10:40:08 +0000 (18:40 +0800)]
nonzero return from client parser is close
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 15 Mar 2014 02:39:29 +0000 (10:39 +0800)]
ssl client use OS CA root certs by default
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 15 Mar 2014 01:32:40 +0000 (09:32 +0800)]
client allow user callback to close on nonzero return
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 9 Mar 2014 03:49:21 +0000 (11:49 +0800)]
upgrade and improve storage efficiency of minilex
Until now minilex has done fine with providing a simple and fast header
decode state machine. But for HTTP2.0, new headers must be added and it
is already on the limit of table branching in 1 byte (already using +0xf8
of a max limit of 0xff).
This changes the minilex format to improve storage size without loss of
decode efficiency. It reduces the curent lws header table from 546 -> 403
bytes and upgrades the ability to increase table size by allowing jumps
to increase from the old limit of +255 states to +65535 states, which should
be enough for anything we ever want to do.
The max number of terminals is also increased from 128 to 2048.
Signed-off-by: Andy Green <andy.green@linaro.org>
Patrick Gansterer [Thu, 6 Mar 2014 10:57:50 +0000 (11:57 +0100)]
Add libwebsocket_cancel_service() to let a pending libwebsocket_service() return
Use poll() with a pipe instead of ppoll() to allow the stop polling
on all UNIX platforms.
John Clark [Sun, 2 Mar 2014 21:27:10 +0000 (16:27 -0500)]
openwrt: add cyassl options, update to LWS_ cmake syntax
Patrick Gansterer [Fri, 28 Feb 2014 15:29:28 +0000 (16:29 +0100)]
Fix installation into relative installation directory
This is required to make the other CPack generators like "ZIP" work.
Patrick Gansterer [Mon, 3 Mar 2014 11:21:20 +0000 (12:21 +0100)]
Define libwebsocket_write_http as a macro instead of inline
This solves two problems:
a) We do not need to use the keyword inline in the public header.
b) We avoid a possible warning about an unused static function.
Andy Green [Sun, 2 Mar 2014 23:21:30 +0000 (07:21 +0800)]
win32 provide empty declaration for inline
Signed-off-by: Andy Green <andy.green@linaro.org>
John Clark [Sun, 2 Mar 2014 21:27:10 +0000 (16:27 -0500)]
add cyassl options, update to LWS_ cmake syntax
John Clark [Sun, 2 Mar 2014 03:24:47 +0000 (22:24 -0500)]
Fix cyassl flags, update documentation
Patrick Gansterer [Fri, 28 Feb 2014 12:17:49 +0000 (13:17 +0100)]
Remove duplicated implementations for bzero()
Define bzero() in a central place if HAVE_BZERO is not set
Patrick Gansterer [Fri, 28 Feb 2014 11:37:52 +0000 (12:37 +0100)]
WSAGetLastError() instead of errno on Windows
Error codes set by Windows Sockets are not made available through the errno
variable. Checking them via WSAGetLastError() is the corret solution.
Patrick Gansterer [Fri, 28 Feb 2014 01:32:03 +0000 (02:32 +0100)]
Check if getenv() exists
Do not call getenv() on platform which do not support it
Patrick Gansterer [Fri, 28 Feb 2014 01:31:23 +0000 (02:31 +0100)]
Allow setting the HTTP proxy via creation info
If the user provides a proxy via the info object it is used
in favor over the http_proxy environment variable.
Andy Green [Fri, 28 Feb 2014 01:09:17 +0000 (09:09 +0800)]
fix missing include for time
Signed-off-by: Andy Green <andy.green@linaro.org>
Patrick Gansterer [Fri, 28 Feb 2014 00:31:39 +0000 (01:31 +0100)]
Enable compilation on Windows CE
Add a few ifdefs to support this additional platform.
Patrick Gansterer [Fri, 28 Feb 2014 00:29:28 +0000 (01:29 +0100)]
Correctly server non-ASCII filenames on Windows
Convert the filename from UTF-8 to UTF-16 and use CreateFileW() to open the file.
Patrick Gansterer [Thu, 27 Feb 2014 23:59:53 +0000 (00:59 +0100)]
Add dummy implementation when strerror() is missing
Use a simple empty string for platforms without an implementation.
Patrick Gansterer [Thu, 27 Feb 2014 23:57:19 +0000 (00:57 +0100)]
Cleanup include statements
Remove useless includes and add some preprocessor conditions for platform specific headers.
Patrick Gansterer [Thu, 27 Feb 2014 23:42:08 +0000 (00:42 +0100)]
Fix type checks in CMake
Use CHECK_TYPE_SIZE to check existence of types.
Patrick Gansterer [Thu, 27 Feb 2014 23:37:20 +0000 (00:37 +0100)]
Add explicit cast to setsockopt() calls
Implicit cast from size_t* to const char* throws an error on some compilers.
Patrick Gansterer [Thu, 27 Feb 2014 10:42:41 +0000 (11:42 +0100)]
Fix Content-Type header of http status response
The header for setting the mime type is called ‘Content-Type’ and not ‘Mime-Type’.
Patrick Gansterer [Thu, 27 Feb 2014 02:21:50 +0000 (03:21 +0100)]
Use native file functions on Windows
Add a special implementation with CreateFile(), ReadFile() and CloseFile()
for serving HTTP file request to allow compilation on all Windows platforms.
Patrick Gansterer [Wed, 26 Feb 2014 20:56:59 +0000 (21:56 +0100)]
Rename leave to cleanup
The name ‘leave’ can not be used on some Windows CE platforms, so rename it.
Patrick Gansterer [Wed, 26 Feb 2014 20:37:31 +0000 (21:37 +0100)]
Avoid calls to gettimeofday()
Add a new function to get the current time in microseconds, since gettimeofday() does not exist on Windows.
Keep the current implementation for the test applications.
Patrick Gansterer [Wed, 26 Feb 2014 18:52:11 +0000 (19:52 +0100)]
Replace perror() with lwsl_warn()
Use the general logging function for printing error messages.
Patrick Gansterer [Wed, 26 Feb 2014 18:21:40 +0000 (19:21 +0100)]
Fix endian detection on non-linux systems
f975f736408f32e7384cf38270a7806e68d5e112 introduced inclusion of endian.h,
which is not a standard header. Only include it on Linux machines and
add similar includes for Apple and FreeBSD.
Patrick Gansterer [Wed, 26 Feb 2014 17:51:05 +0000 (18:51 +0100)]
Add missing LWS_VISIBLE to libwebsocket_set_timeout()
This aligns it with the style of all other function declarations.
Andy Green [Wed, 26 Feb 2014 23:28:45 +0000 (07:28 +0800)]
unconfuse quoting in CMakeLists.txtt
via Marjan Tomas https://github.com/warmcat/libwebsockets/issues/67
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 26 Feb 2014 23:19:21 +0000 (07:19 +0800)]
revert wrong fix visibility of return_http_status
Signed-off-by: Andy Green <andy.green@linaro.org>
Joakim Soderberg [Mon, 24 Feb 2014 17:23:00 +0000 (18:23 +0100)]
Fix windows compilation.
Gabriel Gritsch [Sat, 22 Feb 2014 10:00:28 +0000 (18:00 +0800)]
use SO_REUSEADDR on windows since supposedly ok now
Andy Green [Fri, 21 Feb 2014 10:51:38 +0000 (18:51 +0800)]
fix visibility of return_http_status
From "DevYourWorld" on github
https://github.com/warmcat/libwebsockets/issues/64#issuecomment-
35720037
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Fri, 21 Feb 2014 10:48:05 +0000 (18:48 +0800)]
fix WITHOUT_CLIENT install in CMake
Via "DevYourWorld" on github
https://github.com/warmcat/libwebsockets/issues/64#issuecomment-
35719084
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Fri, 21 Feb 2014 10:45:45 +0000 (18:45 +0800)]
update cmake opts in README.build
via "DevYourWorld" on github
https://github.com/warmcat/libwebsockets/issues/64
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Fri, 21 Feb 2014 10:43:42 +0000 (18:43 +0800)]
interface_to_sa no longer server only
Via "DevYourWorld" on github
https://github.com/warmcat/libwebsockets/issues/64
Signed-off-by: Andy Green <andy.green@linaro.org>
Craig McQueen [Wed, 19 Feb 2014 23:27:11 +0000 (10:27 +1100)]
Call libwebsocket_set_timeout() before callback LWS_CALLBACK_HTTP.
This allows the LWS_CALLBACK_HTTP callback to override the timeout
with libwebsocket_set_timeout() if it wants.
Mattias Lundberg [Tue, 18 Feb 2014 09:06:57 +0000 (10:06 +0100)]
Add support to binding client to interface.
Joakim Soderberg [Tue, 18 Feb 2014 12:38:14 +0000 (13:38 +0100)]
Fix compilation on Windows.
C89 which Microsofts compiler only support does not allow variable
declarations anywhere but at the start of a scope.
Also, only try to copy the test-server files if they actually exists. For
instance the OpenSSL cert generation fails if you run cmake under the git
bash shell on Windows (won't work with the unix method either) so that
file will be missing... This would result in a compilation error when
tests where turned on.
Craig McQueen [Tue, 18 Feb 2014 22:24:17 +0000 (09:24 +1100)]
Add LWS_VISIBLE to libwebsocket_set_timeout() so it can be used externally.
Andy Green [Sat, 15 Feb 2014 17:52:50 +0000 (01:52 +0800)]
add missing CMake pieces
Signed-off-by: Andy Green <andy.green@linaro.org>
Michael Haberler [Sat, 15 Feb 2014 12:33:46 +0000 (20:33 +0800)]
document new extpoll apis
Michael Haberler [Sat, 15 Feb 2014 12:21:02 +0000 (20:21 +0800)]
update test server for new extpoll
Michael Haberler [Sat, 15 Feb 2014 12:19:26 +0000 (20:19 +0800)]
change extpoll in lib to new way
Michael Haberler [Sat, 15 Feb 2014 12:18:24 +0000 (20:18 +0800)]
replace old extpoll callbacks with LWS_CALLBACK_CHANGE_MODE_POLL_FD
Michael Haberler [Sat, 15 Feb 2014 12:15:55 +0000 (20:15 +0800)]
define struct libwebsocket_pollargs
Andy Green [Sat, 15 Feb 2014 11:25:50 +0000 (19:25 +0800)]
add outermost wsi lifetime callbacks
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 15 Feb 2014 08:49:41 +0000 (16:49 +0800)]
LWS_CALLBACK_USER
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 15 Feb 2014 08:36:38 +0000 (16:36 +0800)]
libwebsocket_callback_all_protocol
Signed-off-by: Andy Green <andy.green@linaro.org>
Gabriel Gritsch [Sat, 15 Feb 2014 08:20:25 +0000 (16:20 +0800)]
add const http write helper
Since libwebsocket_write doesn't change the source buffer in HTTP protocol,
we can have a little helper to hide the harmless cast
Andy Green [Sat, 15 Feb 2014 08:00:37 +0000 (16:00 +0800)]
fix zero length ping pong
Signed-off-by: Andy Green <andy.green@linaro.org>
Daniel Ludwig [Thu, 13 Feb 2014 23:17:46 +0000 (00:17 +0100)]
missing endian preprocessor defines on Linux environments
Andy Green [Sat, 15 Feb 2014 06:45:14 +0000 (14:45 +0800)]
update version in libwebsockets.pc
Signed-off-by: Andy Green <andy.green@linaro.org>
arnaudviala [Sat, 15 Feb 2014 06:39:40 +0000 (14:39 +0800)]
fix memory leak
Fix a possible memory leak in
libwebsocket_context_destroy() when compiled without extension support.
Andy Green [Sat, 15 Feb 2014 06:36:02 +0000 (14:36 +0800)]
add timeout between accept and negotiation
Signed-off-by: Andy Green <andy.green@linaro.org>
Alexandre Erwin Ittner [Fri, 7 Feb 2014 01:15:51 +0000 (23:15 -0200)]
Fix documentation for LWS_CALLBACK_FILTER_NETWORK_CONNECTION
At the time callback LWS_CALLBACK_FILTER_NETWORK_CONNECTION is called,
there is no client connection information yet, so the parameter wsi
still pointing to the main server connection. Add an description of
this behavior to the documentation.
Jakob Flierl [Mon, 27 Jan 2014 11:37:47 +0000 (12:37 +0100)]
make force_exit volatile.
Instruct the compiler to always access force_exit in memory.
Joakim Soderberg [Sat, 15 Feb 2014 05:48:56 +0000 (13:48 +0800)]
cmake and other fixes
martell [Wed, 22 Jan 2014 19:01:14 +0000 (19:01 +0000)]
Removed needless VS projects now that cmake is fixed
martell [Sat, 15 Feb 2014 05:37:08 +0000 (13:37 +0800)]
additional mingw fixes
Signed-off-by: martell <martellmalone@gmail.com>
martell [Wed, 22 Jan 2014 18:17:03 +0000 (18:17 +0000)]
fixed windows build
Andy Green [Sat, 15 Feb 2014 04:46:33 +0000 (12:46 +0800)]
trac 53 mingw ssize_t redef
Signed-off-by: Andy Green <andy.green@linaro.org>
John Clark [Sun, 9 Feb 2014 23:24:29 +0000 (07:24 +0800)]
fix LWS_NO_SERVER compile
Signed-off-by: John Clark <inidev@gmail.com>
Michael Haberler [Fri, 10 Jan 2014 22:40:14 +0000 (23:40 +0100)]
Subject: [PATCH] libwebsockets.h: use _GNU_SOURCE instead of __USE_GNU
this collides with use of features.h which says '#define __USE_GNU 1'
see also second answer:
http://stackoverflow.com/questions/7296963/gnu-source-and-use-gnu?answertab=active#tab-top
nononame [Sat, 11 Jan 2014 05:12:34 +0000 (13:12 +0800)]
fix lws_lookup off by one
Signed-off-by: nononame <nononame@le-huit.fr>
Andy Green [Sat, 11 Jan 2014 04:37:07 +0000 (12:37 +0800)]
ppoll fix signal mask sense
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Wed, 25 Dec 2013 08:34:37 +0000 (16:34 +0800)]
Use ppoll to allow signals to wake service loop early on change of pollfd event
To enable this code you need to force LWS_HAS_PPOLL to de defined.
#defining it at the top of libwebsockets.c is enough.
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 21 Dec 2013 03:18:34 +0000 (11:18 +0800)]
unify all pollfd lock management
This provides a single place for pollfd event changing,
external locking for that and extpoll management.
It saves about 85 lines of duplication and simplifies the callers.
Signed-off-by: Andy Green <andy.green@linaro.org>
tmu [Sat, 21 Dec 2013 02:33:33 +0000 (10:33 +0800)]
openwrt add build makefile
http://libwebsockets.org/trac/libwebsockets/ticket/50
Signed-off-by: tmu <tmu-INVALID@invalid.com>
Nikolay Dimitrov [Sat, 21 Dec 2013 02:22:17 +0000 (10:22 +0800)]
fix dropmask dereference even when NULL
Signed-off-by: Nikolay Dimitrov <ndimitrov@setelis.com>
pmcdona [Wed, 18 Dec 2013 02:17:25 +0000 (10:17 +0800)]
Trac 53 minw update
http://libwebsockets.org/trac/libwebsockets/ticket/53
Andy Green [Wed, 18 Dec 2013 01:48:26 +0000 (09:48 +0800)]
add locking callback for fds
This adds two new callbacks in protocols[0] that are optional for allowing limited thread
access to libwebsockets, LWS_CALLBACK_LOCK_POLL and LWS_CALLBACK_UNLOCK_POLL.
If you use them, they protect internal and external poll list changes, but if you want to use
external thread access to libwebsocket_callback_on_writable() you have to implement your
locking here even if you don't use external poll support.
If you will use another thread for this, take a lot of care about managing your list of
live wsi by doing it from ESTABLISHED and CLOSED callbacks (with your own locking).
Signed-off-by: Andy Green <andy.green@linaro.org>
James Devine [Sat, 14 Dec 2013 03:41:29 +0000 (11:41 +0800)]
Optionally allow non-SSL connections on same port as SSL
If enabled one listening socket will accept both SSL and plain HTTP connections.
Do not enable if you regard SSL handshake as some kind of security, eg, use
client-side certs to restrict access.
AG: changed flag names, added extra comments, changelog, add -a in test server
Signed-off-by: James Devine <fxmulder@gmail.com>
Signed-off-by: Andy Green <andy@warmcat.com>
James Chen [Sat, 14 Dec 2013 03:35:01 +0000 (11:35 +0800)]
windows use msvc baestd and ssize_t from there
Signed-off-by: James Chen <jianhua.chen@cocos2d-x.org>
Christian Wyss [Tue, 10 Dec 2013 13:34:30 +0000 (21:34 +0800)]
distinguish error from truncation
Signed-off-by: Christian Wyss <christian.wyss@gfk.com>
John Harrison [Tue, 10 Dec 2013 13:20:03 +0000 (21:20 +0800)]
ie10 lws url workaround
Signed-off-by: John Harrison <john@h-agtec.com>
mroszko [Tue, 10 Dec 2013 13:15:00 +0000 (21:15 +0800)]
NO_EXTENSIONS fixes
Trac #52
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Mon, 9 Dec 2013 06:16:17 +0000 (14:16 +0800)]
handle EAGAIN during send
This patch deploys the truncated send work to buffer output in case
either send() or the SSL send return a temporary "unable to send"
condition even though they signalled as writeable.
I added a by-default #if 0 test jig which enforces only half of what
you want to send is sendable, this is working when enabled.
One subtle change is that the pipe reports choked if there is any
pending remaining truncated send. Otherwise it should be transparent.
Hopefully...
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Mon, 9 Dec 2013 03:27:07 +0000 (11:27 +0800)]
solve broken partial file sends
We can't force the wsi state to HTTP_BODY without considering the callback
may already have set the state to sending a file.
This fixes the bug that we can get stalled in the test app at
"choked before able to send whole file"
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 8 Dec 2013 13:26:52 +0000 (21:26 +0800)]
interpret zero rx buffer size as default in http
Reported by pystub
https://github.com/warmcat/libwebsockets/pull/33#issuecomment-
29578258
Signed-off-by: Andy Green <andy.green@linaro.org>
Andreas Pakulat [Mon, 4 Nov 2013 11:51:50 +0000 (12:51 +0100)]
protect the label with an ifdef
The only part that actually goes to this label is inside such an ifdef,
so building without extension support makes gcc bail out since an unused
label is considered an error in this project.
Jonti [Fri, 22 Nov 2013 11:14:26 +0000 (13:14 +0200)]
Subject: [PATCH] Fixed the logging of OpenSSL errors to report the correct
details for the current OpenSSL error
kapejod [Tue, 19 Nov 2013 12:38:16 +0000 (13:38 +0100)]
Support for HTTP POST.
Rewritten by Andy Green to use chunks, add timeout, use extra states in handshake not parser.
Signed-off-by: Andy Green <andy@warmcat.com>
prasannateamf1 [Wed, 13 Nov 2013 01:21:01 +0000 (17:21 -0800)]
support for client authentication based on certs
Andy Green [Wed, 13 Nov 2013 00:03:05 +0000 (08:03 +0800)]
case insensitive http headers
Svetlin wrote on github
According to RFC2616, all header field names in both HTTP requests and HTTP responses are case-insensitive. But libwebsockets uses a case-sensitive compare.
Reproduce:
Run libwebsockets against a server that sends all of its HTTP header field names in lower-case (for example: https://github.com/extend/cowboy). libwebsockets reports an error. The expected behavior is no errors reported and a successful handshake procedure.
This changes the parser reference table in minilex to all lower case.
The code to walk the parser tables then just forces a tolower on the incoming chars.
This (and minilex tables) only applies to header names.
Reported-by: svetlin-mladnov <?@github>
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Tue, 12 Nov 2013 23:45:17 +0000 (07:45 +0800)]
introduce uri args
If the URI coming from the client contains '?' then
- the URI part is terminated with a '\0'
- the remainder of the URI goes in a new header WSI_TOKEN_HTTP_URI_ARGS
- the remainder of the URI is not subject to path sanitization measures (it
still has %xx processing done on it)
In the test server, http requests now also dump header information to stderr.
The attack.sh script is simplified and can now parse the test server header dumps.
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Tue, 12 Nov 2013 22:53:21 +0000 (06:53 +0800)]
back up directory paths properly
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 10 Nov 2013 23:30:33 +0000 (07:30 +0800)]
real http status codes update attack.sh
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 10 Nov 2013 22:14:52 +0000 (06:14 +0800)]
uri santitation fixes deal with single dot update attack.sh
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sun, 10 Nov 2013 07:15:21 +0000 (15:15 +0800)]
translate and protect uri test sever use uri path
This translates %xx in the GET uri and removes /.. and /... type sequences along with
translating // or /// etc to /.
Since the result is hopefully secure, it also changes the test server to actually use
the uri path pasted on a resource directory without whitelisting.
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 9 Nov 2013 03:59:56 +0000 (11:59 +0800)]
introduce LWS_CALLBACK_FILTER_HTTP_CONNECTION
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 9 Nov 2013 03:06:29 +0000 (11:06 +0800)]
add cookie example to test server
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 9 Nov 2013 03:04:35 +0000 (11:04 +0800)]
allow other headers in http send file
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 9 Nov 2013 03:40:32 +0000 (11:40 +0800)]
make ah available in http callback properly
Signed-off-by: Andy Green <andy.green@linaro.org>
Andy Green [Sat, 9 Nov 2013 02:09:09 +0000 (10:09 +0800)]
improve minilex use external parsing header
Clean up minilex
Move the header output to stdout
Introduce lexfile.h as the header output
Use lexfile.h in both minilex itself and lws
Add the following header support
"Accept:",
"If-Modified-Since:",
"Accept-Encoding:",
"Accept-Language:",
"Pragma:",
"Cache-Control:",
"Authorization:",
"Cookie:",
"Content-Type:",
"Date:",
"Range:",
"Referer:"
Signed-off-by: Andy Green <andy.green@linaro.org>