{"action":"created","comment":{"url":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/comments/39915100","id":39915100,"diff_hunk":"@@ -784,11 +784,12 @@ def read(filename):\n                 length = length + (length % 4)","path":"cc2538-bsl.py","position":10,"original_position":10,"commit_id":"aa71b02357479cbb7ec31af1b672acffe944a520","original_commit_id":"aa71b02357479cbb7ec31af1b672acffe944a520","user":{"login":"JelmerT","id":873684,"avatar_url":"https://avatars.githubusercontent.com/u/873684?v=3","gravatar_id":"","url":"https://api.github.com/users/JelmerT","html_url":"https://github.com/JelmerT","followers_url":"https://api.github.com/users/JelmerT/followers","following_url":"https://api.github.com/users/JelmerT/following{/other_user}","gists_url":"https://api.github.com/users/JelmerT/gists{/gist_id}","starred_url":"https://api.github.com/users/JelmerT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JelmerT/subscriptions","organizations_url":"https://api.github.com/users/JelmerT/orgs","repos_url":"https://api.github.com/users/JelmerT/repos","events_url":"https://api.github.com/users/JelmerT/events{/privacy}","received_events_url":"https://api.github.com/users/JelmerT/received_events","type":"User","site_admin":false},"body":"Looks like I made a mistake here in the past. This should be `length = (length + 4) - (length % 4)` I think. \r\nIt doesn't really matter because of the `length >> 2` further down, but this makes the debug msg correct. And it makes sure we always round up when the user gives us funny input (aka not a multiple of 4).","created_at":"2015-09-19T02:16:32Z","updated_at":"2015-09-19T02:16:32Z","html_url":"https://github.com/JelmerT/cc2538-bsl/pull/39#discussion_r39915100","pull_request_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/39","_links":{"self":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/comments/39915100"},"html":{"href":"https://github.com/JelmerT/cc2538-bsl/pull/39#discussion_r39915100"},"pull_request":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/39"}}},"pull_request":{"url":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/39","id":45193846,"html_url":"https://github.com/JelmerT/cc2538-bsl/pull/39","diff_url":"https://github.com/JelmerT/cc2538-bsl/pull/39.diff","patch_url":"https://github.com/JelmerT/cc2538-bsl/pull/39.patch","issue_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/issues/39","number":39,"state":"open","locked":false,"title":"Fix -r bugs","user":{"login":"g-oikonomou","id":705207,"avatar_url":"https://avatars.githubusercontent.com/u/705207?v=3","gravatar_id":"","url":"https://api.github.com/users/g-oikonomou","html_url":"https://github.com/g-oikonomou","followers_url":"https://api.github.com/users/g-oikonomou/followers","following_url":"https://api.github.com/users/g-oikonomou/following{/other_user}","gists_url":"https://api.github.com/users/g-oikonomou/gists{/gist_id}","starred_url":"https://api.github.com/users/g-oikonomou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/g-oikonomou/subscriptions","organizations_url":"https://api.github.com/users/g-oikonomou/orgs","repos_url":"https://api.github.com/users/g-oikonomou/repos","events_url":"https://api.github.com/users/g-oikonomou/events{/privacy}","received_events_url":"https://api.github.com/users/g-oikonomou/received_events","type":"User","site_admin":false},"body":"This pull fixes a number of issues with the read functionality:\r\n\r\n* We were using `file()`. This is not available with PY3 so we replace it with `open()`.\r\n* `type(length / 4)` is float under PY3, resulting in a `TypeEror`. We change `length / 4` to `length >> 2` so we will always end up with an int. See below:\r\n\r\n```\r\n>>> type(4 / 4)\r\n<class 'float'>\r\n>>> type(4 >> 2)\r\n<class 'int'>\r\n```\r\n\r\n* The code was expecting `receivePacket()` to return a `str`. This was changed to list (bytes under PY3) a long time ago. We now harmonise `receivePacket()` to always return a bytearray and change the offending code to handle it properly.\r\n\r\nValidated by programming a device from a bin file, reading out with `-l 128` and doing a binary comparison between the data read and the first 128 bytes of the original .bin.\r\n\r\nTested with 2.7.10 and 3.4.3.\r\n\r\nFixes #32 \r\n","created_at":"2015-09-16T16:27:28Z","updated_at":"2015-09-19T02:16:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8d4854d7129f41de9b278364dd9f8d4353a1528f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/39/commits","review_comments_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/39/comments","review_comment_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/comments{/number}","comments_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/issues/39/comments","statuses_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/statuses/aa71b02357479cbb7ec31af1b672acffe944a520","head":{"label":"g-oikonomou:bugfix/read","ref":"bugfix/read","sha":"aa71b02357479cbb7ec31af1b672acffe944a520","user":{"login":"g-oikonomou","id":705207,"avatar_url":"https://avatars.githubusercontent.com/u/705207?v=3","gravatar_id":"","url":"https://api.github.com/users/g-oikonomou","html_url":"https://github.com/g-oikonomou","followers_url":"https://api.github.com/users/g-oikonomou/followers","following_url":"https://api.github.com/users/g-oikonomou/following{/other_user}","gists_url":"https://api.github.com/users/g-oikonomou/gists{/gist_id}","starred_url":"https://api.github.com/users/g-oikonomou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/g-oikonomou/subscriptions","organizations_url":"https://api.github.com/users/g-oikonomou/orgs","repos_url":"https://api.github.com/users/g-oikonomou/repos","events_url":"https://api.github.com/users/g-oikonomou/events{/privacy}","received_events_url":"https://api.github.com/users/g-oikonomou/received_events","type":"User","site_admin":false},"repo":{"id":36187995,"name":"cc2538-bsl","full_name":"g-oikonomou/cc2538-bsl","owner":{"login":"g-oikonomou","id":705207,"avatar_url":"https://avatars.githubusercontent.com/u/705207?v=3","gravatar_id":"","url":"https://api.github.com/users/g-oikonomou","html_url":"https://github.com/g-oikonomou","followers_url":"https://api.github.com/users/g-oikonomou/followers","following_url":"https://api.github.com/users/g-oikonomou/following{/other_user}","gists_url":"https://api.github.com/users/g-oikonomou/gists{/gist_id}","starred_url":"https://api.github.com/users/g-oikonomou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/g-oikonomou/subscriptions","organizations_url":"https://api.github.com/users/g-oikonomou/orgs","repos_url":"https://api.github.com/users/g-oikonomou/repos","events_url":"https://api.github.com/users/g-oikonomou/events{/privacy}","received_events_url":"https://api.github.com/users/g-oikonomou/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/g-oikonomou/cc2538-bsl","description":"Python cross platform script to upload firmware via the serial boot loader onto the CC2538 SoC.","fork":true,"url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl","forks_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/forks","keys_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/teams","hooks_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/hooks","issue_events_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/issues/events{/number}","events_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/events","assignees_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/assignees{/user}","branches_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/branches{/branch}","tags_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/tags","blobs_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/git/refs{/sha}","trees_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/statuses/{sha}","languages_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/languages","stargazers_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/stargazers","contributors_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/contributors","subscribers_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/subscribers","subscription_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/subscription","commits_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/commits{/sha}","git_commits_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/git/commits{/sha}","comments_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/comments{/number}","issue_comment_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/issues/comments{/number}","contents_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/contents/{+path}","compare_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/merges","archive_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/downloads","issues_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/issues{/number}","pulls_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/pulls{/number}","milestones_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/milestones{/number}","notifications_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/labels{/name}","releases_url":"https://api.github.com/repos/g-oikonomou/cc2538-bsl/releases{/id}","created_at":"2015-05-24T19:02:52Z","updated_at":"2015-05-24T19:02:53Z","pushed_at":"2015-09-19T01:53:38Z","git_url":"git://github.com/g-oikonomou/cc2538-bsl.git","ssh_url":"git@github.com:g-oikonomou/cc2538-bsl.git","clone_url":"https://github.com/g-oikonomou/cc2538-bsl.git","svn_url":"https://github.com/g-oikonomou/cc2538-bsl","homepage":null,"size":195,"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":"JelmerT:master","ref":"master","sha":"340840a400f748fb3cb43e67328ffdd3992aa898","user":{"login":"JelmerT","id":873684,"avatar_url":"https://avatars.githubusercontent.com/u/873684?v=3","gravatar_id":"","url":"https://api.github.com/users/JelmerT","html_url":"https://github.com/JelmerT","followers_url":"https://api.github.com/users/JelmerT/followers","following_url":"https://api.github.com/users/JelmerT/following{/other_user}","gists_url":"https://api.github.com/users/JelmerT/gists{/gist_id}","starred_url":"https://api.github.com/users/JelmerT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JelmerT/subscriptions","organizations_url":"https://api.github.com/users/JelmerT/orgs","repos_url":"https://api.github.com/users/JelmerT/repos","events_url":"https://api.github.com/users/JelmerT/events{/privacy}","received_events_url":"https://api.github.com/users/JelmerT/received_events","type":"User","site_admin":false},"repo":{"id":16447071,"name":"cc2538-bsl","full_name":"JelmerT/cc2538-bsl","owner":{"login":"JelmerT","id":873684,"avatar_url":"https://avatars.githubusercontent.com/u/873684?v=3","gravatar_id":"","url":"https://api.github.com/users/JelmerT","html_url":"https://github.com/JelmerT","followers_url":"https://api.github.com/users/JelmerT/followers","following_url":"https://api.github.com/users/JelmerT/following{/other_user}","gists_url":"https://api.github.com/users/JelmerT/gists{/gist_id}","starred_url":"https://api.github.com/users/JelmerT/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JelmerT/subscriptions","organizations_url":"https://api.github.com/users/JelmerT/orgs","repos_url":"https://api.github.com/users/JelmerT/repos","events_url":"https://api.github.com/users/JelmerT/events{/privacy}","received_events_url":"https://api.github.com/users/JelmerT/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/JelmerT/cc2538-bsl","description":"Python cross platform script to upload firmware via the serial boot loader onto the CC2538 SoC.","fork":false,"url":"https://api.github.com/repos/JelmerT/cc2538-bsl","forks_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/forks","keys_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/teams","hooks_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/hooks","issue_events_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/issues/events{/number}","events_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/events","assignees_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/assignees{/user}","branches_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/branches{/branch}","tags_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/tags","blobs_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/git/refs{/sha}","trees_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/statuses/{sha}","languages_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/languages","stargazers_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/stargazers","contributors_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/contributors","subscribers_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/subscribers","subscription_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/subscription","commits_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/commits{/sha}","git_commits_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/git/commits{/sha}","comments_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/comments{/number}","issue_comment_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/issues/comments{/number}","contents_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/contents/{+path}","compare_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/merges","archive_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/downloads","issues_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/issues{/number}","pulls_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls{/number}","milestones_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/milestones{/number}","notifications_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/labels{/name}","releases_url":"https://api.github.com/repos/JelmerT/cc2538-bsl/releases{/id}","created_at":"2014-02-02T01:54:24Z","updated_at":"2015-09-15T15:10:53Z","pushed_at":"2015-09-19T01:53:38Z","git_url":"git://github.com/JelmerT/cc2538-bsl.git","ssh_url":"git@github.com:JelmerT/cc2538-bsl.git","clone_url":"https://github.com/JelmerT/cc2538-bsl.git","svn_url":"https://github.com/JelmerT/cc2538-bsl","homepage":null,"size":645,"stargazers_count":15,"watchers_count":15,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":15,"mirror_url":null,"open_issues_count":9,"forks":15,"open_issues":9,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/39"},"html":{"href":"https://github.com/JelmerT/cc2538-bsl/pull/39"},"issue":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/issues/39"},"comments":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/issues/39/comments"},"review_comments":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/39/comments"},"review_comment":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/pulls/39/commits"},"statuses":{"href":"https://api.github.com/repos/JelmerT/cc2538-bsl/statuses/aa71b02357479cbb7ec31af1b672acffe944a520"}}}}