Skip to content

feat: embed version and git hash in USB serial number#864

Open
jpds wants to merge 4 commits into
HaoboGu:mainfrom
jpds:feat/usb-serial-version-stamp
Open

feat: embed version and git hash in USB serial number#864
jpds wants to merge 4 commits into
HaoboGu:mainfrom
jpds:feat/usb-serial-version-stamp

Conversation

@jpds

@jpds jpds commented May 27, 2026

Copy link
Copy Markdown
Contributor

This PR changes the serial number from the static string (vial:f64c2b3c:000001) and replaces it with a build-time stamp of the form rmk:<version>-<git-hash> (with or without vial:... based on feature flags). Allowing users to know what they have flashed on their devices.

Vial's util.py looks for the string, anywhere in the serial.

Downstream firmware wanting to append their own build info can use const_format::concatcp!(rmk::config::RMK_BUILD_INFO, ";my-fw:", ...)

@github-actions

github-actions Bot commented May 27, 2026

Copy link
Copy Markdown

Size Report

Example main PR Diff .text .data .bss
use_config/nrf52832_ble 372.2 KiB 372.5 KiB +0.07% ⬆️ +268 0 0
use_config/nrf52840_ble 422.1 KiB 422.4 KiB +0.08% ⬆️ +368 0 0
use_config/nrf52840_ble_split (central) 497.6 KiB 497.7 KiB +0.03% ⬆️ +156 0 0
use_config/nrf52840_ble_split (peripheral) 322.9 KiB 322.9 KiB +0.00% ⬇️ -4 0 0
use_config/pi_pico_w_ble 659.3 KiB 659.6 KiB +0.04% ⬆️ +324 0 0
use_config/rp2040 147.2 KiB 147.2 KiB +0.00% ⬆️ +4 0 0
use_config/rp2040_split (central) 160.8 KiB 160.8 KiB +0.00% 0 0 0
use_config/rp2040_split (peripheral) 27.8 KiB 27.8 KiB -0.01% ⬇️ -4 0 0
use_config/stm32f1 62.6 KiB 62.6 KiB -0.01% ⬇️ -12 0 0
use_config/stm32h7 99.8 KiB 99.8 KiB +0.00% 0 0 0
use_rust/nrf52832_ble 359.6 KiB 359.8 KiB +0.06% ⬆️ +224 0 0
use_rust/nrf52840_ble 418.1 KiB 418.3 KiB +0.06% ⬆️ +272 0 0
use_rust/nrf52840_ble_split (central) 506.5 KiB 506.9 KiB +0.07% ⬆️ +408 0 0
use_rust/nrf52840_ble_split (peripheral) 319.6 KiB 319.6 KiB +0.00% ⬆️ +4 0 0
use_rust/pi_pico_w_ble 659.9 KiB 660.2 KiB +0.04% ⬆️ +304 0 0
use_rust/rp2040 147.2 KiB 147.2 KiB +0.00% ⬆️ +4 0 0
use_rust/rp2040_split (central) 160.0 KiB 160.0 KiB +0.00% ⬆️ +4 0 0
use_rust/rp2040_split (peripheral) 28.1 KiB 28.1 KiB -0.01% ⬇️ -4 0 0
use_rust/stm32f1 62.6 KiB 62.6 KiB -0.03% ⬇️ -20 0 0
use_rust/stm32h7 121.2 KiB 121.2 KiB +0.00% ⬆️ +4 0 0
use_config/nrf52832_ble — 372.2 KiB → 372.5 KiB (+0.07% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 341728	   5256	  34408	 381392	  5d1d0	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 341460	   5256	  34408	 381124	  5d0c4	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +1.92Ki  [ = ]       0    .debug_info
  +0.0% +1.25Ki  [ = ]       0    .debug_str
  +0.2% +1.17Ki  [ = ]       0    .debug_loc
  +0.3%    +805  [ = ]       0    .debug_line
  +0.2%    +464  [ = ]       0    .debug_ranges
  +0.2%    +288  [ = ]       0    .symtab
  +0.1%    +260  +0.1%    +260    .text
  +0.1%    +228  [ = ]       0    .strtab
  +0.3%    +144  [ = ]       0    .debug_frame
  +0.2%     +72  [ = ]       0    .debug_aranges
  +0.8%     +64  [ = ]       0    .debug_abbrev
  +0.0%      +8  +0.0%      +8    .rodata
 -17.0%      -9  [ = ]       0    [Unmapped]
  +0.1% +6.61Ki  +0.1%    +268    TOTAL
use_config/nrf52840_ble — 422.1 KiB → 422.4 KiB (+0.08% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 376076	   5264	  51216	 432556	  699ac	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 375708	   5264	  51216	 432188	  6983c	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +1.81Ki  [ = ]       0    .debug_str
  +0.3%    +792  [ = ]       0    .debug_ranges
  +0.1%    +360  +0.1%    +360    .text
  +0.1%    +187  [ = ]       0    .debug_line
  +0.0%     +97  [ = ]       0    .strtab
  +0.1%     +96  [ = ]       0    .symtab
  +0.1%     +68  [ = ]       0    .debug_frame
  +0.1%     +24  [ = ]       0    .debug_aranges
  +0.0%      +8  +0.0%      +8    .rodata
 -22.1%     -15  [ = ]       0    [Unmapped]
  -1.5%    -128  [ = ]       0    .debug_abbrev
  -0.1%    -454  [ = ]       0    .debug_loc
  -0.1% -1.80Ki  [ = ]       0    .debug_info
  +0.0% +1.02Ki  +0.1%    +368    TOTAL
use_config/nrf52840_ble_split (central) — 497.6 KiB → 497.7 KiB (+0.03% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 456032	   6588	  47032	 509652	  7c6d4	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 455876	   6588	  47032	 509496	  7c638	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0% +1.04Ki  [ = ]       0    .debug_info
  +0.1%    +567  [ = ]       0    .debug_loc
  +0.1%    +232  [ = ]       0    .debug_ranges
  +0.1%    +227  [ = ]       0    .debug_line
  +0.0%    +205  [ = ]       0    .debug_str
  +0.0%    +148  +0.0%    +148    .text
  +0.0%     +55  [ = ]       0    .strtab
  +0.4%     +38  [ = ]       0    .debug_abbrev
  +0.0%     +16  [ = ]       0    .debug_frame
  +0.0%      +8  +0.0%      +8    .rodata
   +10%      +5  [ = ]       0    [Unmapped]
  +0.0% +2.50Ki  +0.0%    +156    TOTAL
use_config/nrf52840_ble_split (peripheral) — 322.9 KiB → 322.9 KiB (+0.00% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 297152	   5920	  27592	 330664	  50ba8	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 297156	   5920	  27592	 330668	  50bac	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +510  [ = ]       0    .debug_str
   +19%      +8  [ = ]       0    [Unmapped]
  +0.0%      +3  [ = ]       0    .strtab
  -0.0%      -4  -0.0%      -4    .text
  -0.0%     -99  [ = ]       0    .debug_line
  -0.0%    -122  [ = ]       0    .debug_info
  +0.0%    +296  -0.0%      -4    TOTAL
use_config/pi_pico_w_ble — 659.3 KiB → 659.6 KiB (+0.04% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 619856	      0	  55604	 675460	  a4e84	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 619532	      0	  55604	 675136	  a4d40	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +1.71Ki  [ = ]       0    .debug_info
  +0.1%    +506  [ = ]       0    .debug_line
  +0.2%    +384  [ = ]       0    .debug_ranges
  +0.1%    +316  +0.1%    +316    .text
  +0.1%    +164  [ = ]       0    .strtab
  +0.1%     +96  [ = ]       0    .symtab
  +0.0%     +71  [ = ]       0    .debug_loc
  +0.2%     +64  [ = ]       0    .debug_frame
  +0.2%     +23  [ = ]       0    .debug_abbrev
  +0.0%     +16  [ = ]       0    .debug_aranges
  +0.0%      +8  +0.0%      +8    .rodata
  -3.1%      -2  [ = ]       0    [Unmapped]
  -0.0%     -98  [ = ]       0    .debug_str
  +0.0% +3.23Ki  +0.0%    +324    TOTAL
use_config/rp2040 — 147.2 KiB → 147.2 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 135336	      0	  15372	 150708	  24cb4	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 135332	      0	  15372	 150704	  24cb0	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +317  [ = ]       0    .debug_str
  +0.0%    +165  [ = ]       0    .debug_info
  +0.0%     +32  [ = ]       0    .debug_loc
  +0.0%      +4  +0.0%      +4    .text
  +0.0%      +2  [ = ]       0    .strtab
 -19.1%      -9  [ = ]       0    [Unmapped]
  -0.0%     -15  [ = ]       0    .debug_line
  +0.0%    +496  +0.0%      +4    TOTAL
use_config/rp2040_split (central) — 160.8 KiB → 160.8 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 148412	      0	  16228	 164640	  28320	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 148412	      0	  16228	 164640	  28320	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +72  [ = ]       0    .debug_info
  +0.0%      +5  [ = ]       0    .debug_line
  +0.0%      +4  +0.0%      +4    .rodata
  +5.9%      +3  [ = ]       0    [Unmapped]
  -0.0%      -3  [ = ]       0    .strtab
  -0.0%      -4  -0.0%      -4    .text
  -0.1%    -925  [ = ]       0    .debug_str
  -0.0%    -848  [ = ]       0    TOTAL
use_config/rp2040_split (peripheral) — 27.8 KiB → 27.8 KiB (-0.01% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25624	     60	   2796	  28480	   6f40	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25628	     60	   2796	  28484	   6f44	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  -0.0%      -1  [ = ]       0    .debug_str
  -0.0%      -3  [ = ]       0    .strtab
  -0.1%      -4  -0.1%      -4    .rodata
  -0.0%      -8  -0.0%      -4    TOTAL
use_config/stm32f1 — 62.6 KiB → 62.6 KiB (-0.01% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  56584	     28	   7504	  64116	   fa74	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  56596	     28	   7504	  64128	   fa80	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  -1.6%     -12  -1.7%     -12    .rodata
 -31.1%     -19  [ = ]       0    [Unmapped]
  -0.0%    -301  [ = ]       0    .debug_str
  -0.0%    -332  -0.0%     -12    TOTAL
use_config/stm32h7 — 99.8 KiB → 99.8 KiB (+0.00%)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  92144	    268	   9736	 102148	  18f04	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  92144	    268	   9736	 102148	  18f04	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%      +4  +0.0%      +4    .rodata
  +1.9%      +1  [ = ]       0    [Unmapped]
  -0.0%      -4  -0.0%      -4    .text
  -0.0%    -123  [ = ]       0    .debug_info
  -0.1%    -155  [ = ]       0    .debug_line
  -0.0%    -623  [ = ]       0    .debug_str
  -0.0%    -900  [ = ]       0    TOTAL
use_rust/nrf52832_ble — 359.6 KiB → 359.8 KiB (+0.06% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 329804	   5264	  33400	 368468	  59f54	rmk-nrf52832

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 329580	   5264	  33400	 368244	  59e74	rmk-nrf52832

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.2% +2.90Ki  [ = ]       0    .debug_info
  +0.2% +1.36Ki  [ = ]       0    .debug_loc
  +0.0%    +745  [ = ]       0    .debug_str
  +0.2%    +522  [ = ]       0    .debug_line
  +0.2%    +464  [ = ]       0    .debug_ranges
  +0.1%    +216  +0.1%    +216    .text
  +1.0%     +82  [ = ]       0    .debug_abbrev
  +0.0%      +8  +0.0%      +8    .rodata
  -3.7%      -2  [ = ]       0    [Unmapped]
  -0.3%    -112  [ = ]       0    .debug_aranges
  -0.5%    -224  [ = ]       0    .debug_frame
  -0.2%    -354  [ = ]       0    .strtab
  -0.4%    -480  [ = ]       0    .symtab
  +0.1% +5.11Ki  +0.1%    +224    TOTAL
use_rust/nrf52840_ble — 418.1 KiB → 418.3 KiB (+0.06% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 376400	   5264	  46696	 428360	  68948	rmk-nrf52840

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 376128	   5264	  46696	 428088	  68838	rmk-nrf52840

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +324  [ = ]       0    .debug_str
  +0.1%    +264  +0.1%    +264    .text
  +0.0%      +8  +0.0%      +8    .rodata
 -24.2%     -16  [ = ]       0    [Unmapped]
  -0.1%     -48  [ = ]       0    .debug_aranges
  -0.0%     -48  [ = ]       0    .debug_ranges
  -0.7%     -55  [ = ]       0    .debug_abbrev
  -0.0%     -70  [ = ]       0    .debug_line
  -0.2%     -76  [ = ]       0    .debug_frame
  -0.0%    -124  [ = ]       0    .strtab
  -0.1%    -192  [ = ]       0    .symtab
  -0.1%    -471  [ = ]       0    .debug_loc
  -0.0%    -820  [ = ]       0    .debug_info
  -0.0% -1.29Ki  +0.1%    +272    TOTAL
use_rust/nrf52840_ble_split (central) — 506.5 KiB → 506.9 KiB (+0.07% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 459684	   6588	  52768	 519040	  7eb80	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 459276	   6588	  52768	 518632	  7e9e8	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +759  [ = ]       0    .debug_loc
  +0.0%    +441  [ = ]       0    .debug_info
  +0.1%    +400  +0.1%    +400    .text
  +0.1%    +239  [ = ]       0    .debug_line
  +0.0%     +80  [ = ]       0    .debug_ranges
  +0.0%      +8  +0.0%      +8    .rodata
  -0.2%     -14  [ = ]       0    .debug_abbrev
 -33.3%     -24  [ = ]       0    [Unmapped]
  -0.1%     -40  [ = ]       0    .debug_aranges
  -0.1%     -64  [ = ]       0    .debug_frame
  -0.0%     -68  [ = ]       0    .strtab
  -0.1%    -160  [ = ]       0    .symtab
  -0.0%    -885  [ = ]       0    .debug_str
  +0.0%    +672  +0.1%    +408    TOTAL
use_rust/nrf52840_ble_split (peripheral) — 319.6 KiB → 319.6 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 295576	   5360	  26360	 327296	  4fe80	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 295572	   5360	  26360	 327292	  4fe7c	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +80  [ = ]       0    .debug_str
  +0.0%      +4  +0.0%      +4    .text
  +0.0%      +1  [ = ]       0    .debug_info
  +0.0%      +1  [ = ]       0    .strtab
 -14.3%      -6  [ = ]       0    [Unmapped]
  -0.0%     -12  [ = ]       0    .debug_loc
  +0.0%     +68  +0.0%      +4    TOTAL
use_rust/pi_pico_w_ble — 659.9 KiB → 660.2 KiB (+0.04% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 620252	      0	  55748	 676000	  a50a0	rmk-pi-pico-w

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 619948	      0	  55748	 675696	  a4f70	rmk-pi-pico-w

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1% +2.46Ki  [ = ]       0    .debug_info
  +0.2% +2.06Ki  [ = ]       0    .debug_loc
  +0.1% +1.82Ki  [ = ]       0    .debug_str
  +0.1%    +433  [ = ]       0    .debug_line
  +0.1%    +344  [ = ]       0    .debug_ranges
  +0.1%    +300  +0.1%    +300    .text
  +0.1%    +158  [ = ]       0    .strtab
  +0.2%     +64  [ = ]       0    .debug_frame
  +0.1%     +64  [ = ]       0    .symtab
  +0.0%     +16  [ = ]       0    .debug_aranges
  +0.0%      +4  +0.0%      +4    .rodata
 -27.1%     -19  [ = ]       0    [Unmapped]
  +0.1% +7.68Ki  +0.0%    +304    TOTAL
use_rust/rp2040 — 147.2 KiB → 147.2 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 135524	      0	  15252	 150776	  24cf8	rmk-rp2040

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 135520	      0	  15252	 150772	  24cf4	rmk-rp2040

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%    +134  [ = ]       0    .debug_str
  +0.0%     +10  [ = ]       0    .debug_loc
  +0.0%      +4  +0.0%      +4    .rodata
  +0.0%      +2  [ = ]       0    .strtab
 -14.0%      -7  [ = ]       0    [Unmapped]
  -0.0%     -51  [ = ]       0    .debug_line
  -0.0%    -212  [ = ]       0    .debug_info
  -0.0%    -120  +0.0%      +4    TOTAL
use_rust/rp2040_split (central) — 160.0 KiB → 160.0 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 147808	      0	  16004	 163812	  27fe4	central

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 147804	      0	  16004	 163808	  27fe0	central

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%     +12  [ = ]       0    .debug_loc
  +0.0%      +4  +0.0%      +4    .rodata
  -0.0%      -3  [ = ]       0    .strtab
 -15.8%      -9  [ = ]       0    [Unmapped]
  -0.0%     -10  [ = ]       0    .debug_line
  -0.0%    -141  [ = ]       0    .debug_info
  -0.0%    -569  [ = ]       0    .debug_str
  -0.0%    -716  +0.0%      +4    TOTAL
use_rust/rp2040_split (peripheral) — 28.1 KiB → 28.1 KiB (-0.01% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  25696	     60	   3060	  28816	   7090	peripheral

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  25700	     60	   3060	  28820	   7094	peripheral

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.0%      +2  [ = ]       0    .debug_str
  +2.0%      +1  [ = ]       0    [Unmapped]
  -0.0%      -3  [ = ]       0    .strtab
  -0.1%      -4  -0.1%      -4    .rodata
  -0.0%      -4  -0.0%      -4    TOTAL
use_rust/stm32f1 — 62.6 KiB → 62.6 KiB (-0.03% ⬇️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
  56624	     28	   7480	  64132	   fa84	rmk-stm32f1

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
  56644	     28	   7480	  64152	   fa98	rmk-stm32f1

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +356  [ = ]       0    .debug_str
  +0.0%    +103  [ = ]       0    .debug_info
   +45%     +21  [ = ]       0    [Unmapped]
  +0.0%     +20  [ = ]       0    .debug_line
  -0.0%      -8  -0.0%      -8    .text
  -1.8%     -12  -1.9%     -12    .rodata
  +0.0%    +480  -0.0%     -20    TOTAL
use_rust/stm32h7 — 121.2 KiB → 121.2 KiB (+0.00% ⬆️)

cargo size (PR):

   text	   data	    bss	    dec	    hex	filename
 108264	    324	  15524	 124112	  1e4d0	rmk-stm32h7

cargo size (main):

   text	   data	    bss	    dec	    hex	filename
 108260	    324	  15524	 124108	  1e4cc	rmk-stm32h7

Bloaty diff (PR vs main):

    FILE SIZE        VM SIZE    
 --------------  -------------- 
  +0.1%    +173  [ = ]       0    .debug_line
  +0.0%    +108  [ = ]       0    .debug_str
   +72%     +28  [ = ]       0    [Unmapped]
  +0.0%      +7  [ = ]       0    .strtab
  +0.1%      +4  +0.1%      +4    .rodata
  -0.0%     -68  [ = ]       0    .debug_info
  +0.0%    +252  +0.0%      +4    TOTAL

@jpds jpds force-pushed the feat/usb-serial-version-stamp branch 3 times, most recently from 6af3e38 to 7306942 Compare May 27, 2026 16:02
@HaoboGu

HaoboGu commented May 28, 2026

Copy link
Copy Markdown
Owner

iirc Vial needs vial:f64c2b3c to work, could you double check whether it works on both web and Vial app?

@jpds jpds force-pushed the feat/usb-serial-version-stamp branch 2 times, most recently from 4974e8b to 25f27ca Compare May 28, 2026 09:38
@jpds

jpds commented May 28, 2026

Copy link
Copy Markdown
Contributor Author

@HaoboGu I had only checked the web UI which worked fine. Adjusted now.

Comment thread docs/docs/main/docs/configuration/keyboard_device.mdx Outdated
Comment thread docs/docs/main/docs/configuration/keyboard_device.mdx Outdated
Comment thread rmk/src/config/device.rs Outdated
#[cfg(feature = "vial")]
pub const RMK_BUILD_INFO: &str = concat!(
"rmk:",
env!("CARGO_PKG_VERSION"),

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are several thoughts about the BUILD_INFO, I think it can be improved to cover:

  1. When using RMK version from git or local path, the CARGO_PKG_VERSION will point to the version in Cargo.toml of used RMK, which is not accurate.
  2. When the workspace is dirty(for example, using a local RMK with edits), the RMK_GIT_HASH is not accurate too.
  3. When using crates.io version, CARGO_PKG_VERSION and RMK_GIT_HASH are always fixed -- that means we can remove either of them.

Comment thread rmk/build.rs Outdated
common::set_target_cfgs(&mut cfgs);

println!("cargo:rerun-if-changed=build.rs");
println!("cargo:rerun-if-changed=.git/HEAD");

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This means ALWAYS rebuild RMK in user space -- which is not correct. This is because that there's no .git/HEAD under rmk folder.

And I don't think use this to monitoring commit changes is correct, .git/HEAD won't change when committing code.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, I had only tested this with my local copy which is all Git based. Simplified it to the crate version.

jpds added 4 commits June 16, 2026 14:40
`DeviceConfig::default()` now sets `serial_number` to `RMK_BUILD_INFO` instead
of the static string `"vial:f64c2b3c:000001"`. For Vial builds (the default),
`RMK_BUILD_INFO` is `vial:f64c2b3c;rmk:<version>`, which lets Vial discover the
keyboard. Non-Vial builds get `rmk:<version>`.

The `vial:` marker is placed first because BLE serial number characteristics
are length limited, so a trailing marker can be truncated.

- `config/device.rs`: add `pub const RMK_BUILD_INFO`, cfg-gated to prefix
  `vial:f64c2b3c;` for Vial builds; use it as the default `serial_number`
- `config/mod.rs`: re-export it as `rmk::config::RMK_BUILD_INFO`
- `ble/mod.rs`: truncate the serial at a char boundary instead of calling
  `unwrap()` on `heapless::String::try_from`, which panics when the
  serial exceeds the 20-byte characteristic
…ult()`

All `use_rust` examples had `serial_number: "vial:f64c2b3c:000001"` set
explicitly. `DeviceConfig::default()` now stamps `serial_number` with
`RMK_BUILD_INFO` (`vial:f64c2b3c;rmk:<version>` for Vial builds), so the
field is redundant. Remove it from all 16 examples.
…` path

When `serial_number` is absent from `keyboard.toml`, `Identity` resolves to
`None` and the macro codegen emits `::rmk::config::RMK_BUILD_INFO`. This gives
`use_config` keyboards the same version-stamped serial as `use_rust` keyboards.
For Vial builds (the default), this includes the `vial:f64c2b3c;` prefix. An
explicit `serial_number` in `keyboard.toml` is still emitted verbatim.
`keyboard_device.mdx` covers the default `RMK_BUILD_INFO` serial stamp,
the `vial:f64c2b3c;` prefix in Vial builds, and how to override
`serial_number` explicitly for custom values.
@jpds jpds force-pushed the feat/usb-serial-version-stamp branch from 25f27ca to 6e93cc4 Compare June 16, 2026 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants