{"action":"created","comment":{"url":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/comments/224949261","pull_request_review_id":164450837,"id":224949261,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyNDk0OTI2MQ==","diff_hunk":"@@ -0,0 +1,274 @@\n+use x86::io::inb;\n+\n+// PC keyboard interface constants\n+\n+const KBSTATP: u16    = 0x64;    // kbd controller status port(I)\n+const KBS_DIB: u8    = 0x01;    // kbd data in buffer\n+const KBDATAP: u16    = 0x60;    // kbd data port(I)\n+\n+const NO: u8         = 0;\n+\n+const SHIFT: u8      = (1<<0);\n+const CTL: u8        = (1<<1);\n+const ALT: u8        = (1<<2);\n+\n+const CAPSLOCK: u8   = (1<<3);\n+const NUMLOCK: u8    = (1<<4);\n+const SCROLLLOCK: u8 = (1<<5);\n+\n+const E0ESC: usize      = (1<<6);\n+\n+// Special keycodes\n+const KEY_HOME: u8   = 0xE0;\n+const KEY_END: u8    = 0xE1;\n+const KEY_UP: u8     = 0xE2;\n+const KEY_DN: u8     = 0xE3;\n+const KEY_LF: u8     = 0xE4;\n+const KEY_RT: u8     = 0xE5;\n+const KEY_PGUP: u8   = 0xE6;\n+const KEY_PGDN: u8   = 0xE7;\n+const KEY_INS: u8    = 0xE8;\n+const KEY_DEL: u8    = 0xE9;\n+\n+#[deny(const_err)]\n+macro_rules! C {\n+    ($c:expr) => {\n+        $c as u8 - '@' as u8\n+    }\n+}\n+\n+static NORMALMAP: [u8; 256] = [\n+  NO,   0x1B, '1' as u8,  '2' as u8,  '3' as u8,  '4' as u8,  '5' as u8,  '6' as u8,  // 0x00","path":"src/kbd.rs","position":41,"original_position":41,"commit_id":"4f84e4cb51c43ddd153ae846b9aff66738150317","original_commit_id":"4f84e4cb51c43ddd153ae846b9aff66738150317","user":{"login":"connorkuehl","id":5227338,"node_id":"MDQ6VXNlcjUyMjczMzg=","avatar_url":"https://avatars1.githubusercontent.com/u/5227338?v=4","gravatar_id":"","url":"https://api.github.com/users/connorkuehl","html_url":"https://github.com/connorkuehl","followers_url":"https://api.github.com/users/connorkuehl/followers","following_url":"https://api.github.com/users/connorkuehl/following{/other_user}","gists_url":"https://api.github.com/users/connorkuehl/gists{/gist_id}","starred_url":"https://api.github.com/users/connorkuehl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connorkuehl/subscriptions","organizations_url":"https://api.github.com/users/connorkuehl/orgs","repos_url":"https://api.github.com/users/connorkuehl/repos","events_url":"https://api.github.com/users/connorkuehl/events{/privacy}","received_events_url":"https://api.github.com/users/connorkuehl/received_events","type":"User","site_admin":false},"body":"I think if instead of `char as u8` we can do `b'char'`. Just off the top of my head, but might be worth trying so the `as u8` doesn't dominate so much of the page (and less typing for future device drivers).\r\n\r\nFor example, `'1' as u8` could be `b'1'`","created_at":"2018-10-13T04:29:10Z","updated_at":"2018-10-13T04:38:21Z","html_url":"https://github.com/connorkuehl/xv6-rust/pull/35#discussion_r224949261","pull_request_url":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/35","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/comments/224949261"},"html":{"href":"https://github.com/connorkuehl/xv6-rust/pull/35#discussion_r224949261"},"pull_request":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/35"}}},"pull_request":{"url":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/35","id":222340024,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIyMzQwMDI0","html_url":"https://github.com/connorkuehl/xv6-rust/pull/35","diff_url":"https://github.com/connorkuehl/xv6-rust/pull/35.diff","patch_url":"https://github.com/connorkuehl/xv6-rust/pull/35.patch","issue_url":"https://api.github.com/repos/connorkuehl/xv6-rust/issues/35","number":35,"state":"open","locked":false,"title":"Port the ps2 keyboard driver to rust","user":{"login":"squidboylan","id":10985680,"node_id":"MDQ6VXNlcjEwOTg1Njgw","avatar_url":"https://avatars2.githubusercontent.com/u/10985680?v=4","gravatar_id":"","url":"https://api.github.com/users/squidboylan","html_url":"https://github.com/squidboylan","followers_url":"https://api.github.com/users/squidboylan/followers","following_url":"https://api.github.com/users/squidboylan/following{/other_user}","gists_url":"https://api.github.com/users/squidboylan/gists{/gist_id}","starred_url":"https://api.github.com/users/squidboylan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squidboylan/subscriptions","organizations_url":"https://api.github.com/users/squidboylan/orgs","repos_url":"https://api.github.com/users/squidboylan/repos","events_url":"https://api.github.com/users/squidboylan/events{/privacy}","received_events_url":"https://api.github.com/users/squidboylan/received_events","type":"User","site_admin":false},"body":"port kbd.c and kbd.h to kbd.rs","created_at":"2018-10-12T03:35:30Z","updated_at":"2018-10-13T04:38:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a863cb2b75bb5ecd9047f70b01ed880240dd5fb5","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/35/commits","review_comments_url":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/35/comments","review_comment_url":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/comments{/number}","comments_url":"https://api.github.com/repos/connorkuehl/xv6-rust/issues/35/comments","statuses_url":"https://api.github.com/repos/connorkuehl/xv6-rust/statuses/4f84e4cb51c43ddd153ae846b9aff66738150317","head":{"label":"squidboylan:kbd_rust","ref":"kbd_rust","sha":"4f84e4cb51c43ddd153ae846b9aff66738150317","user":{"login":"squidboylan","id":10985680,"node_id":"MDQ6VXNlcjEwOTg1Njgw","avatar_url":"https://avatars2.githubusercontent.com/u/10985680?v=4","gravatar_id":"","url":"https://api.github.com/users/squidboylan","html_url":"https://github.com/squidboylan","followers_url":"https://api.github.com/users/squidboylan/followers","following_url":"https://api.github.com/users/squidboylan/following{/other_user}","gists_url":"https://api.github.com/users/squidboylan/gists{/gist_id}","starred_url":"https://api.github.com/users/squidboylan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squidboylan/subscriptions","organizations_url":"https://api.github.com/users/squidboylan/orgs","repos_url":"https://api.github.com/users/squidboylan/repos","events_url":"https://api.github.com/users/squidboylan/events{/privacy}","received_events_url":"https://api.github.com/users/squidboylan/received_events","type":"User","site_admin":false},"repo":{"id":152525000,"node_id":"MDEwOlJlcG9zaXRvcnkxNTI1MjUwMDA=","name":"xv6-rust","full_name":"squidboylan/xv6-rust","private":false,"owner":{"login":"squidboylan","id":10985680,"node_id":"MDQ6VXNlcjEwOTg1Njgw","avatar_url":"https://avatars2.githubusercontent.com/u/10985680?v=4","gravatar_id":"","url":"https://api.github.com/users/squidboylan","html_url":"https://github.com/squidboylan","followers_url":"https://api.github.com/users/squidboylan/followers","following_url":"https://api.github.com/users/squidboylan/following{/other_user}","gists_url":"https://api.github.com/users/squidboylan/gists{/gist_id}","starred_url":"https://api.github.com/users/squidboylan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/squidboylan/subscriptions","organizations_url":"https://api.github.com/users/squidboylan/orgs","repos_url":"https://api.github.com/users/squidboylan/repos","events_url":"https://api.github.com/users/squidboylan/events{/privacy}","received_events_url":"https://api.github.com/users/squidboylan/received_events","type":"User","site_admin":false},"html_url":"https://github.com/squidboylan/xv6-rust","description":"A faithful port of the 32-bit xv6 learner's operating system to the Rust programming language","fork":true,"url":"https://api.github.com/repos/squidboylan/xv6-rust","forks_url":"https://api.github.com/repos/squidboylan/xv6-rust/forks","keys_url":"https://api.github.com/repos/squidboylan/xv6-rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/squidboylan/xv6-rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/squidboylan/xv6-rust/teams","hooks_url":"https://api.github.com/repos/squidboylan/xv6-rust/hooks","issue_events_url":"https://api.github.com/repos/squidboylan/xv6-rust/issues/events{/number}","events_url":"https://api.github.com/repos/squidboylan/xv6-rust/events","assignees_url":"https://api.github.com/repos/squidboylan/xv6-rust/assignees{/user}","branches_url":"https://api.github.com/repos/squidboylan/xv6-rust/branches{/branch}","tags_url":"https://api.github.com/repos/squidboylan/xv6-rust/tags","blobs_url":"https://api.github.com/repos/squidboylan/xv6-rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/squidboylan/xv6-rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/squidboylan/xv6-rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/squidboylan/xv6-rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/squidboylan/xv6-rust/statuses/{sha}","languages_url":"https://api.github.com/repos/squidboylan/xv6-rust/languages","stargazers_url":"https://api.github.com/repos/squidboylan/xv6-rust/stargazers","contributors_url":"https://api.github.com/repos/squidboylan/xv6-rust/contributors","subscribers_url":"https://api.github.com/repos/squidboylan/xv6-rust/subscribers","subscription_url":"https://api.github.com/repos/squidboylan/xv6-rust/subscription","commits_url":"https://api.github.com/repos/squidboylan/xv6-rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/squidboylan/xv6-rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/squidboylan/xv6-rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/squidboylan/xv6-rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/squidboylan/xv6-rust/contents/{+path}","compare_url":"https://api.github.com/repos/squidboylan/xv6-rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/squidboylan/xv6-rust/merges","archive_url":"https://api.github.com/repos/squidboylan/xv6-rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/squidboylan/xv6-rust/downloads","issues_url":"https://api.github.com/repos/squidboylan/xv6-rust/issues{/number}","pulls_url":"https://api.github.com/repos/squidboylan/xv6-rust/pulls{/number}","milestones_url":"https://api.github.com/repos/squidboylan/xv6-rust/milestones{/number}","notifications_url":"https://api.github.com/repos/squidboylan/xv6-rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/squidboylan/xv6-rust/labels{/name}","releases_url":"https://api.github.com/repos/squidboylan/xv6-rust/releases{/id}","deployments_url":"https://api.github.com/repos/squidboylan/xv6-rust/deployments","created_at":"2018-10-11T03:22:52Z","updated_at":"2018-10-11T03:22:54Z","pushed_at":"2018-10-12T03:31:06Z","git_url":"git://github.com/squidboylan/xv6-rust.git","ssh_url":"git@github.com:squidboylan/xv6-rust.git","clone_url":"https://github.com/squidboylan/xv6-rust.git","svn_url":"https://github.com/squidboylan/xv6-rust","homepage":"","size":149,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"connorkuehl:master","ref":"master","sha":"e8b0d20302ac64c73c52b8b5f54bb56cd99fe40e","user":{"login":"connorkuehl","id":5227338,"node_id":"MDQ6VXNlcjUyMjczMzg=","avatar_url":"https://avatars1.githubusercontent.com/u/5227338?v=4","gravatar_id":"","url":"https://api.github.com/users/connorkuehl","html_url":"https://github.com/connorkuehl","followers_url":"https://api.github.com/users/connorkuehl/followers","following_url":"https://api.github.com/users/connorkuehl/following{/other_user}","gists_url":"https://api.github.com/users/connorkuehl/gists{/gist_id}","starred_url":"https://api.github.com/users/connorkuehl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connorkuehl/subscriptions","organizations_url":"https://api.github.com/users/connorkuehl/orgs","repos_url":"https://api.github.com/users/connorkuehl/repos","events_url":"https://api.github.com/users/connorkuehl/events{/privacy}","received_events_url":"https://api.github.com/users/connorkuehl/received_events","type":"User","site_admin":false},"repo":{"id":151849401,"node_id":"MDEwOlJlcG9zaXRvcnkxNTE4NDk0MDE=","name":"xv6-rust","full_name":"connorkuehl/xv6-rust","private":false,"owner":{"login":"connorkuehl","id":5227338,"node_id":"MDQ6VXNlcjUyMjczMzg=","avatar_url":"https://avatars1.githubusercontent.com/u/5227338?v=4","gravatar_id":"","url":"https://api.github.com/users/connorkuehl","html_url":"https://github.com/connorkuehl","followers_url":"https://api.github.com/users/connorkuehl/followers","following_url":"https://api.github.com/users/connorkuehl/following{/other_user}","gists_url":"https://api.github.com/users/connorkuehl/gists{/gist_id}","starred_url":"https://api.github.com/users/connorkuehl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/connorkuehl/subscriptions","organizations_url":"https://api.github.com/users/connorkuehl/orgs","repos_url":"https://api.github.com/users/connorkuehl/repos","events_url":"https://api.github.com/users/connorkuehl/events{/privacy}","received_events_url":"https://api.github.com/users/connorkuehl/received_events","type":"User","site_admin":false},"html_url":"https://github.com/connorkuehl/xv6-rust","description":"A faithful port of the 32-bit xv6 learner's operating system to the Rust programming language","fork":false,"url":"https://api.github.com/repos/connorkuehl/xv6-rust","forks_url":"https://api.github.com/repos/connorkuehl/xv6-rust/forks","keys_url":"https://api.github.com/repos/connorkuehl/xv6-rust/keys{/key_id}","collaborators_url":"https://api.github.com/repos/connorkuehl/xv6-rust/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/connorkuehl/xv6-rust/teams","hooks_url":"https://api.github.com/repos/connorkuehl/xv6-rust/hooks","issue_events_url":"https://api.github.com/repos/connorkuehl/xv6-rust/issues/events{/number}","events_url":"https://api.github.com/repos/connorkuehl/xv6-rust/events","assignees_url":"https://api.github.com/repos/connorkuehl/xv6-rust/assignees{/user}","branches_url":"https://api.github.com/repos/connorkuehl/xv6-rust/branches{/branch}","tags_url":"https://api.github.com/repos/connorkuehl/xv6-rust/tags","blobs_url":"https://api.github.com/repos/connorkuehl/xv6-rust/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/connorkuehl/xv6-rust/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/connorkuehl/xv6-rust/git/refs{/sha}","trees_url":"https://api.github.com/repos/connorkuehl/xv6-rust/git/trees{/sha}","statuses_url":"https://api.github.com/repos/connorkuehl/xv6-rust/statuses/{sha}","languages_url":"https://api.github.com/repos/connorkuehl/xv6-rust/languages","stargazers_url":"https://api.github.com/repos/connorkuehl/xv6-rust/stargazers","contributors_url":"https://api.github.com/repos/connorkuehl/xv6-rust/contributors","subscribers_url":"https://api.github.com/repos/connorkuehl/xv6-rust/subscribers","subscription_url":"https://api.github.com/repos/connorkuehl/xv6-rust/subscription","commits_url":"https://api.github.com/repos/connorkuehl/xv6-rust/commits{/sha}","git_commits_url":"https://api.github.com/repos/connorkuehl/xv6-rust/git/commits{/sha}","comments_url":"https://api.github.com/repos/connorkuehl/xv6-rust/comments{/number}","issue_comment_url":"https://api.github.com/repos/connorkuehl/xv6-rust/issues/comments{/number}","contents_url":"https://api.github.com/repos/connorkuehl/xv6-rust/contents/{+path}","compare_url":"https://api.github.com/repos/connorkuehl/xv6-rust/compare/{base}...{head}","merges_url":"https://api.github.com/repos/connorkuehl/xv6-rust/merges","archive_url":"https://api.github.com/repos/connorkuehl/xv6-rust/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/connorkuehl/xv6-rust/downloads","issues_url":"https://api.github.com/repos/connorkuehl/xv6-rust/issues{/number}","pulls_url":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls{/number}","milestones_url":"https://api.github.com/repos/connorkuehl/xv6-rust/milestones{/number}","notifications_url":"https://api.github.com/repos/connorkuehl/xv6-rust/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/connorkuehl/xv6-rust/labels{/name}","releases_url":"https://api.github.com/repos/connorkuehl/xv6-rust/releases{/id}","deployments_url":"https://api.github.com/repos/connorkuehl/xv6-rust/deployments","created_at":"2018-10-06T14:45:21Z","updated_at":"2018-10-12T01:16:44Z","pushed_at":"2018-10-12T03:35:31Z","git_url":"git://github.com/connorkuehl/xv6-rust.git","ssh_url":"git@github.com:connorkuehl/xv6-rust.git","clone_url":"https://github.com/connorkuehl/xv6-rust.git","svn_url":"https://github.com/connorkuehl/xv6-rust","homepage":"","size":147,"stargazers_count":1,"watchers_count":1,"language":"C","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"archived":false,"open_issues_count":29,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":2,"open_issues":29,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/35"},"html":{"href":"https://github.com/connorkuehl/xv6-rust/pull/35"},"issue":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/issues/35"},"comments":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/issues/35/comments"},"review_comments":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/35/comments"},"review_comment":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/pulls/35/commits"},"statuses":{"href":"https://api.github.com/repos/connorkuehl/xv6-rust/statuses/4f84e4cb51c43ddd153ae846b9aff66738150317"}},"author_association":"NONE"}}
{"actor":{"display_login":"connorkuehl"}}