USB HID does have codes for locking versions of Caps Lock, Num Lock, and Scroll Lock¹. OS X might support these, given that older Mac keyboards had locking Caps Lock. Linux doesn't².
Having written USB HID code for barcode scanners where this came up (thrilling I know). None of the major OSes support it including OS X. It’s sort of a homage to a historical artifact (that table dates to the early 90s) but useless because even if you use those old keyboards you will have to emulate with the usual scan code.
Barcode scanners are cool. I'm working on setting up a barcode system for my personal library and then probably home inventory. Do you have any recommendations?
I found 4 used scanners for cheap (Datalogic Gryphon GD4400).
¹ https://www.usb.org/document-library/hid-usage-tables-15
² https://elixir.bootlin.com/linux/v6.7.3/source/drivers/hid/h...