Alsa-Devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: Mario Kicherer <dev@kicherer.org>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH v6] MIDI driver for Behringer BCD2000 USB device
Date: Sun, 23 Feb 2014 21:24:22 +0100	[thread overview]
Message-ID: <530A58F6.7030700@ladisch.de> (raw)
In-Reply-To: <1392909089-6242-1-git-send-email-dev@kicherer.org>

Mario Kicherer wrote:
> +static unsigned char bcd2000_init_sequence[] = {
> +	0x07, 0x00, 0x00, 0x00, 0x78, 0x48, 0x1c, 0x81,
> +	0xc4, 0x00, 0x00, 0x00, 0x5e, 0x53, 0x4a, 0xf7,
> +	0x18, 0xfa, 0x11, 0xff, 0x6c, 0xf3, 0x90, 0xff,
> +	0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
> +	0x18, 0xfa, 0x11, 0xff, 0x14, 0x00, 0x00, 0x00,
> +	0x00, 0x00, 0x00, 0x00, 0xf2, 0x34, 0x4a, 0xf7,
> +	0x18, 0xfa, 0x11, 0xff
> +};

I wonder how much of this is the actual init sequence, and how much is
random garbage.  :-)

> +	/*
> +	 * Packet structure: mm nn oo (pp)
> +	 *	mm: payload length
> +	 *	nn: MIDI command or note
> +	 *	oo: note or velocity
> +	 *	pp: velocity

The device often sends data as single-byte packets, so the structure
actually is "length data...".

> +	/* copy the "set LED" command bytes */
> +	memcpy(bcd2k->midi_out_buf, device_cmd_prefix,
> +		sizeof(device_cmd_prefix));

This is also used for data request and input selection, so it's not
"set LED" but just "MIDI output".

> +static void bcd2000_input_complete(struct urb *urb)
> +{
> +	if (urb->status) {
> +		dev_warn(dev, PREFIX "input urb->status: %i\n", urb->status);
> +		return;
> +	}

This will stop the input even on transient errors.

> +	/* acknowledge received packet */
> +	ret = usb_submit_urb(bcd2k->midi_in_urb, GFP_ATOMIC);
> +	if (ret < 0)
> +		dev_err(dev, "unable to submit urb. OOM!?\n");

Don't guess, just show ret.  :)

> +	strcpy(card->driver, DEVICE_NAME);
> +	strcpy(card->shortname, DEVICE_SHORTNAME);
> +	usb_make_path(bcd2k->dev, usb_path, sizeof(usb_path));
> +	snprintf(bcd2k->card->longname, sizeof(bcd2k->card->longname),
> +			DEVICE_NAME ", at %s",
> +			usb_path);

$ cat /proc/asound/cards
...
18 [bcd2000        ]: Behringer BCD200bcd2000 - bcd2000
                      Behringer BCD2000, at usb-0000:00:13.1-3

The driver name just identifies the driver, it does not need the vendor
name.  (And it should not overflow its buffer.)

The short name is shown to the user in many places, so it should be
properly capitalized.

The long name does not need the comma.

> +	dev_info(&bcd2k->dev->dev, PREFIX "%s", bcd2k->card->longname);

What use does this message have in the log?


Regards,
Clemens

  reply	other threads:[~2014-02-23 20:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-20 15:11 [PATCH v6] MIDI driver for Behringer BCD2000 USB device Mario Kicherer
2014-02-23 20:24 ` Clemens Ladisch [this message]
2014-02-24 20:05   ` Mario Kicherer
2014-02-24 20:39     ` Clemens Ladisch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=530A58F6.7030700@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dev@kicherer.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox