Skip to content

Allow changing the iJack name for MIDI when we do dynamic USB descriptors #4433

Closed

Description

@infovore

I've been prodding this library as an alternative to some other code I have, and it's super-impressive. One question: what's the most appropriate way to change the auto-generated device name?

In my MIDI Monitor tool, I get this:

image

and I've had good success with other boards on changing the detected devicename - which I appreciate might be a USB setting rather than a MIDI-specific setting. I'm new to CP, so am imagining this is a settings.py or boot.py issue, but don't quite know where to begin.

Activity

  1. dhalbert commented on Mar 18, 2021

    @dhalbert
    Collaborator

    This is set in CIrcuitPython at compile time:

    if include_audio:
    # Audio!
    # In and out here are relative to CircuitPython
    # USB OUT -> midi_in_jack_emb -> midi_out_jack_ext -> CircuitPython
    midi_in_jack_emb = midi.InJackDescriptor(
    description="MIDI PC -> {}".format(args.interface_name),
    bJackType=midi.JACK_TYPE_EMBEDDED,
    iJack=StringIndex.index("{} usb_midi.ports[0]".format(args.interface_name)),
    )
    midi_out_jack_ext = midi.OutJackDescriptor(
    description="MIDI data out to user code.",
    bJackType=midi.JACK_TYPE_EXTERNAL,
    input_pins=[(midi_in_jack_emb, 1)],
    iJack=0,
    )
    # USB IN <- midi_out_jack_emb <- midi_in_jack_ext <- CircuitPython
    midi_in_jack_ext = midi.InJackDescriptor(
    description="MIDI data in from user code.", bJackType=midi.JACK_TYPE_EXTERNAL, iJack=0
    )
    midi_out_jack_emb = midi.OutJackDescriptor(
    description="MIDI PC <- {}".format(args.interface_name),
    bJackType=midi.JACK_TYPE_EMBEDDED,
    input_pins=[(midi_in_jack_ext, 1)],
    iJack=StringIndex.index("{} usb_midi.ports[1]".format(args.interface_name)),
    )
    audio_midi_interface = standard.InterfaceDescriptor(
    description="Midi goodness",
    bInterfaceClass=audio.AUDIO_CLASS_DEVICE,
    bInterfaceSubClass=audio.AUDIO_SUBCLASS_MIDI_STREAMING,
    bInterfaceProtocol=audio.AUDIO_PROTOCOL_V1,
    iInterface=StringIndex.index("{} MIDI".format(args.interface_name)),
    subdescriptors=[
    midi.Header(
    jacks_and_elements=[
    midi_in_jack_emb,
    midi_in_jack_ext,
    midi_out_jack_emb,
    midi_out_jack_ext,
    ]
    ),
    standard.EndpointDescriptor(
    description="MIDI data out to {}".format(args.interface_name),
    bEndpointAddress=args.midi_ep_num_out | standard.EndpointDescriptor.DIRECTION_OUT,
    bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
    bInterval=0,
    wMaxPacketSize=512 if args.highspeed else 64,
    ),
    midi.DataEndpointDescriptor(baAssocJack=[midi_in_jack_emb]),
    standard.EndpointDescriptor(
    description="MIDI data in from {}".format(args.interface_name),
    bEndpointAddress=args.midi_ep_num_in | standard.EndpointDescriptor.DIRECTION_IN,
    bmAttributes=standard.EndpointDescriptor.TYPE_BULK,
    bInterval=0x0,
    wMaxPacketSize=512 if args.highspeed else 64,
    ),
    midi.DataEndpointDescriptor(baAssocJack=[midi_out_jack_emb]),
    ],
    )
    , so you would need to do a custom build of CircuitPython to change it.

    We are going to work on dynamic USB descriptors, so setting this name could be a capability we would add. It would not be in this library. If you are interested in this, I will migrate this issue to the circuitpython repo.

  2. infovore commented on Mar 18, 2021

    @infovore
    Author

    @dhalbert yes, that sounds like a good fit - I can see now it's part of the usbmidi code. It'd be a nice-to-have alongside custom USB descriptors (which I've used a lot on other prototyping boards as part of products).

  3. changed the title [-]Most appropriate way to change device name?[/-] [+]Allow changing the iJack name for MIDI when we do dynamic USB descriptors[/+] on Mar 18, 2021
  4. dhalbert commented on Mar 18, 2021

    @dhalbert
    Collaborator

    transferred and re-titled

  5. added this to the Long term milestone on Mar 18, 2021
  6. kevinjwalters commented on Mar 18, 2021

    @kevinjwalters

    @infovore How do two boards show up in that tool?

  7. samkusnetz commented on Dec 5, 2021

    @samkusnetz

    hello. i'm a relatively new user of circuitpython, recently crossing over from my long, long time with arduinos. i would enthusiastically appreciate this feature!

  8. dhalbert commented on Oct 28, 2023

    @dhalbert
    Collaborator

    Superseded by #4191.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions