Linux-ACPI Archive on lore.kernel.org
 help / color / Atom feed
From: "Bjørn Mork" <bjorn@mork.no>
To: <Charles.Hyde@dellteam.com>
Cc: <stern@rowland.harvard.edu>, <oliver@neukum.org>,
	<rjw@rjwysocki.net>, <lenb@kernel.org>,
	<Mario.Limonciello@dell.com>, <chip.programmer@gmail.com>,
	<nic_swsd@realtek.com>, <linux-usb@vger.kernel.org>,
	<linux-acpi@vger.kernel.org>
Subject: Re: [PATCH 1/3] net: cdc_ncm: add get/set ethernet address functions
Date: Fri, 06 Sep 2019 22:39:43 +0200
Message-ID: <87ftl9qhv4.fsf@miraculix.mork.no> (raw)
In-Reply-To: <d8cdacc63ddd4da4a88d3712b2b53d32@AUSX13MPS307.AMER.DELL.COM>

<Charles.Hyde@dellteam.com> writes:

>> > What better suggestion do folks have, instead of using
>> USB_REQ_SET_ADDRESS?
>> 
>> The spec is clear: wIndex is supposed to be 'NCM Communications Interface'.
>> That's how you address a specific NCM function (a USB device can have more
>> than one...), and that's what you'll see in all the other interface specific class
>> requests in this driver.  You don't have to look hard to find examples.
>> 
>> 
>> Bjørn
>
>
> I have presented what works, with the v3 patch series.

Sure. It will work iff your NCM function has a control interface
numbered 5.  Most NCM functions do not.

> Mind you, the code I have provided sends the exact same USB message as
>  I traced with Wireshark on my Windows system.

Snooping on communcation with one specific device is not a good way to
figure out dynamic content. wIndex cannot be a constant.  It depends on
the device configuration.

>If you can provide good working code that replicates what I have
>provided, I would be thrilled.

There is working control request code a few lines up in the driver.  I
didn't think it was too much to ask that you looked it up.  But I can
copy an example here too:


static int cdc_ncm_init(struct usbnet *dev)
{
	struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
	u8 iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber;
	int err;

	err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_PARAMETERS,
			      USB_TYPE_CLASS | USB_DIR_IN
			      |USB_RECIP_INTERFACE,
			      0, iface_no, &ctx->ncm_parm,
			      sizeof(ctx->ncm_parm));
,,

You'll obviously have to replace USB_CDC_GET_NTB_PARAMETERS with
USB_CDC_GET_NET_ADDRESS, &ctx->ncm_parm with buf, and
sizeof(ctx->ncm_parm) with ETH_ALEN.


Bjørn

  reply index

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-05 21:01 Charles.Hyde
2019-09-06  9:02 ` Bjørn Mork
2019-09-06 18:00   ` Charles.Hyde
2019-09-06 18:15     ` Alan Stern
2019-09-06 18:19       ` Charles.Hyde
2019-09-06 20:07         ` Bjørn Mork
2019-09-06 20:20           ` Charles.Hyde
2019-09-06 20:39             ` Bjørn Mork [this message]
2019-09-06 21:00               ` Charles.Hyde
  -- strict thread matches above, loose matches on Subject: below --
2019-08-30 19:37 Charles.Hyde
2019-09-02  9:43 ` Oliver Neukum
2019-09-03 16:45   ` Charles.Hyde

Reply instructions:

You may reply publically 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=87ftl9qhv4.fsf@miraculix.mork.no \
    --to=bjorn@mork.no \
    --cc=Charles.Hyde@dellteam.com \
    --cc=Mario.Limonciello@dell.com \
    --cc=chip.programmer@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=oliver@neukum.org \
    --cc=rjw@rjwysocki.net \
    --cc=stern@rowland.harvard.edu \
    /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

Linux-ACPI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-acpi/0 linux-acpi/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-acpi linux-acpi/ https://lore.kernel.org/linux-acpi \
		linux-acpi@vger.kernel.org linux-acpi@archiver.kernel.org
	public-inbox-index linux-acpi

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-acpi


AGPL code for this site: git clone https://public-inbox.org/ public-inbox