Macro keyboard works on computer but not on recorder.

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
MikeAelbrecht
 
Posts: 6
Joined: Sun May 08, 2022 5:35 am

Macro keyboard works on computer but not on recorder.

Post by MikeAelbrecht »

So I made a macro keyboard using the pico and the usb_hid library.
When I connect the macro keyboard to my dektop is works how it should but when I connect it to my recorder https://cdn.sounddevices.com/wp-content ... 041122.pdf it stops working, when pressing a macro the program just crashes. I used USB Tree viewer and there I see that the pico is listed as Keyboard (that is what I programmed in boot.py) but also as Audio https://imgur.com/QulPcRM. Could this cause the problem or could it be something else, and does anyonne have a idea how to fix this problem.

User avatar
danhalbert
 
Posts: 4686
Joined: Tue Aug 08, 2017 12:37 pm

Re: Macro keyboard works on computer but not on recorder.

Post by danhalbert »

Yes, it's a composite device, which your recorder may not like. The "audio" in this case means MIDI, and you can disable MIDI (and other functions). See https://learn.adafruit.com/customizing- ... cuitpython.

It may still be the case that your recorder also doesn't like the fact that it's presenting as both a mouse and keyboard. You can then also disable the mouse.

User avatar
MikeAelbrecht
 
Posts: 6
Joined: Sun May 08, 2022 5:35 am

Re: Macro keyboard works on computer but not on recorder.

Post by MikeAelbrecht »

I disabled MIDI and Mouse so the pico is only visible as a Keyboard but still no luck. I also have storage disabled but I don't think that would be the problem. But worth noting is that the program doesn't start up anymore when plugged in... Normaly the program starts and on the press of a maco it crashes but now it doesn't do anything.

User avatar
danhalbert
 
Posts: 4686
Joined: Tue Aug 08, 2017 12:37 pm

Re: Macro keyboard works on computer but not on recorder.

Post by danhalbert »

Check BOOT_OUT.TXT to see if there are any errors being printed during the boot.py execution.

User avatar
MikeAelbrecht
 
Posts: 6
Joined: Sun May 08, 2022 5:35 am

Re: Macro keyboard works on computer but not on recorder.

Post by MikeAelbrecht »

No, there are no errors in boot_out that is what I find weird…

User avatar
danhalbert
 
Posts: 4686
Joined: Tue Aug 08, 2017 12:37 pm

Re: Macro keyboard works on computer but not on recorder.

Post by danhalbert »

Are you saying that it now doesn't work on the computer as well? Could you post your code here?

User avatar
MikeAelbrecht
 
Posts: 6
Joined: Sun May 08, 2022 5:35 am

Re: Macro keyboard works on computer but not on recorder.

Post by MikeAelbrecht »

It does work on the computer but not on the recorder, I’ll post my code tomorrow.

User avatar
danhalbert
 
Posts: 4686
Joined: Tue Aug 08, 2017 12:37 pm

Re: Macro keyboard works on computer but not on recorder.

Post by danhalbert »

Did you try ` usb_hid.enable((usb_hid.Device.KEYBOARD,))` to make it a keyboard only?

This user had a similar issue when trying to emulate a mouse for a Nintendo Switch: https://github.com/dglaude/Wii_uDraw_fo ... ndo_Switch
The Switch did not like that the mouse was still contained in a composite device, so he had to create a mouse-only device.
It's not too hard to create a keyboard-only device. Here is a standard USB HID report descriptor for a keyboard:
https://github.com/praeclarum/circuitpy ... ors.py#L57. Remoe the surrounding stuff, and remove line 60.

User avatar
MikeAelbrecht
 
Posts: 6
Joined: Sun May 08, 2022 5:35 am

Re: Macro keyboard works on computer but not on recorder.

Post by MikeAelbrecht »

Yes, this is my boot.py file:

Code: Select all

import storage
import board, digitalio
import usb_hid
import usb_midi

# Initialize a button on GPIO0 or pin 1 of the pico
button = digitalio.DigitalInOut(board.GP0)
button.direction = digitalio.Direction.INPUT
button.pull = digitalio.Pull.DOWN

# Disable devices only if button is not pressed.
if not button.value:
   storage.disable_usb_drive()
   
# Disable MIDI control
usb_midi.disable()
   
# Set the device as a keyboard only
usb_hid.enable((usb_hid.Device.KEYBOARD,))
So I set the pico only as a Keyboard.
I use the build in Keyboard HID that came with the libraries, that should work aswell right?

User avatar
danhalbert
 
Posts: 4686
Joined: Tue Aug 08, 2017 12:37 pm

Re: Macro keyboard works on computer but not on recorder.

Post by danhalbert »

I use the build in Keyboard HID that came with the libraries, that should work as well right?
Sorry for the delay, yes, that should work.

User avatar
MikeAelbrecht
 
Posts: 6
Joined: Sun May 08, 2022 5:35 am

Re: Macro keyboard works on computer but not on recorder.

Post by MikeAelbrecht »

No problem! The error kept occurring and I remade it using an arduino pro micro and the same issue happens, so the recorder handles HID inputs a bit weird I guess

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”