{"action":"opened","number":4,"pull_request":{"url":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls/4","id":229925630,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5OTI1NjMw","html_url":"https://github.com/dmadison/MSF-XINPUT/pull/4","diff_url":"https://github.com/dmadison/MSF-XINPUT/pull/4.diff","patch_url":"https://github.com/dmadison/MSF-XINPUT/pull/4.patch","issue_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues/4","number":4,"state":"open","locked":false,"title":"Fix xinput security string","user":{"login":"dmadison","id":24282108,"node_id":"MDQ6VXNlcjI0MjgyMTA4","avatar_url":"https://avatars0.githubusercontent.com/u/24282108?v=4","gravatar_id":"","url":"https://api.github.com/users/dmadison","html_url":"https://github.com/dmadison","followers_url":"https://api.github.com/users/dmadison/followers","following_url":"https://api.github.com/users/dmadison/following{/other_user}","gists_url":"https://api.github.com/users/dmadison/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadison/subscriptions","organizations_url":"https://api.github.com/users/dmadison/orgs","repos_url":"https://api.github.com/users/dmadison/repos","events_url":"https://api.github.com/users/dmadison/events{/privacy}","received_events_url":"https://api.github.com/users/dmadison/received_events","type":"User","site_admin":false},"body":"This is originally provided as a UTF-16 string in hexadecimal, although the `0x00` bytes are generated automatically which leads to the string ending at \"X\" since the 0 byte is read as a null terminator. This update removes the extraneous `0x00` bytes and reworks the descriptor to use single byte character literals so the string is still readable in code.\r\n\r\nI wrote a short Python script to do the conversion:\r\n```python\r\nxinput_hex = [0x58, 0x62, 0x6F, 0x78, 0x20, 0x53, 0x65, 0x63, 0x75, 0x72, 0x69, 0x74, 0x79, 0x20, 0x4D, 0x65, 0x74, 0x68, 0x6F, 0x64, 0x20, 0x33, 0x2C, 0x20, 0x56, 0x65, 0x72, 0x73, 0x69, 0x6F, 0x6E, 0x20, 0x31, 0x2E, 0x30, 0x30, 0x2C, 0x20, 0xA9, 0x20, 0x32, 0x30, 0x30, 0x35, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x2E, 0x20, 0x41, 0x6C, 0x6C, 0x20, 0x72, 0x69, 0x67, 0x68, 0x74, 0x73,0x20, 0x72, 0x65, 0x73, 0x65, 0x72, 0x76, 0x65, 0x64, 0x2E]\r\nxinput_string = \"\"\r\n\r\n# Convert hex to string and print\r\nfor xchar in xinput_hex:\r\n\txinput_string += chr(xchar)\r\nprint(xinput_string)\r\n\r\n# Convert string to ASCII formatted array\r\nfor xchar in xinput_string:\r\n\tif(ord(xchar) < 128):\r\n\t\tprint(\"\\'{}\\', \".format(xchar), end='')  # Print char if ASCII\r\n\telse:\r\n\t\tprint(\"0x{:X}, \".format(ord(xchar)), end='')  # Print hex otherwise\r\nprint()\r\n```\r\n\r\nDescriptor before fix:\r\n```\r\nString Descriptor Table\r\n--------------------------------\r\nIndex  LANGID  String\r\n0x00   0x0000  \r\n0x01   0x0000  \"©Microsoft\"\r\n0x02   0x0000  \"Controller\"\r\n0x03   0x0000  \"3742490\"\r\n0x04   0x0000  \"X\"\r\n```\r\n\r\nDescriptor after fix:\r\n```\r\nString Descriptor Table\r\n--------------------------------\r\nIndex  LANGID  String\r\n0x00   0x0000  \r\n0x01   0x0000  \"©Microsoft\"\r\n0x02   0x0000  \"Controller\"\r\n0x03   0x0000  \"3742490\"\r\n0x04   0x0000  \"Xbox Security Method 3, Version 1.00, © 2005 Microsoft Corporation. All rights reserved.\"\r\n```\r\n\r\nUSB descriptors read using [this tool](https://www.thesycon.de/eng/usb_descriptordumper.shtml) and a blank sketch in XInput mode .\r\n\r\nSee also [zlittel/#33](zlittel/MSF-XINPUT/#33). Kudos to @gdsports who discovered this.","created_at":"2018-11-11T01:58:55Z","updated_at":"2018-11-11T01:58:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls/4/commits","review_comments_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls/4/comments","review_comment_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues/4/comments","statuses_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/statuses/1d5bcbdf224040e273b26ef0ba2945905ecad28b","head":{"label":"dmadison:security-string-fix","ref":"security-string-fix","sha":"1d5bcbdf224040e273b26ef0ba2945905ecad28b","user":{"login":"dmadison","id":24282108,"node_id":"MDQ6VXNlcjI0MjgyMTA4","avatar_url":"https://avatars0.githubusercontent.com/u/24282108?v=4","gravatar_id":"","url":"https://api.github.com/users/dmadison","html_url":"https://github.com/dmadison","followers_url":"https://api.github.com/users/dmadison/followers","following_url":"https://api.github.com/users/dmadison/following{/other_user}","gists_url":"https://api.github.com/users/dmadison/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadison/subscriptions","organizations_url":"https://api.github.com/users/dmadison/orgs","repos_url":"https://api.github.com/users/dmadison/repos","events_url":"https://api.github.com/users/dmadison/events{/privacy}","received_events_url":"https://api.github.com/users/dmadison/received_events","type":"User","site_admin":false},"repo":{"id":131355788,"node_id":"MDEwOlJlcG9zaXRvcnkxMzEzNTU3ODg=","name":"MSF-XINPUT","full_name":"dmadison/MSF-XINPUT","private":false,"owner":{"login":"dmadison","id":24282108,"node_id":"MDQ6VXNlcjI0MjgyMTA4","avatar_url":"https://avatars0.githubusercontent.com/u/24282108?v=4","gravatar_id":"","url":"https://api.github.com/users/dmadison","html_url":"https://github.com/dmadison","followers_url":"https://api.github.com/users/dmadison/followers","following_url":"https://api.github.com/users/dmadison/following{/other_user}","gists_url":"https://api.github.com/users/dmadison/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadison/subscriptions","organizations_url":"https://api.github.com/users/dmadison/orgs","repos_url":"https://api.github.com/users/dmadison/repos","events_url":"https://api.github.com/users/dmadison/events{/privacy}","received_events_url":"https://api.github.com/users/dmadison/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dmadison/MSF-XINPUT","description":"Working on creating a more library like version of my xinput code for the fightstick","fork":true,"url":"https://api.github.com/repos/dmadison/MSF-XINPUT","forks_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/forks","keys_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/teams","hooks_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/hooks","issue_events_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues/events{/number}","events_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/events","assignees_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/assignees{/user}","branches_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/branches{/branch}","tags_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/tags","blobs_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/statuses/{sha}","languages_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/languages","stargazers_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/stargazers","contributors_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/contributors","subscribers_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/subscribers","subscription_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/subscription","commits_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/contents/{+path}","compare_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/merges","archive_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/downloads","issues_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues{/number}","pulls_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls{/number}","milestones_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/milestones{/number}","notifications_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/labels{/name}","releases_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/releases{/id}","deployments_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/deployments","created_at":"2018-04-28T00:13:51Z","updated_at":"2018-11-04T01:37:26Z","pushed_at":"2018-11-11T01:56:16Z","git_url":"git://github.com/dmadison/MSF-XINPUT.git","ssh_url":"git@github.com:dmadison/MSF-XINPUT.git","clone_url":"https://github.com/dmadison/MSF-XINPUT.git","svn_url":"https://github.com/dmadison/MSF-XINPUT","homepage":"http://www.zlittell.com","size":173,"stargazers_count":1,"watchers_count":1,"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":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"dmadison:master","ref":"master","sha":"e75b0c99d8805c6e9cd4e0edd27ac4e3a0a0ffcd","user":{"login":"dmadison","id":24282108,"node_id":"MDQ6VXNlcjI0MjgyMTA4","avatar_url":"https://avatars0.githubusercontent.com/u/24282108?v=4","gravatar_id":"","url":"https://api.github.com/users/dmadison","html_url":"https://github.com/dmadison","followers_url":"https://api.github.com/users/dmadison/followers","following_url":"https://api.github.com/users/dmadison/following{/other_user}","gists_url":"https://api.github.com/users/dmadison/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadison/subscriptions","organizations_url":"https://api.github.com/users/dmadison/orgs","repos_url":"https://api.github.com/users/dmadison/repos","events_url":"https://api.github.com/users/dmadison/events{/privacy}","received_events_url":"https://api.github.com/users/dmadison/received_events","type":"User","site_admin":false},"repo":{"id":131355788,"node_id":"MDEwOlJlcG9zaXRvcnkxMzEzNTU3ODg=","name":"MSF-XINPUT","full_name":"dmadison/MSF-XINPUT","private":false,"owner":{"login":"dmadison","id":24282108,"node_id":"MDQ6VXNlcjI0MjgyMTA4","avatar_url":"https://avatars0.githubusercontent.com/u/24282108?v=4","gravatar_id":"","url":"https://api.github.com/users/dmadison","html_url":"https://github.com/dmadison","followers_url":"https://api.github.com/users/dmadison/followers","following_url":"https://api.github.com/users/dmadison/following{/other_user}","gists_url":"https://api.github.com/users/dmadison/gists{/gist_id}","starred_url":"https://api.github.com/users/dmadison/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dmadison/subscriptions","organizations_url":"https://api.github.com/users/dmadison/orgs","repos_url":"https://api.github.com/users/dmadison/repos","events_url":"https://api.github.com/users/dmadison/events{/privacy}","received_events_url":"https://api.github.com/users/dmadison/received_events","type":"User","site_admin":false},"html_url":"https://github.com/dmadison/MSF-XINPUT","description":"Working on creating a more library like version of my xinput code for the fightstick","fork":true,"url":"https://api.github.com/repos/dmadison/MSF-XINPUT","forks_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/forks","keys_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/teams","hooks_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/hooks","issue_events_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues/events{/number}","events_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/events","assignees_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/assignees{/user}","branches_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/branches{/branch}","tags_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/tags","blobs_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/refs{/sha}","trees_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/statuses/{sha}","languages_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/languages","stargazers_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/stargazers","contributors_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/contributors","subscribers_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/subscribers","subscription_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/subscription","commits_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/commits{/sha}","git_commits_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/git/commits{/sha}","comments_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/comments{/number}","issue_comment_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues/comments{/number}","contents_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/contents/{+path}","compare_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/merges","archive_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/downloads","issues_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues{/number}","pulls_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls{/number}","milestones_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/milestones{/number}","notifications_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/labels{/name}","releases_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/releases{/id}","deployments_url":"https://api.github.com/repos/dmadison/MSF-XINPUT/deployments","created_at":"2018-04-28T00:13:51Z","updated_at":"2018-11-04T01:37:26Z","pushed_at":"2018-11-11T01:56:16Z","git_url":"git://github.com/dmadison/MSF-XINPUT.git","ssh_url":"git@github.com:dmadison/MSF-XINPUT.git","clone_url":"https://github.com/dmadison/MSF-XINPUT.git","svn_url":"https://github.com/dmadison/MSF-XINPUT","homepage":"http://www.zlittell.com","size":173,"stargazers_count":1,"watchers_count":1,"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":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls/4"},"html":{"href":"https://github.com/dmadison/MSF-XINPUT/pull/4"},"issue":{"href":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues/4"},"comments":{"href":"https://api.github.com/repos/dmadison/MSF-XINPUT/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dmadison/MSF-XINPUT/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/dmadison/MSF-XINPUT/statuses/1d5bcbdf224040e273b26ef0ba2945905ecad28b"}},"author_association":"OWNER","merged":false,"mergeable":null,"rebaseable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"maintainer_can_modify":false,"commits":3,"additions":7,"deletions":12,"changed_files":1}}
{"actor":{"display_login":"dmadison"}}