Re: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-24 Thread Daniel Mack
On 08/22/2014 04:43 AM, Xuebing Wang wrote:
 static inline bool gadget_supports_altsettings(struct usb_gadget *gadget)
 {
  /* PXA 21x/25x/26x has no altsettings at all */
  if (gadget_is_pxa(gadget))
  return false;
 
  /* PXA 27x and 3xx have *broken* altsetting support */
  if (gadget_is_pxa27x(gadget))
  return false;
 
  /* Everything else is *presumably* fine ... */
  return true;
 }

Hmm. On hardware without altsetting support, isochronous endpoints
cannot be used. I wonder whether the gadget core should loudly complain
if it detects such a situation.

This is what the USB spec says in 5.6.3:

 All device default interface settings must not include any isochronous
 endpoints with non-zero data payload sizes (specified via 
 wMaxPacketSize in the endpoint descriptor). Alternate interface 
 settings may specify non-zero data payload sizes for isochronous 
 endpoints.


Daniel

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-22 Thread Xuebing Wang

Hi Community,

I finally fix the UAC1 on Windows 7 host issue. Thanks for your help. I 
will submit patches after more testing.



On 08/22/2014 10:43 AM, Xuebing Wang wrote:


On 08/21/2014 04:24 PM, Sebastian Andrzej Siewior wrote:

On 08/20/2014 02:13 AM, Peter Chen wrote:

Thanks, so Xunbing, the imx6 hardware (chipidea core) have 8 endpoints,
and support all four transfer type, it should be no problem to support
RNDIS.

But you shouldn't use RNDIS on Windows 7 or 8. As far as I recall they
do not bring the RNDIS driver which is deprecated and only supported
by Windows XP which is EOL by now.

Windows 7 and 8 support CDC [0] and this is what you should look for.

[0]
http://msdn.microsoft.com/en-us/library/windows/hardware/ff538820%28v=vs.85%29.aspx 



Sebastian



Sebastian, Peter, Andrzej,

Thank you for your help.

1) Are you aware of any devices (based on Freescale i.MX or ChipIdea 
USB IP) with a gadget driver which uses .bAlternateSetting that 
support Windows 7/8?


2) The reason I am asking this is that USB 1.1 Spec (section 9.2.6.4 
Standard Device Requests) says: For standard device requests that 
require no Data stage, a device *must* be able to complete the request 
and be able to successfully complete the Status stage of the request 
*within 50 ms* of receipt of the request. This limitation applies to 
requests to the device, interface, or endpoint.


I am debugging this Windows support for UAC1, thus I am referring to 
USB 1.1 spec.


3) For any gadget which uses .bAlternateSetting, Host will send 
USB_REQ_SET_INTERFACE Standard Device Request which requires no Data 
State. I am not sure if Windows drivers strictly adhere to USB spec, 
thus strictly require device to respond to USB_REQ_SET_INTERFACE 
within 50ms???


4) In gadget driver set_alt functions (to handle 
USB_REQ_SET_INTERFACE), ep_enable/ep_disable will be called, and 
timing of this differs from hardware platform to platform (and UDC 
drivers), does this explain why below function exists???


4.1) /**
 * gadget_supports_altsettings - return true if altsettings work
 * @gadget: the gadget in question
 */
static inline bool gadget_supports_altsettings(struct usb_gadget *gadget)
{
/* PXA 21x/25x/26x has no altsettings at all */
if (gadget_is_pxa(gadget))
return false;

/* PXA 27x and 3xx have *broken* altsetting support */
if (gadget_is_pxa27x(gadget))
return false;

/* Everything else is *presumably* fine ... */
return true;
}

4.2) /* Some controllers can't support CDC Ethernet (ECM) ... */
static inline bool can_support_ecm(struct usb_gadget *gadget)
{
if (!gadget_supports_altsettings(gadget))
return false;

/* Everything else is *presumably* fine ... but this is a bit
 * chancy, so be **CERTAIN** there are no hardware issues with
 * your controller.  Add it above if it can't handle CDC.
 */
return true;
}


Thanks again.



--
Thanks,
Xuebing Wang

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-21 Thread Sebastian Andrzej Siewior
On 08/20/2014 02:13 AM, Peter Chen wrote:
 
 Thanks, so Xunbing, the imx6 hardware (chipidea core) have 8 endpoints,
 and support all four transfer type, it should be no problem to support
 RNDIS.

But you shouldn't use RNDIS on Windows 7 or 8. As far as I recall they
do not bring the RNDIS driver which is deprecated and only supported
by Windows XP which is EOL by now.

Windows 7 and 8 support CDC [0] and this is what you should look for.

[0]
http://msdn.microsoft.com/en-us/library/windows/hardware/ff538820%28v=vs.85%29.aspx

Sebastian
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-21 Thread Xuebing Wang


On 08/21/2014 04:24 PM, Sebastian Andrzej Siewior wrote:

On 08/20/2014 02:13 AM, Peter Chen wrote:

Thanks, so Xunbing, the imx6 hardware (chipidea core) have 8 endpoints,
and support all four transfer type, it should be no problem to support
RNDIS.

But you shouldn't use RNDIS on Windows 7 or 8. As far as I recall they
do not bring the RNDIS driver which is deprecated and only supported
by Windows XP which is EOL by now.

Windows 7 and 8 support CDC [0] and this is what you should look for.

[0]
http://msdn.microsoft.com/en-us/library/windows/hardware/ff538820%28v=vs.85%29.aspx

Sebastian



Sebastian, Peter, Andrzej,

Thank you for your help.

1) Are you aware of any devices (based on Freescale i.MX or ChipIdea USB 
IP) with a gadget driver which uses .bAlternateSetting that support 
Windows 7/8?


2) The reason I am asking this is that USB 1.1 Spec (section 9.2.6.4 
Standard Device Requests) says: For standard device requests that 
require no Data stage, a device *must* be able to complete the request 
and be able to successfully complete the Status stage of the request 
*within 50 ms* of receipt of the request. This limitation applies to 
requests to the device, interface, or endpoint.


I am debugging this Windows support for UAC1, thus I am referring to USB 
1.1 spec.


3) For any gadget which uses .bAlternateSetting, Host will send 
USB_REQ_SET_INTERFACE Standard Device Request which requires no Data 
State. I am not sure if Windows drivers strictly adhere to USB spec, 
thus strictly require device to respond to USB_REQ_SET_INTERFACE within 
50ms???


4) In gadget driver set_alt functions (to handle USB_REQ_SET_INTERFACE), 
ep_enable/ep_disable will be called, and timing of this differs from 
hardware platform to platform (and UDC drivers), does this explain why 
below function exists???


4.1) /**
 * gadget_supports_altsettings - return true if altsettings work
 * @gadget: the gadget in question
 */
static inline bool gadget_supports_altsettings(struct usb_gadget *gadget)
{
/* PXA 21x/25x/26x has no altsettings at all */
if (gadget_is_pxa(gadget))
return false;

/* PXA 27x and 3xx have *broken* altsetting support */
if (gadget_is_pxa27x(gadget))
return false;

/* Everything else is *presumably* fine ... */
return true;
}

4.2) /* Some controllers can't support CDC Ethernet (ECM) ... */
static inline bool can_support_ecm(struct usb_gadget *gadget)
{
if (!gadget_supports_altsettings(gadget))
return false;

/* Everything else is *presumably* fine ... but this is a bit
 * chancy, so be **CERTAIN** there are no hardware issues with
 * your controller.  Add it above if it can't handle CDC.
 */
return true;
}


Thanks again.

--
Thanks,
Xuebing Wang

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-19 Thread Xuebing Wang


On 08/19/2014 12:58 PM, Peter Chen wrote:
  

My environment is Freescale i.MX6SL EVK board (as USB peripheral device),
which is based on kernel 3.10.17. i.MX6SL uses ChipIdea dual-role
controller.

My problem is that gadget drivers g_ether and g_audio (UAC1 enabled) can
NOT be detected by Windows 7 natively, while g_mass_storage, g_serial,
g_hid can be detected by Windows 7 natively.

1) I found that both Ether and USB Audio uses .bAlternateSetting, while
Mass Storage, Serial and HID do NOT. I am wondering if this is related to
how Gadget framework handles USB_REQ_SET_INTERFACE request?


If possible, would you use Linux PC or Mac OS (macbook pro+) to test?
From my previous experiences, g_audio works not well with windows.


Thanks Peter. g_audio is now working with Ubuntu and MacOS host, but can 
NOT get detected by Windows 7.


I am not sure if this Windows 7 detection issue is not specific to 
g_audio (UAC1), because Windows can NOT natively detect g_ether (even 
with RNDIS CONFIG_USB_ETH_RNDIS=y enabled).


Also, in file f_rndis.c, it says /* Some controllers can't support 
RNDIS ... */, I am not sure what does this mean. Does it mean possibly 
controller like ChipIdea does NOT support RNDIS?




2) Also, I am not sure if it is related to ChipIdea quirk
(gadget_supports_altsettings in file gadget_chips.h)?

  
I can't find chipidea quirk at gadget_chips.h, besides, altsettings

are software stuff.

Peter


--
Thanks,
Xuebing Wang

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-19 Thread Peter Chen
On Tue, Aug 19, 2014 at 06:05:27PM +0800, Xuebing Wang wrote:
 
 On 08/19/2014 12:58 PM, Peter Chen wrote:
 My environment is Freescale i.MX6SL EVK board (as USB peripheral device),
 which is based on kernel 3.10.17. i.MX6SL uses ChipIdea dual-role
 controller.
 
 My problem is that gadget drivers g_ether and g_audio (UAC1 enabled) can
 NOT be detected by Windows 7 natively, while g_mass_storage, g_serial,
 g_hid can be detected by Windows 7 natively.
 
 1) I found that both Ether and USB Audio uses .bAlternateSetting, while
 Mass Storage, Serial and HID do NOT. I am wondering if this is related to
 how Gadget framework handles USB_REQ_SET_INTERFACE request?
 
 If possible, would you use Linux PC or Mac OS (macbook pro+) to test?
 From my previous experiences, g_audio works not well with windows.
 
 Thanks Peter. g_audio is now working with Ubuntu and MacOS host, but
 can NOT get detected by Windows 7.
 
 I am not sure if this Windows 7 detection issue is not specific to
 g_audio (UAC1), because Windows can NOT natively detect g_ether
 (even with RNDIS CONFIG_USB_ETH_RNDIS=y enabled).
 
 Also, in file f_rndis.c, it says /* Some controllers can't support
 RNDIS ... */, I am not sure what does this mean. Does it mean
 possibly controller like ChipIdea does NOT support RNDIS?
 

RNDIS is software stuff, isn't it?

 
 2) Also, I am not sure if it is related to ChipIdea quirk
 (gadget_supports_altsettings in file gadget_chips.h)?
 
 I can't find chipidea quirk at gadget_chips.h, besides, altsettings
 are software stuff.
 
 Peter
 
 -- 
 Thanks,
 Xuebing Wang
 

-- 
Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-19 Thread Felipe Balbi
On Tue, Aug 19, 2014 at 10:27:39PM +0800, Peter Chen wrote:
 On Tue, Aug 19, 2014 at 06:05:27PM +0800, Xuebing Wang wrote:
  
  On 08/19/2014 12:58 PM, Peter Chen wrote:
  My environment is Freescale i.MX6SL EVK board (as USB peripheral device),
  which is based on kernel 3.10.17. i.MX6SL uses ChipIdea dual-role
  controller.
  
  My problem is that gadget drivers g_ether and g_audio (UAC1 enabled) can
  NOT be detected by Windows 7 natively, while g_mass_storage, g_serial,
  g_hid can be detected by Windows 7 natively.
  
  1) I found that both Ether and USB Audio uses .bAlternateSetting, while
  Mass Storage, Serial and HID do NOT. I am wondering if this is related to
  how Gadget framework handles USB_REQ_SET_INTERFACE request?
  
  If possible, would you use Linux PC or Mac OS (macbook pro+) to test?
  From my previous experiences, g_audio works not well with windows.
  
  Thanks Peter. g_audio is now working with Ubuntu and MacOS host, but
  can NOT get detected by Windows 7.
  
  I am not sure if this Windows 7 detection issue is not specific to
  g_audio (UAC1), because Windows can NOT natively detect g_ether
  (even with RNDIS CONFIG_USB_ETH_RNDIS=y enabled).
  
  Also, in file f_rndis.c, it says /* Some controllers can't support
  RNDIS ... */, I am not sure what does this mean. Does it mean
  possibly controller like ChipIdea does NOT support RNDIS?
  
 
 RNDIS is software stuff, isn't it?

it probably means that some HW configuration doesn't have enough
endpoints, or doesn't support a certain transfer type ;-)

-- 
balbi


signature.asc
Description: Digital signature


Re: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-19 Thread Peter Chen
On Tue, Aug 19, 2014 at 09:36:19AM -0500, Felipe Balbi wrote:
 On Tue, Aug 19, 2014 at 10:27:39PM +0800, Peter Chen wrote:
  On Tue, Aug 19, 2014 at 06:05:27PM +0800, Xuebing Wang wrote:
   
   On 08/19/2014 12:58 PM, Peter Chen wrote:
   My environment is Freescale i.MX6SL EVK board (as USB peripheral 
   device),
   which is based on kernel 3.10.17. i.MX6SL uses ChipIdea dual-role
   controller.
   
   My problem is that gadget drivers g_ether and g_audio (UAC1 enabled) can
   NOT be detected by Windows 7 natively, while g_mass_storage, g_serial,
   g_hid can be detected by Windows 7 natively.
   
   1) I found that both Ether and USB Audio uses .bAlternateSetting, while
   Mass Storage, Serial and HID do NOT. I am wondering if this is related 
   to
   how Gadget framework handles USB_REQ_SET_INTERFACE request?
   
   If possible, would you use Linux PC or Mac OS (macbook pro+) to test?
   From my previous experiences, g_audio works not well with windows.
   
   Thanks Peter. g_audio is now working with Ubuntu and MacOS host, but
   can NOT get detected by Windows 7.
   
   I am not sure if this Windows 7 detection issue is not specific to
   g_audio (UAC1), because Windows can NOT natively detect g_ether
   (even with RNDIS CONFIG_USB_ETH_RNDIS=y enabled).
   
   Also, in file f_rndis.c, it says /* Some controllers can't support
   RNDIS ... */, I am not sure what does this mean. Does it mean
   possibly controller like ChipIdea does NOT support RNDIS?
   
  
  RNDIS is software stuff, isn't it?
 
 it probably means that some HW configuration doesn't have enough
 endpoints, or doesn't support a certain transfer type ;-)
 

Thanks, so Xunbing, the imx6 hardware (chipidea core) have 8 endpoints,
and support all four transfer type, it should be no problem to support
RNDIS.


-- 
Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-18 Thread Xuebing Wang

Hi Community,

My environment is Freescale i.MX6SL EVK board (as USB peripheral 
device), which is based on kernel 3.10.17. i.MX6SL uses ChipIdea 
dual-role controller.


My problem is that gadget drivers g_ether and g_audio (UAC1 enabled) can 
NOT be detected by Windows 7 natively, while g_mass_storage, g_serial, 
g_hid can be detected by Windows 7 natively.


1) I found that both Ether and USB Audio uses .bAlternateSetting, while 
Mass Storage, Serial and HID do NOT. I am wondering if this is related 
to how Gadget framework handles USB_REQ_SET_INTERFACE request?


2) Also, I am not sure if it is related to ChipIdea quirk 
(gadget_supports_altsettings in file gadget_chips.h)?


Any suggestions / comments on this? Thanks.

--
Thanks,
Xuebing Wang

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


RE: [linux-usb] USB Gadget drivers Windows 7/8 support and .bAlternateSetting in interface descriptor

2014-08-18 Thread Peter Chen
 
 
 My environment is Freescale i.MX6SL EVK board (as USB peripheral device),
 which is based on kernel 3.10.17. i.MX6SL uses ChipIdea dual-role
 controller.
 
 My problem is that gadget drivers g_ether and g_audio (UAC1 enabled) can
 NOT be detected by Windows 7 natively, while g_mass_storage, g_serial,
 g_hid can be detected by Windows 7 natively.
 
 1) I found that both Ether and USB Audio uses .bAlternateSetting, while
 Mass Storage, Serial and HID do NOT. I am wondering if this is related to
 how Gadget framework handles USB_REQ_SET_INTERFACE request?
 

If possible, would you use Linux PC or Mac OS (macbook pro+) to test?
From my previous experiences, g_audio works not well with windows.

 2) Also, I am not sure if it is related to ChipIdea quirk
 (gadget_supports_altsettings in file gadget_chips.h)?
 
 
I can't find chipidea quirk at gadget_chips.h, besides, altsettings
are software stuff.

Peter

--
To unsubscribe from this list: send the line unsubscribe linux-usb in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html