Wykres commitów

23 Commity (f2140f94466f043677d58352bbecbdbe98e82d20)

Autor SHA1 Wiadomość Data
Paul Sokolovsky f2140f9446 extmod/mod{lwip,onewire,webrepl}: Convert to mp_rom_map_elem_t. 2017-07-29 18:24:16 +03:00
Damien George aa7be82a4d all: Don't include system errno.h when it's not needed. 2017-07-24 18:43:14 +10:00
Damien George 204ded848e extmod: Update for changes to mp_obj_str_get_data. 2017-03-29 12:56:45 +11:00
Damien George 93c4a6a3f7 all: Remove 'name' member from mp_obj_module_t struct.
One can instead lookup __name__ in the modules dict to get the value.
2016-09-22 00:23:16 +10:00
Paul Sokolovsky d2cc7c720b extmod/modwebrepl: set_password(): Raise exception for too long password. 2016-08-16 17:02:04 +03:00
Paul Sokolovsky e15fb33e10 extmod/modwebrepl: Add GET_VER operation to query MicroPython version. 2016-08-07 00:01:25 +03:00
Paul Sokolovsky ed500e4987 extmod/modwebrepl: Make GET_FILE operation non-blocking.
In the sense that while GET_FILE transfers its data, REPL still works.
This is done by requiring client to send 1-byte block before WebREPL
server transfers next block of data.
2016-08-05 22:57:50 +03:00
Paul Sokolovsky c16612ee87 extmod/modwebrepl: Factor out "GET" iteration to write_file_chunk(). 2016-08-05 22:53:10 +03:00
Paul Sokolovsky 2dd21d9a68 extmod/modwebrepl: Use mp_stream_close() method. 2016-07-23 00:52:35 +03:00
Paul Sokolovsky c880f91ac0 extmod/modwebrepl: Add readinto() method. 2016-07-02 14:05:37 +03:00
Paul Sokolovsky 07209f8592 all: Rename mp_obj_type_t::stream_p to protocol.
It's now used for more than just stream protocol (e.g. pin protocol), so
don't use false names.
2016-06-18 18:44:57 +03:00
Paul Sokolovsky 3a29db8e58 extmod/modwebrepl: Add close() method. 2016-05-20 21:32:41 +03:00
Paul Sokolovsky 7f7c84b10a py/stream: Support both "exact size" and "one underlying call" operations.
Both read and write operations support variants where either a) a single
call is made to the undelying stream implementation and returned buffer
length may be less than requested, or b) calls are repeated until requested
amount of data is collected, shorter amount is returned only in case of
EOF or error.

These operations are available from the level of C support functions to be
used by other C modules to implementations of Python methods to be used in
user-facing objects.

The rationale of these changes is to allow to write concise and robust
code to work with *blocking* streams of types prone to short reads, like
serial interfaces and sockets. Particular object types may select "exact"
vs "once" types of methods depending on their needs. E.g., for sockets,
revc() and send() methods continue to be "once", while read() and write()
thus converted to "exactly" versions.

These changes don't affect non-blocking handling, e.g. trying "exact"
method on the non-blocking socket will return as much data as available
without blocking. No data available is continued to be signaled as None
return value to read() and write().

From the point of view of CPython compatibility, this model is a cross
between its io.RawIOBase and io.BufferedIOBase abstract classes. For
blocking streams, it works as io.BufferedIOBase model (guaranteeing
lack of short reads/writes), while for non-blocking - as io.RawIOBase,
returning None in case of lack of data (instead of raising expensive
exception, as required by io.BufferedIOBase). Such a cross-behavior
should be optimal for MicroPython needs.
2016-05-18 02:41:45 +03:00
Paul Sokolovsky b8468d12a1 extmod/modwebrepl: Get rid of using strncpy(). 2016-05-02 20:52:34 +03:00
Paul Sokolovsky 859e4e94f3 extmod/modwebrepl: Add support for password.
Request for password then becomes mandatory part of the protocol.
2016-04-30 20:36:32 +03:00
Paul Sokolovsky 18775d3807 extmod/modwebrepl: Set debugging by default to off.
That's production setting. Also, extra UART output may affect behavior of
(subpar) network drivers.
2016-04-29 19:17:37 +03:00
Paul Sokolovsky b0f3ae58e7 extmod/modwebrepl: Add rate-limiting workaround for broken network drivers.
Like ESP8266 has.
2016-04-29 19:14:03 +03:00
Paul Sokolovsky 8811b0af9c extmod/modwebrepl: Use bigger socket receive buffer.
The smaller chunks we send (and receive), the more packets there to
receive, and higher chance to git internal packet buffer overflow in
WiFi driver.
2016-04-29 18:43:19 +03:00
Paul Sokolovsky b3bc2ee1b9 extmod/modwebrepl: More detailed debug output.
So detailed that even commented by default.
2016-04-29 17:37:40 +03:00
Paul Sokolovsky 473b639845 extmod/modwebrepl: GET_FILE: Send length-prefix chunk with one write().
A bit of optimization.
2016-04-29 17:35:21 +03:00
Paul Sokolovsky f41e1f1bb7 extmod/modwebrepl: Keep reading data when there's something to read.
EAGAIN should be returned only if underlying socket returned it. Wrap
existing read function into external loop to process all data available.
2016-04-29 01:05:02 +03:00
Paul Sokolovsky 6514ff6160 extmod/modwebrepl: Initial implementation of "get file" operation. 2016-04-29 01:02:39 +03:00
Paul Sokolovsky 25d0f7d59d extmod/modwebrepl: Module to handle WebREPL protocol.
While just a websocket is enough for handling terminal part of WebREPL,
handling file transfer operations requires demultiplexing and acting
upon, which is encapsulated in _webrepl class provided by this module,
which wraps a websocket object.
2016-04-29 00:52:52 +03:00