{"action":"opened","number":206,"pull_request":{"url":"https://api.github.com/repos/pyserial/pyserial/pulls/206","id":107907837,"html_url":"https://github.com/pyserial/pyserial/pull/206","diff_url":"https://github.com/pyserial/pyserial/pull/206.diff","patch_url":"https://github.com/pyserial/pyserial/pull/206.patch","issue_url":"https://api.github.com/repos/pyserial/pyserial/issues/206","number":206,"state":"open","locked":false,"title":"Exclusive access on POSIX.","user":{"login":"NJDFan","id":8527880,"avatar_url":"https://avatars.githubusercontent.com/u/8527880?v=3","gravatar_id":"","url":"https://api.github.com/users/NJDFan","html_url":"https://github.com/NJDFan","followers_url":"https://api.github.com/users/NJDFan/followers","following_url":"https://api.github.com/users/NJDFan/following{/other_user}","gists_url":"https://api.github.com/users/NJDFan/gists{/gist_id}","starred_url":"https://api.github.com/users/NJDFan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NJDFan/subscriptions","organizations_url":"https://api.github.com/users/NJDFan/orgs","repos_url":"https://api.github.com/users/NJDFan/repos","events_url":"https://api.github.com/users/NJDFan/events{/privacy}","received_events_url":"https://api.github.com/users/NJDFan/received_events","type":"User","site_admin":false},"body":"On Linux machines, opening a serial port is non-exclusive; you can open multiple simultaneous connections to the same serial port.  This does not seem to be the case on Windows, but more the point is almost certainly not the behavior you want, various processes all stepping on one another's comm.\r\n\r\nUnfortunately you can't just open the Serial object then fcntl.flock it because, in between, initializing the Serial port did all manner of things to settings like baud rate, timeouts, etc.  So the fix is that the call to flock has to happen immediately, right after the os.open of the raw port, before any of the termios action.\r\n\r\nThis pull adds an exclusive keyword argument to Serial.__init__ and corresponding data descriptors.  On a serialposix.Serial, setting exclusive explicitly True or False manipulates the lock for this process, meaning that if you make two attempts to open a Serial(port, exclusive=True), the second will fail.  On serialwin32 and serialjava, the exclusive flag is supported but ignored.  Windows already does the right thing, and I don't have access to a Jython installation to check the Java behavior.\r\n\r\nThis change is kind of essential for applications that try to do autodetection of \"Alright, which serial port has my Widgetek brand Widget.\"","created_at":"2017-02-24T20:59:41Z","updated_at":"2017-02-24T20:59:41Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/pyserial/pyserial/pulls/206/commits","review_comments_url":"https://api.github.com/repos/pyserial/pyserial/pulls/206/comments","review_comment_url":"https://api.github.com/repos/pyserial/pyserial/pulls/comments{/number}","comments_url":"https://api.github.com/repos/pyserial/pyserial/issues/206/comments","statuses_url":"https://api.github.com/repos/pyserial/pyserial/statuses/45352036683601c1f9c53b7f812245f19469ed80","head":{"label":"NJDFan:master","ref":"master","sha":"45352036683601c1f9c53b7f812245f19469ed80","user":{"login":"NJDFan","id":8527880,"avatar_url":"https://avatars.githubusercontent.com/u/8527880?v=3","gravatar_id":"","url":"https://api.github.com/users/NJDFan","html_url":"https://github.com/NJDFan","followers_url":"https://api.github.com/users/NJDFan/followers","following_url":"https://api.github.com/users/NJDFan/following{/other_user}","gists_url":"https://api.github.com/users/NJDFan/gists{/gist_id}","starred_url":"https://api.github.com/users/NJDFan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NJDFan/subscriptions","organizations_url":"https://api.github.com/users/NJDFan/orgs","repos_url":"https://api.github.com/users/NJDFan/repos","events_url":"https://api.github.com/users/NJDFan/events{/privacy}","received_events_url":"https://api.github.com/users/NJDFan/received_events","type":"User","site_admin":false},"repo":{"id":83072630,"name":"pyserial","full_name":"NJDFan/pyserial","owner":{"login":"NJDFan","id":8527880,"avatar_url":"https://avatars.githubusercontent.com/u/8527880?v=3","gravatar_id":"","url":"https://api.github.com/users/NJDFan","html_url":"https://github.com/NJDFan","followers_url":"https://api.github.com/users/NJDFan/followers","following_url":"https://api.github.com/users/NJDFan/following{/other_user}","gists_url":"https://api.github.com/users/NJDFan/gists{/gist_id}","starred_url":"https://api.github.com/users/NJDFan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/NJDFan/subscriptions","organizations_url":"https://api.github.com/users/NJDFan/orgs","repos_url":"https://api.github.com/users/NJDFan/repos","events_url":"https://api.github.com/users/NJDFan/events{/privacy}","received_events_url":"https://api.github.com/users/NJDFan/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/NJDFan/pyserial","description":"Python serial port access library","fork":true,"url":"https://api.github.com/repos/NJDFan/pyserial","forks_url":"https://api.github.com/repos/NJDFan/pyserial/forks","keys_url":"https://api.github.com/repos/NJDFan/pyserial/keys{/key_id}","collaborators_url":"https://api.github.com/repos/NJDFan/pyserial/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/NJDFan/pyserial/teams","hooks_url":"https://api.github.com/repos/NJDFan/pyserial/hooks","issue_events_url":"https://api.github.com/repos/NJDFan/pyserial/issues/events{/number}","events_url":"https://api.github.com/repos/NJDFan/pyserial/events","assignees_url":"https://api.github.com/repos/NJDFan/pyserial/assignees{/user}","branches_url":"https://api.github.com/repos/NJDFan/pyserial/branches{/branch}","tags_url":"https://api.github.com/repos/NJDFan/pyserial/tags","blobs_url":"https://api.github.com/repos/NJDFan/pyserial/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/NJDFan/pyserial/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/NJDFan/pyserial/git/refs{/sha}","trees_url":"https://api.github.com/repos/NJDFan/pyserial/git/trees{/sha}","statuses_url":"https://api.github.com/repos/NJDFan/pyserial/statuses/{sha}","languages_url":"https://api.github.com/repos/NJDFan/pyserial/languages","stargazers_url":"https://api.github.com/repos/NJDFan/pyserial/stargazers","contributors_url":"https://api.github.com/repos/NJDFan/pyserial/contributors","subscribers_url":"https://api.github.com/repos/NJDFan/pyserial/subscribers","subscription_url":"https://api.github.com/repos/NJDFan/pyserial/subscription","commits_url":"https://api.github.com/repos/NJDFan/pyserial/commits{/sha}","git_commits_url":"https://api.github.com/repos/NJDFan/pyserial/git/commits{/sha}","comments_url":"https://api.github.com/repos/NJDFan/pyserial/comments{/number}","issue_comment_url":"https://api.github.com/repos/NJDFan/pyserial/issues/comments{/number}","contents_url":"https://api.github.com/repos/NJDFan/pyserial/contents/{+path}","compare_url":"https://api.github.com/repos/NJDFan/pyserial/compare/{base}...{head}","merges_url":"https://api.github.com/repos/NJDFan/pyserial/merges","archive_url":"https://api.github.com/repos/NJDFan/pyserial/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/NJDFan/pyserial/downloads","issues_url":"https://api.github.com/repos/NJDFan/pyserial/issues{/number}","pulls_url":"https://api.github.com/repos/NJDFan/pyserial/pulls{/number}","milestones_url":"https://api.github.com/repos/NJDFan/pyserial/milestones{/number}","notifications_url":"https://api.github.com/repos/NJDFan/pyserial/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/NJDFan/pyserial/labels{/name}","releases_url":"https://api.github.com/repos/NJDFan/pyserial/releases{/id}","deployments_url":"https://api.github.com/repos/NJDFan/pyserial/deployments","created_at":"2017-02-24T18:50:37Z","updated_at":"2017-02-24T18:50:40Z","pushed_at":"2017-02-24T19:57:52Z","git_url":"git://github.com/NJDFan/pyserial.git","ssh_url":"git@github.com:NJDFan/pyserial.git","clone_url":"https://github.com/NJDFan/pyserial.git","svn_url":"https://github.com/NJDFan/pyserial","homepage":"","size":1515,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"pyserial:master","ref":"master","sha":"f956057b989e7575492b792e9ee476b19bf4fbc3","user":{"login":"pyserial","id":10537924,"avatar_url":"https://avatars.githubusercontent.com/u/10537924?v=3","gravatar_id":"","url":"https://api.github.com/users/pyserial","html_url":"https://github.com/pyserial","followers_url":"https://api.github.com/users/pyserial/followers","following_url":"https://api.github.com/users/pyserial/following{/other_user}","gists_url":"https://api.github.com/users/pyserial/gists{/gist_id}","starred_url":"https://api.github.com/users/pyserial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyserial/subscriptions","organizations_url":"https://api.github.com/users/pyserial/orgs","repos_url":"https://api.github.com/users/pyserial/repos","events_url":"https://api.github.com/users/pyserial/events{/privacy}","received_events_url":"https://api.github.com/users/pyserial/received_events","type":"Organization","site_admin":false},"repo":{"id":40094312,"name":"pyserial","full_name":"pyserial/pyserial","owner":{"login":"pyserial","id":10537924,"avatar_url":"https://avatars.githubusercontent.com/u/10537924?v=3","gravatar_id":"","url":"https://api.github.com/users/pyserial","html_url":"https://github.com/pyserial","followers_url":"https://api.github.com/users/pyserial/followers","following_url":"https://api.github.com/users/pyserial/following{/other_user}","gists_url":"https://api.github.com/users/pyserial/gists{/gist_id}","starred_url":"https://api.github.com/users/pyserial/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pyserial/subscriptions","organizations_url":"https://api.github.com/users/pyserial/orgs","repos_url":"https://api.github.com/users/pyserial/repos","events_url":"https://api.github.com/users/pyserial/events{/privacy}","received_events_url":"https://api.github.com/users/pyserial/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/pyserial/pyserial","description":"Python serial port access library","fork":false,"url":"https://api.github.com/repos/pyserial/pyserial","forks_url":"https://api.github.com/repos/pyserial/pyserial/forks","keys_url":"https://api.github.com/repos/pyserial/pyserial/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pyserial/pyserial/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pyserial/pyserial/teams","hooks_url":"https://api.github.com/repos/pyserial/pyserial/hooks","issue_events_url":"https://api.github.com/repos/pyserial/pyserial/issues/events{/number}","events_url":"https://api.github.com/repos/pyserial/pyserial/events","assignees_url":"https://api.github.com/repos/pyserial/pyserial/assignees{/user}","branches_url":"https://api.github.com/repos/pyserial/pyserial/branches{/branch}","tags_url":"https://api.github.com/repos/pyserial/pyserial/tags","blobs_url":"https://api.github.com/repos/pyserial/pyserial/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pyserial/pyserial/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pyserial/pyserial/git/refs{/sha}","trees_url":"https://api.github.com/repos/pyserial/pyserial/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pyserial/pyserial/statuses/{sha}","languages_url":"https://api.github.com/repos/pyserial/pyserial/languages","stargazers_url":"https://api.github.com/repos/pyserial/pyserial/stargazers","contributors_url":"https://api.github.com/repos/pyserial/pyserial/contributors","subscribers_url":"https://api.github.com/repos/pyserial/pyserial/subscribers","subscription_url":"https://api.github.com/repos/pyserial/pyserial/subscription","commits_url":"https://api.github.com/repos/pyserial/pyserial/commits{/sha}","git_commits_url":"https://api.github.com/repos/pyserial/pyserial/git/commits{/sha}","comments_url":"https://api.github.com/repos/pyserial/pyserial/comments{/number}","issue_comment_url":"https://api.github.com/repos/pyserial/pyserial/issues/comments{/number}","contents_url":"https://api.github.com/repos/pyserial/pyserial/contents/{+path}","compare_url":"https://api.github.com/repos/pyserial/pyserial/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pyserial/pyserial/merges","archive_url":"https://api.github.com/repos/pyserial/pyserial/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pyserial/pyserial/downloads","issues_url":"https://api.github.com/repos/pyserial/pyserial/issues{/number}","pulls_url":"https://api.github.com/repos/pyserial/pyserial/pulls{/number}","milestones_url":"https://api.github.com/repos/pyserial/pyserial/milestones{/number}","notifications_url":"https://api.github.com/repos/pyserial/pyserial/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pyserial/pyserial/labels{/name}","releases_url":"https://api.github.com/repos/pyserial/pyserial/releases{/id}","deployments_url":"https://api.github.com/repos/pyserial/pyserial/deployments","created_at":"2015-08-02T22:05:31Z","updated_at":"2017-02-23T21:27:53Z","pushed_at":"2017-02-15T01:49:11Z","git_url":"git://github.com/pyserial/pyserial.git","ssh_url":"git@github.com:pyserial/pyserial.git","clone_url":"https://github.com/pyserial/pyserial.git","svn_url":"https://github.com/pyserial/pyserial","homepage":"","size":1497,"stargazers_count":613,"watchers_count":613,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":233,"mirror_url":null,"open_issues_count":56,"forks":233,"open_issues":56,"watchers":613,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/pyserial/pyserial/pulls/206"},"html":{"href":"https://github.com/pyserial/pyserial/pull/206"},"issue":{"href":"https://api.github.com/repos/pyserial/pyserial/issues/206"},"comments":{"href":"https://api.github.com/repos/pyserial/pyserial/issues/206/comments"},"review_comments":{"href":"https://api.github.com/repos/pyserial/pyserial/pulls/206/comments"},"review_comment":{"href":"https://api.github.com/repos/pyserial/pyserial/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/pyserial/pyserial/pulls/206/commits"},"statuses":{"href":"https://api.github.com/repos/pyserial/pyserial/statuses/45352036683601c1f9c53b7f812245f19469ed80"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":true,"commits":5,"additions":32,"deletions":1,"changed_files":3}}
{"actor":{"display_login":"NJDFan"}}