1
0
Fork 0
mirror of https://github.com/warmcat/libwebsockets.git synced 2025-03-09 00:00:04 +01:00
Commit graph

3778 commits

Author SHA1 Message Date
Andy Green
a54480ba93 lws_display: SSD1675B 2022-04-10 06:56:12 +01:00
Andy Green
c7ebe639be lws-display: UC8176 EPD driver 2022-04-10 06:56:02 +01:00
Andy Green
9b47b768f4 lws_display: SPD1656 driver
Add SPD1656 SPI driver as used in 5.65 inch 7-colour waveshare panel.
2022-03-25 08:18:30 +00:00
Andy Green
d6c4e606e7 ssd1306: adapt blit for DMA 2022-03-25 08:18:30 +00:00
Andy Green
019da2e539 ili9341: adapt blit for DMA
This is the SPI client chip in the LCD displays on ESP32 WROVER-KIT and S2
Kaluga.

Adapt it to allocate using DMA-able allocators and to use the new blit op
conventions for update sequencing
2022-03-25 08:18:30 +00:00
Andy Green
e3743d47b4 lws_spi: Add esp32 DMA support
This provides an alternative esp32-specific SPI driver with ops that can be
swapped in place of the gpio bitbang one.

The pinmux info and lws gpio driver and other data in the spi bitbang
struct are used as-is by the DMA one.

New ops are provided which are able to allocate and free DMA-able memory so
the device drivers can prepare directly usable buffers.  Bounce through to
DMA-able buffers is also transparently supported.
2022-03-25 08:18:30 +00:00
Andy Green
7db51f4096 esp32s2: wifi and pwm
s2 ROM needs an explicit set_mode() as tested on Kaluga
Adapt PWM but unable to test as Kaluga has a smart RGB LED unlike Wrover
Kit
2022-03-25 08:18:30 +00:00
Andy Green
fcbc0dafa4 lws_ota 2022-03-25 08:18:30 +00:00
Andy Green
7847377750 sul: add clear advice for zombie suls 2022-03-25 08:18:30 +00:00
Andy Green
2355b30fe4 h1: remove assert on unexpected POLLIN state just hangup 2022-03-25 08:18:30 +00:00
Andy Green
24fdd1f225 base64: improve sanity checking
Improve rejection of invalid chars
2022-03-25 08:18:30 +00:00
Andy Green
432bbf1d97 logs: freertos adds free heap to all logs 2022-03-25 08:18:29 +00:00
Andy Green
aea45fb246 ss: metrics: clean any unused metrics tags on ss destroy 2022-03-25 08:18:29 +00:00
Andy Green
6a65d76779 hex-to-bin: api with input length 2022-03-25 08:18:29 +00:00
Andy Green
497e25df83 ss: http: facilitate back-to-back transactions
We need to insert a CONNECTING state if we're going again.
2022-03-25 08:18:29 +00:00
Andy Green
f8132e23dc nsc: fall back to internal headers when no stash 2022-03-25 08:18:29 +00:00
Andy Green
c11e31547f ss: introduce sinks 2022-03-25 08:18:29 +00:00
Andy Green
c24148826b coverity: change ss handle priv style
Coverity is able to misunderstand &h[1] to be a dereference
of h, when it is just (h + 1).

