1

I have this USB volume control, but when I adjust the volume, it adjusts it two steps at a time.

When I connect it, it registers as a USB keyboard.

My guess is that it is sending the "keypress" for the volume change twice.

  1. Is there a way to confirm that it is sending two keypresses?
  2. (If step 1. confirms it) Is there a way to write a script to detect this and ignore the second keypress?

Thanks!

  • To see if it's sending key presses, use the xev utility. See: https://apple.stackexchange.com/a/317556/119271 and as far as writing a "script", it's not that simple - you'd need a listener application (applescript is not the right tool for this job) to continually watch for and intercept it, and that's a project/question for the folks over at [so] – Allan Apr 11 '20 at 23:04
  • Interesting - it doesn't show anything! My bluetooth keyboard and the laptop keyboard both show events for normal keypresses, but when I change the volume (on the bluetooth keyboard, laptop touch bar or USB volume control) nothing comes up in xev (but the volume still changes). Maybe it registers as a touchbar event? Is there an equivalent of xev for touchbar events? – Ben Holness Apr 11 '20 at 23:14
  • then it's not a key press. volume up/down are "hooks" in the OS; certain keys just happen to be mapped to those hooks. I suspect (pretty sure actually) that USB controller is calling them directly and not sending keypresses. – Allan Apr 11 '20 at 23:18
  • Well, when I connect the USB volume control, it says a keyboard is connected, and when I press the volume button on my bluetooth keyboard, the same thing happens, so I guess it might be a "key press" in the same way that changing the volume from my keyboard is a "key press". I would guess that the USB volume control is a keypress in that respect, but that the OS maps the keypress from either device to the volume hook before xev gets to see what's happening. – Ben Holness Apr 11 '20 at 23:25
  • When I connect my Logitech MX Master 3, it identifies it as a keyboard as well but that doesn't mean my scroll up/down or mouse moments translates to arrow keys. What you described in relation to xev is not how it works. xev is that listener app I was referring to - if a key is being pressed, xev is going to see it. A key press simply cannot bypass it. – Allan Apr 11 '20 at 23:30
  • I meant "key press" in terms of the physical key that I press on my bluetooth keyboard to change the volume, which xev doesn't see. So if the OS doesn't map it to the volume hook before xev sees it, then I guess the keyboard itself must be translating the key press to the volume hook before sending it to the OS. Is there an equivalent command to xev that listens for the volume change hook being called? – Ben Holness Apr 11 '20 at 23:37
  • There might be, but I currently am not aware of any. – Allan Apr 11 '20 at 23:40

0 Answers0