I’ve refactored the examples slightly.
I’d love to hear from someone with a recent Mac whether this works, and whether plugging and unplugging devices works fluently.