Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

X-Input Serial ID (Pico ID Based) #1235

Merged
merged 21 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a446414
[ImgBot] Optimize images
ImgBotApp Feb 5, 2024
df2e3ec
Merge pull request #8 from arntsonl/imgbot
arntsonl Feb 8, 2024
baa61e6
Merge branch 'OpenStickCommunity:main' into main
arntsonl Feb 8, 2024
9ddf6cd
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Feb 17, 2024
19b367e
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Mar 24, 2024
3687e2f
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Mar 24, 2024
66b2c76
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Mar 31, 2024
176e75e
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Apr 1, 2024
180157b
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Apr 13, 2024
89b3250
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Apr 24, 2024
ccd4d99
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl May 5, 2024
dcdd9eb
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Jun 17, 2024
bc3f8a4
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Jun 25, 2024
2728c72
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Jun 25, 2024
ee83325
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Sep 25, 2024
e8d5e1e
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Nov 25, 2024
90bc43a
Merge branch 'main' of https://github.com/arntsonl/GP2040-CE
arntsonl Dec 14, 2024
c77be03
Updated X-Input serial index 3 to use Pico ID instead of static value…
arntsonl Dec 14, 2024
d985109
Let's try the tail end of the pico ID
arntsonl Dec 14, 2024
569bffc
Lots of tabs in this driver, moved over to spaces
arntsonl Dec 23, 2024
2dd653c
Also convert these indents to spaces
arntsonl Dec 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion headers/drivers/xinput/XInputDescriptors.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#pragma once

#include <stdint.h>
#include <pico/unique_id.h>

#define XINPUT_ENDPOINT_SIZE 20

Expand Down Expand Up @@ -50,7 +51,7 @@ static const uint8_t xinput_string_language[] = { 0x09, 0x04 };
static const uint8_t xinput_string_serial[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
static const uint8_t xinput_string_manfacturer[] = "\xa9Microsoft Corporation";
static const uint8_t xinput_string_product[] = "Controller";
static const uint8_t xinput_string_version[] = "08FEC93"; // Fake a random serial, doesn't matter
static uint8_t xinput_string_version[] = "08FEC93"; // Serial that is overridden by Pico ID
static const uint8_t xinput_string_xsm3[] = "Xbox Security Method 3, Version 1.00, \xa9 2005 Microsoft Corporation. All rights reserved.";

static const uint8_t *xinput_string_descriptors[] __attribute__((unused)) =
Expand All @@ -62,6 +63,19 @@ static const uint8_t *xinput_string_descriptors[] __attribute__((unused)) =
xinput_string_xsm3
};

static const uint8_t * xinput_get_string_descriptor(int index) {
if ( index == 3 ) {
// Generate a serial number of hex bytes from the pico's unique ID
pico_unique_board_id_t unique_id;
pico_get_unique_board_id(&unique_id);
for(int i = 0; i < 3; i++) {
sprintf((char*)(&xinput_string_version[i*2+1]), "%02X", (uint8_t)unique_id.id[i+5]);
}
}

return xinput_string_descriptors[index];
}

static const uint8_t xinput_device_descriptor[] =
{
0x12, // bLength
Expand Down
Loading
Loading