{"action":"created","issue":{"url":"https://api.github.com/repos/dhylands/upy-shell/issues/5","labels_url":"https://api.github.com/repos/dhylands/upy-shell/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/dhylands/upy-shell/issues/5/comments","events_url":"https://api.github.com/repos/dhylands/upy-shell/issues/5/events","html_url":"https://github.com/dhylands/upy-shell/issues/5","id":81296583,"number":5,"title":"Behaviour when the Pyboard fails.","user":{"login":"peterhinch","id":8437477,"avatar_url":"https://avatars.githubusercontent.com/u/8437477?v=3","gravatar_id":"","url":"https://api.github.com/users/peterhinch","html_url":"https://github.com/peterhinch","followers_url":"https://api.github.com/users/peterhinch/followers","following_url":"https://api.github.com/users/peterhinch/following{/other_user}","gists_url":"https://api.github.com/users/peterhinch/gists{/gist_id}","starred_url":"https://api.github.com/users/peterhinch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peterhinch/subscriptions","organizations_url":"https://api.github.com/users/peterhinch/orgs","repos_url":"https://api.github.com/users/peterhinch/repos","events_url":"https://api.github.com/users/peterhinch/events{/privacy}","received_events_url":"https://api.github.com/users/peterhinch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-27T06:07:37Z","updated_at":"2015-05-27T07:10:32Z","closed_at":null,"body":"There are three closely related rshell issues here. While to an experienced user these are easily resolved, they could be confusing to beginners and fixing them would give this excellent utility a more professional look.\r\n\r\n1. If you run rshell too soon after plugging in the Pyboard you get\r\nTraceback (most recent call last):\r\n  File \"/usr/lib/python3/dist-packages/serial/serialposix.py\", line 275, in open\r\n    self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)\r\nOSError: [Errno 16] Device or resource busy: '/dev/ttyACM0'\r\nplus further trace information.\r\nIt would be good if it issued a message and waited for the board to become ready - perhaps with a timeout or an option to abandon.\r\n\r\n2. Its behaviour could be improved when the Pyboard crashes, is reset or is unplugged.\r\nIf the Pyboard is temporarily removed in regular command mode the code gives no indication, but in the background Linux has re-instantiated the board as /dev/ttyACM1. Issuing repl will cause the code to fail with trace information. The user won't be able to restart it because the board is still on /dev/ttyACM1. It would be better if, in regular command mode, it detected the absence of the Pyboard and returned you to the Linux terminal with a suitable message.\r\n\r\n3. At the repl, disappearance of the Pyboard leads to a lot of trace information. It only returns to the Linux terminal when you type a character, by which time the returned Pyboard is again on /dev/ttyACM1. If it could gracefully return to the terminal before the Pyboard has a chance to re-appear, Linux would instantiate it on /dev/ttyACM0 allowing the program to be run again."},"comment":{"url":"https://api.github.com/repos/dhylands/upy-shell/issues/comments/105788650","html_url":"https://github.com/dhylands/upy-shell/issues/5#issuecomment-105788650","issue_url":"https://api.github.com/repos/dhylands/upy-shell/issues/5","id":105788650,"user":{"login":"dhylands","id":127500,"avatar_url":"https://avatars.githubusercontent.com/u/127500?v=3","gravatar_id":"","url":"https://api.github.com/users/dhylands","html_url":"https://github.com/dhylands","followers_url":"https://api.github.com/users/dhylands/followers","following_url":"https://api.github.com/users/dhylands/following{/other_user}","gists_url":"https://api.github.com/users/dhylands/gists{/gist_id}","starred_url":"https://api.github.com/users/dhylands/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhylands/subscriptions","organizations_url":"https://api.github.com/users/dhylands/orgs","repos_url":"https://api.github.com/users/dhylands/repos","events_url":"https://api.github.com/users/dhylands/events{/privacy}","received_events_url":"https://api.github.com/users/dhylands/received_events","type":"User","site_admin":false},"created_at":"2015-05-27T07:10:32Z","updated_at":"2015-05-27T07:10:32Z","body":"Thanks for the feedback.\r\n\r\nI think I know how to deal with this under linux. I've previously written this program:\r\nhttps://github.com/dhylands/usb-ser-mon/blob/master/usb-ser-mon.py\r\n\r\nwhich, under linux, deals quite gracefully with the serial port coming and going. With rshell, ny initial goal was to make something that worked cross platform.\r\n\r\nI think I'll need to come up with different ways of reading the serial port for different platforms.\r\n\r\nrshell currently relies on pyboard.py for all of the serial I/O when not using the \"repl\" command, and does its own I/O when using the repl command.\r\n\r\nSo I hear where you're coming from, and I definitely want this to be robust as possible.\r\n\r\nI need to do some experiments to see if I can make it robust without having to resort to using udev (which is what usb-ser-mon does). And I'll also have to experiment on the other platforms as well.\r\nAside: I've also been working on a mechanism where if an exception is raised by the remote (say disk full or other error) then these will wind up getting rippled back to rshell."}}