Adapt places where we use this style to get a pointer to the
SS priv data to use (h + 1).
2022-03-25 08:18:29 +00:00
Andy Green
a3a4253ba9 dlo: lws_dlo_fops file_ops
This adds an optional lws VFS layer that exposes the named dlo object
registry.  So you can register a blob like a JPG named "my.jpg", and
access it on the vfs as, eg,  /dlofs/my.jpg (or file:///dlofs/my.jpg
if using the SS file:// support for VFS namespace).
2022-03-25 08:18:29 +00:00
Andy Green
e3dca87f23 lws_display: add display list / DLO support
This adds optional display list support to lws_display, using DLOs (Display
List Objects).  DLOs for rectangle / rounded rectangle (with circle as the
degenerate case), PNGs, JPEG and compressed, antialiased bitmapped fonts
and text primitives are provided.

Logical DLOs are instantiated on heap and listed into an lws_display_list
owner, DLOs handle attributes like position, bounding box, colour +
opacity, and local error diffusion backing buffer.

When the display list is complete, it can be rasterized a line at a time,
with scoped error diffusion resolved, such that no allocation for the
framebuffer is required at any point.  DLOs are freed as the rasterization
moves beyond their bounding box.

Adds a platform registry binding names and other metadata to lws_display
fonts / PNGs / JPEGs.  Provides registration, destruction and best match
selection apis.
2022-03-25 08:18:29 +00:00
Andy Green
aa696773f0 lws_display: improve apis to use display_state and frac
Adapt disp ops to use lws_display_state_t instead of the const disp object.

Describe display area in pixels and mm using lws_fixed3232.
2022-03-25 08:13:48 +00:00
Andy Green
1d3ec6a3a1 lws-jpeg
Introduce a rewritten picojpeg that is able to operate statefully and
rasterize into an internal line ringbuffer, emitting a line of pixels
at a time to the caller.  This is the JPEG equivalent of the lws
PNG decoder.

JPEG is based around 8- or 16- line height MCU blocks, depending on
the chroma coding, mandating a corresponding internal line buffer
requirement.

Example total heap requirement for various kinds of 600px width jpeg
decoding:

  Grayscale:    6.5KB
  RGB 4:4:4:   16.4KB
  RGB 4:2:2v:  16.4KB
  RGB 4:4:2h:  31KB
  RGB 4:4:0:   31KB

No other allocations occur during decode.

Stateful stream parsing means decode can be paused for lack of input
at any time and resumed seamlessly when more input becomes available.
2022-03-25 08:13:48 +00:00
Andy Green
a74fe5d760 upng: split out gzip
The adapted upng has a very compact fully-stateful lws-aligned
implementation already.

Adapt it to also be buildable and operable standalone, and to
understand gzip headers.

Provide some apis to inflate gzip simply reusing opaque inflator
contexts from upng.

Provide an api test that inflates gzip files from stdin -> stdout
2022-03-25 08:13:48 +00:00
Andy Green
48907fca0a upng: rewrite for stateful stream decode
Add a rewritten version of upng that decodes statefully line by line, and so
does not require a bitmap buffer for the output.  This compares to original
upng approach that needs heap allocations for the input, the whole output
and intermediate allocations.

Instead of buffers for input, decompression and output, it only allocates
2 x lines of RGBA pixels (ie, a few KB), and 32KB of decompressed data for
backward references in the decoder, and decodes as needed into the 2-line
buffer to produce line rasterized results.  For a 600px width PNG, this is
just 40KB heap for the duration.
2022-03-16 12:59:48 +00:00
Andy Green
aadcd3c44a lws_fx: fixed point 3232 arithmetic
This introduces a fixed precision signed 32.32 fractional type that can
work on devices without an FPU.

The integer part works as an int32_t, the fractional part represents the
fractional proportion expressed as part of 100M, so 8 fractional decimal
digit precision which is more than enough for many applications.

Add and Sub are reasonably fast as they are scaled on to a combined
uint64_t, Multiply is a little slower as it takes four uint64_t multiplies
that are summed, and divide is expensive but accurate, done bitwise taking
up to 32 iterations involving uint64_t div and mod.
2022-03-15 10:28:09 +00:00
Andy Green
946b1fbff1 coverity: 2021-12-1 uplevel fixes 2022-03-15 10:28:09 +00:00
Andy Green
843ee10205 mbedtls: v3.1 reverts privacy of mbedtls_net_context fd
mbedtls seemed to realize that they went overboard with the privacy stuff
on v3.0 and removed some of it.  Introduce support for those members that
are only private on exactly v3.0 and unprotected before and after.
2022-03-15 10:28:09 +00:00
Andy Green
3ed01ab4c9 context_destroy: clean up early fail path 2022-03-15 10:28:09 +00:00
Andy Green
67931757f8 alloc: compressed backtrace instrumentation support
This adds apis that enable usage of compressed backtraces in heap
instrumentation.

A decompressor tool is also provided that emits a textual
call stack suitable for use with addr2line.
2022-03-15 10:28:09 +00:00
wayneonway
73b61f6a2e route: extend lws_route_uidx_t from 1 byte to 2 bytes 2022-03-15 10:28:09 +00:00
Andy Green
9011f913d5 netlink: always delete route if it exists
https://github.com/warmcat/libwebsockets/issues/2567
2022-03-15 10:28:09 +00:00
Andy Green
d408e67d05 pkgconfig: use appropriate static lib name 2022-03-15 10:28:09 +00:00
Andy Green
64144e0c15 ss: support VFS via file://
This gives you a way to access VFS files via a generic SS.

Typcially you would use the default streamtype having set the ${endpoint}
metadata to file://mypath/vpath.suffix or similar.

The lws VFS lets you register handlers for path prefixes (like /myvfsname)
or suffixes (like .zip).  Matches create a vfs fd that is bound to the
matching file_ops that receives the open, close, read, write etc
"syscalls" for lws VFS operations on the vfs fd.

This gives you a way not just to access files from the platform root
filesystem, but also VFS layers like DLO filesystem blobs, by name,
from a normal SS.
2022-03-15 10:28:09 +00:00
Andy Green
2de67dd0ae file_ops: vfs: support prefix matches and use of bound ops members
VFS needs some small updates... pass in the bound fops as well as the
context fops to the member callbacks.  ZIP_FOPS only cared about doing
operations on the platform / context vfs to walk the ZIP file, but other
uses are valid where we are doing operation inside the bound VFS itself.

Also, stash a cx pointer into file ops struct for convenience.
2022-03-15 10:28:09 +00:00
Luciano Iam
b61174b4b0 mingw: correct winsock recv() and send() buffer ptr type
This allows to build libwebsockets on MinGW. Winsock recv() and send()
expect non unsigned char* while lws uses uint_8*.

https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-send
https://docs.microsoft.com/en-us/windows/win32/api/winsock2/nf-winsock2-recv
2022-03-15 10:28:09 +00:00
Andy Green
6829dba9a1 http: server: mounts: dont assume Basic Auth if no FILE_OPS 2022-03-15 10:28:09 +00:00
Andy Green
24758bd479 ss: POLL to all retries failed is possible
It's possible we started POLL, but no connection could happen for some
reason, and we end in the window between POLL and trying the connection.
2022-03-15 10:28:09 +00:00
Andy Green
5c24f1edad ss: avoid POLL-POLL transition 2022-03-15 10:28:09 +00:00
Andy Green
445651b2c6 cgi: gracefully handle missing wsi->http.cgi 2022-03-15 10:28:09 +00:00
Andy Green
717272d65d h1: deal with WAITING_CONNECT in ops-h1
We don't normally see events on the wsi in this state, but it is possible
since warmcat.com lwsws asserted on it in WAITING_CONNECT.

Explicitly handle it so we don't blow up.
2022-03-15 10:28:09 +00:00
Andy Green
32698a2f4b lejp-conf: provide matches for block start paths
Also valgrind shows we should zero down the lejp context to avoid problems
with the wildcard stack
2022-03-15 10:28:09 +00:00
Andy Green
1b70ae9296 adns: bump DNS_MAX to 128 2022-03-15 10:28:09 +00:00
Andy Green
5985f817da lgtm.yml 2022-03-15 10:28:09 +00:00
Poppy
6c53da692e tls: libressl: refactor set_options to work with macro implementations
Libressl uses macros for set_options(), causing compilation failure.
Refactor the related code to work well with macro definitions for
these apis.

https://github.com/warmcat/libwebsockets/issues/2554
2022-03-15 10:28:09 +00:00
Andy Green
8cc4c1713d http: proxy server: move C99 VLA to heap 2022-03-15 10:28:09 +00:00
Chunho Lee
3af7a16531 ss: mqtt: add support for retained message 2022-03-15 10:28:09 +00:00
Andy Green
4bf39f55d4 h2: improve logging for zero length DATA with EOS 2022-03-15 10:28:09 +00:00
Andy Green
b9e290d70a ss: http: unreachable superfluous if we did DISCONNECTED 2022-03-15 10:28:09 +00:00
Andy Green
ba2441585d jit-trust: adapt for esp-idf pre v3 mbedtls
Ensure we still work with mbedtls_ssl_conf_verify() as well as
mbedtls_ssl_set_verify() if that's what we have got.

Make sure mbedtls tls validation is noisy and fast.

Disable Xenial + mbedtls in sai, it fails but not when the same
tests are run from the commandline.  Very few people will be
using Xenial (2016 Ubuntu release) with mbedtls.
2022-03-15 10:28:09 +00:00
Chunho Lee
3a98dbb918 ss: mqtt: fix wrong QoS value on Birth message 2022-03-15 10:28:09 +00:00