Skip to content

Commit f7bcb07

Browse files
committed
chore: use git patches for patching the manufacturer name
1 parent 1cb0ef4 commit f7bcb07

2 files changed

Lines changed: 26 additions & 6 deletions

File tree

branding.patch

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
diff --git a/pico-keys-sdk/src/usb/usb_descriptors.c b/pico-keys-sdk/src/usb/usb_descriptors.c
2+
index c44b3e2..f2f2734 100644
3+
--- a/pico-keys-sdk/src/usb/usb_descriptors.c
4+
+++ b/pico-keys-sdk/src/usb/usb_descriptors.c
5+
@@ -214,7 +214,7 @@ enum
6+
VENDOR_REQUEST_WEBUSB = 1,
7+
VENDOR_REQUEST_MICROSOFT = 2
8+
};
9+
-#define URL "www.picokeys.com"
10+
+#define URL "www.github.com/librekeys"
11+
static bool web_serial_connected = false;
12+
13+
const tusb_desc_webusb_url_t desc_url =
14+
@@ -318,7 +318,7 @@ uint8_t const *tud_descriptor_bos_cb(void) {
15+
// array of pointer to string descriptors
16+
char const *string_desc_arr [] = {
17+
(const char[]) { 0x09, 0x04 }, // 0: is supported language is English (0x0409)
18+
- "Pol Henarejos", // 1: Manufacturer
19+
+ "Libre Keys", // 1: Manufacturer
20+
"Pico Key", // 2: Product
21+
"11223344", // 3: Serials, should use chip ID
22+
"Config" // 4: Vendor Interface

default.nix

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ stdenvNoCC.mkDerivation (finalAttrs: {
4141
hash = "sha256-a2edwKskmOKMy34xsD29OW/TlfHCn5PtUKDliDGUXi8=";
4242
};
4343

44+
patches = [
45+
./branding.patch
46+
];
47+
4448
strictDeps = true;
4549

4650
nativeBuildInputs = [
@@ -57,12 +61,6 @@ stdenvNoCC.mkDerivation (finalAttrs: {
5761
find . -name "*.cmake" -o -name "CMakeLists.txt" -print0 | xargs -0 sed -i 's/git submodule update/echo "Nix: Skipped git submodule update"/g'
5862
find . -name "*.cmake" -o -name "CMakeLists.txt" -print0 | xargs -0 sed -i 's/git checkout/echo "Nix: Skipped git checkout"/g'
5963
60-
echo "--- Patching: Applying Libre Keys Branding ---"
61-
# 1. Change Manufacturer Name
62-
sed -i 's/"Pol Henarejos"/"Libre Keys"/g' pico-keys-sdk/src/usb/usb_descriptors.c
63-
# 2. Change URL
64-
sed -i 's|"www.picokeys.com"|"www.github.com/librekeys/picoforge"|g' pico-keys-sdk/src/usb/usb_descriptors.c
65-
6664
${lib.optionalString eddsa ''
6765
echo "--- Patching: Injecting EdDSA mbedtls fork (eddsa=true) ---"
6866
rm -rf pico-keys-sdk/mbedtls

0 commit comments

Comments
 (0)