aboutsummaryrefslogtreecommitdiff
path: root/extmod
AgeCommit message (Collapse)Author
2016-05-27extmod/vfs_fat*: Replace text error messages by POSIX error numbers.Robert HH
These changes are in line with similar changes in other modules, and with standard Python interface.
2016-05-27extmod/virtpin: Initial implementation of open-ended C-level Pin interface.Paul Sokolovsky
Using usual method of virtual method tables. Single virtual method, ioctl, is defined currently for all operations. This universal and extensible vtable-based method is also defined as a default MPHAL GPIO implementation, but a specific port may override it with its own implementation (e.g. close-ended, but very efficient, e.g. avoiding virtual method dispatch).
2016-05-26extmod/machine_i2c: Redo mp_hal_pin macros to use open_drain and od_low.Damien George
mp_hal_pin_config_od is renamed mp_hal_pin_open_drain, and mp_hal_pin_low is mp_hal_pin_od_low.
2016-05-26extmod/modussl: Coverage build fixes.Paul Sokolovsky
2016-05-26extmod/modussl: Make more compatible with non-default obj representations.Paul Sokolovsky
Still not compatible with nanboxing.
2016-05-20extmod/moduos_dupterm: Dumpterm subsystem is responsible for closing stream.Paul Sokolovsky
Make dupterm subsystem close a term stream object when EOF or error occurs. There's no other party than dupterm itself in a better position to do this, and this is required to properly reclaim stream resources, especially if multiple dupterm sessions may be established (e.g. as networking connections).
2016-05-20extmod/modwebrepl: Add close() method.Paul Sokolovsky
2016-05-20extmod/modwebsocket: Add close() method.Paul Sokolovsky
2016-05-20extmod: When including extmod headers, prefix path with extmod/.Damien George
2016-05-18py/stream: Support both "exact size" and "one underlying call" operations.Paul Sokolovsky
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-15extmod/modlwip: Rework how Python accept callback is called.Paul Sokolovsky
Calling it from lwIP accept callback will lead incorrect functioning and/or packet leaks if Python callback has any networking calls, due to lwIP non-reentrancy. So, instead schedule "poll" callback to do that, which will be called by lwIP when it does not perform networking activities. "Poll" callback is called infrequently though (docs say every 0.5s by default), so for better performance, lwIP needs to be patched to call poll callback soon after accept callback, but when current packet is already processed.
2016-05-12extmod/modlwip: Convert errno's to use MP_Exxx symbols.Damien George
2016-05-03extmod/modlwip: Implement sendall() method for TCP sockets.Paul Sokolovsky
2016-05-02extmod/modwebrepl: Get rid of using strncpy().Paul Sokolovsky
2016-04-30extmod/modwebrepl: Add support for password.Paul Sokolovsky
Request for password then becomes mandatory part of the protocol.
2016-04-29extmod/modwebrepl: Set debugging by default to off.Paul Sokolovsky
That's production setting. Also, extra UART output may affect behavior of (subpar) network drivers.
2016-04-29extmod/modwebrepl: Add rate-limiting workaround for broken network drivers.Paul Sokolovsky
Like ESP8266 has.
2016-04-29extmod/modwebrepl: Use bigger socket receive buffer.Paul Sokolovsky
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-29extmod/modwebrepl: More detailed debug output.Paul Sokolovsky
So detailed that even commented by default.
2016-04-29extmod/modwebrepl: GET_FILE: Send length-prefix chunk with one write().Paul Sokolovsky
A bit of optimization.
2016-04-29extmod/modwebrepl: Keep reading data when there's something to read.Paul Sokolovsky
EAGAIN should be returned only if underlying socket returned it. Wrap existing read function into external loop to process all data available.
2016-04-29extmod/modwebrepl: Initial implementation of "get file" operation.Paul Sokolovsky
2016-04-29extmod/modwebrepl: Module to handle WebREPL protocol.Paul Sokolovsky
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-28extmod/modussl: SSL_OK from ssl_read() means "no user data so far".Paul Sokolovsky
SSL_OK is numeric 0, and it's *not* an EOF. So, should keep reading.
2016-04-28extmod/modussl: Support server-side SSL sockets.Paul Sokolovsky
wrap_socket(sock, server_side=True)
2016-04-28extmod/modussl: Throw Python exceptions in case of errors.Paul Sokolovsky
2016-04-27extmod/modwebsocket: Handle CLOSE control frame.Paul Sokolovsky
This fixes situation when clients hangs waiting for disconnect and does so only on timeout.
2016-04-26extmod/modlwip: Add print_pcbs() debug function.Paul Sokolovsky
This requires lwIP built with LWIP_DEBUG (or it will be no-op).
2016-04-26extmod/modlwip: Workaround esp8266 sendto issue where 1 is returned.Damien George
2016-04-26extmod, stmhal: Fix typo of macro that detects if float is enabled.Damien George
2016-04-25extmod/modlwip: Protect recv/accept Python callback against exceptions.Paul Sokolovsky
Using usual call_function_*_protected() helper, to avoid NLR jump crashes.
2016-04-22extmod/machine_i2c: Allow mp_hal_pin_obj_t to be any type, not a ptr.Damien George
2016-04-17extmod/modlwip: Add ability to run callback on "recv" and "accept" events.Paul Sokolovsky
To use: .setsockopt(SOL_SOCKET, 20, lambda sock: print(sock)). There's a single underlying callback slot. For normal sockets, it serves as data received callback, for listening sockets - connection arrived callback.
2016-04-17extmod/modlwip: lwip_tcp_receive(): Full error handling.Paul Sokolovsky
2016-04-17extmod/modlwip: lwip_tcp_send(): Full error handling.Paul Sokolovsky
2016-04-14extmod/fsusermount: In mount/mkfs, deregister VFS object on error.Damien George
Should fix issue #1947.
2016-04-15extmod/modlwip: More debug messages for various edge conditions.Paul Sokolovsky
2016-04-14extmod/modlwip: Start adding debug output.Paul Sokolovsky
2016-04-14extmod/modlwip: lwip_tcp_receive(): Properly handle EOF for non-blocking sock.Paul Sokolovsky
2016-04-13extmod/modwebsocket: Another case to propagate EOF.Paul Sokolovsky
2016-04-13extmod/moduos_dupterm: Don't swallow exceptions in dupterm's read()/write().Paul Sokolovsky
The idea is that if dupterm object can handle exceptions, it will handle them itself. Otherwise, object state can be compromised and it's better to terminate dupterm session. For example, disconnected socket will keep throwing exceptions and dump messages about that.
2016-04-12extmod/machine_i2c: Implement I2C memory reading/writing.Damien George
2016-04-12extmod/machine_i2c: Fix I2C reading by sending ack/nack at end of byte.Damien George
2016-04-12extmod: Add generic machine.I2C class, with bit-bang I2C.Damien George
Should work on any machine that provides the correct pin functions.
2016-04-12extmod: Add initial framebuf module.Damien George
2016-04-11extmod/modwebsocket: write(): Support write size beyond 125 bytes.Paul Sokolovsky
2016-04-11extmod/modlwip: Fix for loss of data in unaccepted incoming sockets.Paul Sokolovsky
When lwIP creates a incoming connection socket of a listen socket, it sets its recv callback to one which discards incoming data. We set proper callback only in accept() call, when we allocate Python-level socket where we can queue incoming data. So, in lwIP accept callback be sure to set recv callback to one which tells lwIP to not discard incoming data.
2016-04-10extmod/modwebsocket.h: Split websocket-related defines for reuse.Paul Sokolovsky
2016-04-10extmod/modwebsocket: Implement MP_STREAM_SET_DATA_OPTS ioctl.Paul Sokolovsky
Allows to set fragment type (txt/bin/etc.) for output records.
2016-04-10extmod/modwebsocket: Allow to get type of last read data using ioctl().Paul Sokolovsky