From: "Bjørn Mork" <bjorn@mork.no>
To: hayeswang <hayeswang@realtek.com>
Cc: <oliver@neukum.org>, <netdev@vger.kernel.org>,
"'nic_swsd'" <nic_swsd@realtek.com>,
<linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>
Subject: Re: [PATCH net-next v2 6/6] r8152: support RTL8153
Date: Mon, 06 Jan 2014 10:21:56 +0100 [thread overview]
Message-ID: <87eh4l31or.fsf@nemi.mork.no> (raw)
In-Reply-To: <AA7EB9EA13B74B14BBE08C4278F7948C@realtek.com.tw> (hayeswang@realtek.com's message of "Mon, 6 Jan 2014 11:20:43 +0800")
hayeswang <hayeswang@realtek.com> writes:
> Bjørn Mork [mailto:bjorn@mork.no]
> [...]
>> Sorry, but then this makes even less sense. The active USB
>> configuration is user selectable and you should make any of
>> them work if
>> possible. Why can't the drivers figure out this at runtime?
>
> Excuse me. I have no idea about how to switch the configuration at
> the runtime ,and how to change the default configuration when a
> USB device is plugged. When a user select one of the configurations,
> he/she would wish to fix the configuration number after rebooting or
> after the dangle is unplugged and plugged again. For these reasons,
> this is the simple way which I could think. Maybe I choose the wrong
> method because I don't know how to satisfy the requests. May you
> provide me the relative information? Then, I could replace the current
> method. Thanks.
I apologise if I misunderstood you. When you mentioned multiple
configurations, then I assumed it was a device similar to this one
(partial output from /sys/kernel/debug/usb/devices):
T: Bus=03 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 2
P: Vendor=1199 ProdID=68a2 Rev= 0.06
S: Manufacturer=Sierra Wireless, Incorporated
S: Product=MC7710
S: SerialNumber=358178040092316
C: #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr= 0mA
I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I: If#= 8 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I: If#=19 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=87(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I: If#=20 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=
E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
C:* #Ifs= 2 Cfg#= 2 Atr=e0 MxPwr= 0mA
A: FirstIf#=12 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
I:* If#=12 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=cdc_mbim
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
I: If#=13 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
I:* If#=13 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=cdc_mbim
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
Here you can see 2 configurations, where cfg #2 is active using a class
driver. This is what Linux will choose in this case because the first
interface of cfg #1 is vendor specific. But an end user can change it
by writing to the bConfigurationValue sysfs attribute:
nemi:/tmp# echo 1 > /sys/bus/usb/devices/3-4/bConfigurationValue
giving this result:
T: Bus=03 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0
D: Ver= 2.00 Cls=ef(misc ) Sub=02 Prot=01 MxPS=64 #Cfgs= 2
P: Vendor=1199 ProdID=68a2 Rev= 0.06
S: Manufacturer=Sierra Wireless, Incorporated
S: Product=MC7710
S: SerialNumber=358178040092316
C:* #Ifs= 6 Cfg#= 1 Atr=e0 MxPwr= 0mA
I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=qcserial
E: Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=qcserial
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qcserial
E: Ad=83(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=84(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=03(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#= 8 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E: Ad=85(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=86(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=04(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#=19 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan
E: Ad=87(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=88(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=05(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
I:* If#=20 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
E: Ad=89(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
E: Ad=8a(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=06(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
C: #Ifs= 2 Cfg#= 2 Atr=e0 MxPwr= 0mA
A: FirstIf#=12 IfCount= 2 Cls=02(comm.) Sub=0e Prot=00
I: If#=12 Alt= 0 #EPs= 1 Cls=02(comm.) Sub=0e Prot=00 Driver=
E: Ad=81(I) Atr=03(Int.) MxPS= 64 Ivl=2ms
I: If#=13 Alt= 0 #EPs= 0 Cls=0a(data ) Sub=00 Prot=02 Driver=
I: If#=13 Alt= 1 #EPs= 2 Cls=0a(data ) Sub=00 Prot=02 Driver=
E: Ad=82(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E: Ad=01(O) Atr=02(Bulk) MxPS= 512 Ivl=4ms
Exactly the same device, but now cfg #1 is active and a different set of
drivers have bound to the interfaces. This is possible because none of
the involved drivers disable the support for this device at build-time.
Instead they use the available interface descriptors for matching and
probing supported functions.
End users will of course normally not go around writing stuff to sysfs
attributes like this. Creating an udev rule to select a specific
counfiguration when the device is plugged is more useful for normal
usage.
My point was that this sort of runtime configuration change should be
possible, assuming my understanding of the device layout is correct.
Which it isn't necessarily. I don't have any such device and I haven't
seen any USB descriptor dump from one either.
Bjørn
next prev parent reply other threads:[~2014-01-06 9:21 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-27 2:34 [PATCH net-next 0/6] Support new chip Hayes Wang
[not found] ` <1388111649-1014-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
2013-12-27 2:34 ` [PATCH net-next 1/6] r8152: move rtl8152_unload and ocp_reg_write Hayes Wang
2013-12-27 2:34 ` [PATCH net-next 2/6] r8152: modify the method of accessing PHY Hayes Wang
2013-12-27 2:34 ` [PATCH net-next 3/6] r8152: change some definitions Hayes Wang
2013-12-27 18:57 ` Francois Romieu
2013-12-27 2:34 ` [PATCH net-next 4/6] r8152: add rtl_ops Hayes Wang
2013-12-27 17:28 ` David Miller
2013-12-27 2:34 ` [PATCH net-next 5/6] r8152: split rtl8152_enable Hayes Wang
2013-12-27 2:37 ` [PATCH net-next 6/6] r8152: support RTL8153 Hayes Wang
2013-12-27 19:08 ` Francois Romieu
2014-01-02 3:22 ` [PATCH net-next v2 0/6] support new chip Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 1/6] r8152: move rtl8152_unload and ocp_reg_write Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 2/6] r8152: modify the method of accessing PHY Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 3/6] r8152: change some definitions Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 4/6] r8152: add rtl_ops Hayes Wang
2014-01-02 3:22 ` [PATCH net-next v2 5/6] r8152: split rtl8152_enable Hayes Wang
2014-01-02 3:25 ` [PATCH net-next v2 6/6] r8152: support RTL8153 Hayes Wang
2014-01-02 14:25 ` Bjørn Mork
2014-01-03 2:56 ` hayeswang
2014-01-03 7:49 ` Bjørn Mork
2014-01-06 3:20 ` hayeswang
2014-01-06 9:21 ` Bjørn Mork [this message]
2014-01-07 12:35 ` hayeswang
[not found] ` <749DBDC9792E47BBA5884BEC7CF2D639-Rasf1IRRPZGoECsaD+WFmw@public.gmane.org>
2014-01-08 18:24 ` Ben Hutchings
[not found] ` <1388632963-1341-1-git-send-email-hayeswang-Rasf1IRRPZFBDgjK7y7TUQ@public.gmane.org>
2014-01-02 3:55 ` [PATCH net-next v2 0/6] support new chip David Miller
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=87eh4l31or.fsf@nemi.mork.no \
--to=bjorn@mork.no \
--cc=hayeswang@realtek.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=oliver@neukum.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;
as well as URLs for NNTP newsgroup(s).