{"action":"created","issue":{"url":"https://api.github.com/repos/micropython/micropython/issues/2776","repository_url":"https://api.github.com/repos/micropython/micropython","labels_url":"https://api.github.com/repos/micropython/micropython/issues/2776/labels{/name}","comments_url":"https://api.github.com/repos/micropython/micropython/issues/2776/comments","events_url":"https://api.github.com/repos/micropython/micropython/issues/2776/events","html_url":"https://github.com/micropython/micropython/issues/2776","id":199541762,"number":2776,"title":"esp8226: select.poll() UART compatibility","user":{"login":"Pablode","id":3663466,"avatar_url":"https://avatars.githubusercontent.com/u/3663466?v=3","gravatar_id":"","url":"https://api.github.com/users/Pablode","html_url":"https://github.com/Pablode","followers_url":"https://api.github.com/users/Pablode/followers","following_url":"https://api.github.com/users/Pablode/following{/other_user}","gists_url":"https://api.github.com/users/Pablode/gists{/gist_id}","starred_url":"https://api.github.com/users/Pablode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pablode/subscriptions","organizations_url":"https://api.github.com/users/Pablode/orgs","repos_url":"https://api.github.com/users/Pablode/repos","events_url":"https://api.github.com/users/Pablode/events{/privacy}","received_events_url":"https://api.github.com/users/Pablode/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-01-09T12:33:05Z","updated_at":"2017-01-16T09:57:56Z","closed_at":null,"body":"Trying to use select.poll to forward data between UART and a wifi connection.\r\nInitializing, reading and writing to UART does work.\r\n\r\nAccording to the MicroPython ESP8266 docs, [objects that support polling are: pyb.UART, pyb.USB_VCP](http://docs.micropython.org/en/latest/esp8266/library/select.html).\r\nOn ESP8266, this is [not properly implemented yet](https://github.com/micropython/micropython/blob/master/esp8266/machine_uart.c#L258).\r\n\r\nThis example code does not work:\r\n\r\n```python\r\nimport select\r\nfrom machine import UART\r\n\r\nuart = UART(0, 115200)\r\nhandler = select.poll()\r\nhandler.register(uart, select.POLLIN)\r\nhandler.poll()\r\n```\r\n`OSError: [Errno 22] EINVAL`\r\n\r\nWould love to see this fixed."},"comment":{"url":"https://api.github.com/repos/micropython/micropython/issues/comments/272818259","html_url":"https://github.com/micropython/micropython/issues/2776#issuecomment-272818259","issue_url":"https://api.github.com/repos/micropython/micropython/issues/2776","id":272818259,"user":{"login":"Pablode","id":3663466,"avatar_url":"https://avatars.githubusercontent.com/u/3663466?v=3","gravatar_id":"","url":"https://api.github.com/users/Pablode","html_url":"https://github.com/Pablode","followers_url":"https://api.github.com/users/Pablode/followers","following_url":"https://api.github.com/users/Pablode/following{/other_user}","gists_url":"https://api.github.com/users/Pablode/gists{/gist_id}","starred_url":"https://api.github.com/users/Pablode/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Pablode/subscriptions","organizations_url":"https://api.github.com/users/Pablode/orgs","repos_url":"https://api.github.com/users/Pablode/repos","events_url":"https://api.github.com/users/Pablode/events{/privacy}","received_events_url":"https://api.github.com/users/Pablode/received_events","type":"User","site_admin":false},"created_at":"2017-01-16T09:57:56Z","updated_at":"2017-01-16T09:57:56Z","body":"```c\r\nSTATIC mp_uint_t pyb_uart_ioctl(mp_obj_t self_in, mp_uint_t request, mp_uint_t flags, int *errcode) {\r\n    mp_uint_t ret;\r\n    if (request == MP_STREAM_POLL) {\r\n        ret = 0;\r\n\r\n        if ((flags & MP_STREAM_POLL_RD) && uart_rx_char() != -1) {\r\n            ret |= MP_STREAM_POLL_RD;\r\n        }\r\n        if ((flags & MP_STREAM_POLL_WR) && true/*TODO: check if we can write*/) {\r\n            ret |= MP_STREAM_POLL_WR;\r\n        }\r\n\r\n    } else {\r\n        *errcode = MP_EINVAL;\r\n        ret = MP_STREAM_ERROR;\r\n    }\r\n    return ret;\r\n}\r\n```\r\n\r\nPartially implemented the required function."}}
{"actor":{"display_login":"Pablode"}}