Re: USB networking (cdce) with Linux host (g_ether)

2015-04-08 Thread Christof Meerwald
On Wed, Apr 08, 2015 at 11:50:29AM +0100, Nick Hudson wrote:
 and with umodem.c:1.66 removed?

usbd_new_device bus=0xbfc9205c port=3 depth=2 speed=3
usbd_new_device: adding unit addr=3, rev=200, class=2, subclass=0, protocol=0, 
maxpacket=64, len=18, speed=3
usbd_new_device: new dev (addr 3), dev=0xbff0cd90, parent=0xbfc6a208
usbd_probe_and_attach: trying device specific drivers
usbd_probe_and_attach: no device specific driver found
usbd_probe_and_attach: looping over 2 configurations
usbd_set_config_index: (addr 2) cno=3 attr=0xc0, selfpowered=1, power=500
usbd_set_config_index: set config 2
usbd_attachinterfaces: interface 0 0xbf3ae758
usbd_attachinterfaces: interface 1 0xbf3ae774
usbd_attachinterfaces: searching for interface 0 class 2 subclass 2 proto ff 
ifaceno 0
usbd_attachinterfaces: searching for interface 1 class a subclass 0 proto 0 
ifaceno 1
usbd_set_config_index: free old config
usbd_set_config_index: (addr 1) cno=3 attr=0xc0, selfpowered=1, power=500
usbd_set_config_index: set config 1
usbd_attachinterfaces: interface 0 0xbf3ae758
usbd_attachinterfaces: interface 1 0xbf3ae774
usbd_attachinterfaces: searching for interface 0 class 2 subclass 6 proto 0 
ifaceno 0
cdce0 at uhub2 port 3 configuration 1 interface 0
cdce0: Linux 4.0.0-rc4-bone0 with musb-hdrc RNDIS/Ethernet Gadget, rev 
2.00/4.00, addr 3
cdce0: address 52:54:c0:a8:af:02
usbd_attachinterfaces: interface 0 claimed behind our 
backusbd_attachinterfaces: interface 1 claimed behind our 
backusbd_attachinterfaces: interface 1 claimed


Christof

-- 

http://cmeerw.org  sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org   xmpp:cmeerw at cmeerw.org


Re: USB networking (cdce) with Linux host (g_ether)

2015-04-08 Thread Nick Hudson

On 04/07/15 20:52, Christof Meerwald wrote:

On Sun, Apr 05, 2015 at 10:12:50AM +0100, Nick Hudson wrote:

Can you boot with -xv flags and an updated -current kernel with USB_DEBUG
and usbdebug set? I've add some more debug output to the kernel.

this is the output I get when plugging in the USB cable with the
-current kernel (leaving umodem.c unpatched):

usbd_new_device bus=0xbfc9205c port=3 depth=2 speed=3
usbd_new_device: adding unit addr=3, rev=200, class=2, subclass=0, protocol=0, 
maxpacket=64, len=18, speed=3
usbd_new_device: new dev (addr 3), dev=0xbff0ce10, parent=0xbfc6a208
usbd_probe_and_attach: trying device specific drivers
usbd_probe_and_attach: no device specific driver found
usbd_probe_and_attach: looping over 2 configurations
usbd_set_config_index: (addr 2) cno=3 attr=0xc0, selfpowered=1, power=500
usbd_set_config_index: set config 2
usbd_attachinterfaces: interface 0 0xbf37b428
usbd_attachinterfaces: interface 1 0xbf37b444
usbd_attachinterfaces: searching for interface 0 class 2 subclass 2 proto ff 
ifaceno 0
usbd_attachinterfaces: searching for interface 1 class a subclass 0 proto 0 
ifaceno 1
umodem0 at uhub2 port 3 configuration 2 interface 1
umodem0: Linux 4.0.0-rc4-bone0 with musb-hdrc RNDIS/Ethernet Gadget, rev 
2.00/4.00, addr 3, iclass 10/0
umodem0: no pointer to data interface
usbd_attachinterfaces: interface 1 claimed behind our back


Christof



and with umodem.c:1.66 removed?

Thanks,
Nick


Re: USB networking (cdce) with Linux host (g_ether)

2015-04-08 Thread Ryo ONODERA
Hi,

From: Nick Hudson sk...@netbsd.org, Date: Sun, 05 Apr 2015 10:12:50 +0100

 On 04/05/15 01:52, Ryo ONODERA wrote:
 Hi,

 I believe that following patch is good for us because my USB modem
 device
 is bad information and it should be treated as special case.

 Index: sys/dev/usb/umodem.c
 ===
 RCS file: /cvsroot/src/sys/dev/usb/umodem.c,v
 retrieving revision 1.66
 diff -u -r1.66 umodem.c
 --- sys/dev/usb/umodem.c 6 Apr 2014 02:01:43 -   1.66
 +++ sys/dev/usb/umodem.c 5 Apr 2015 00:49:30 -
 @@ -81,6 +81,11 @@
  NULL,
   };
   +Static const struct usb_devno umodem_devs[] = {
 +{ USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_MODEM_1},
 +};
 +#define umodem_lookup(v, p) usb_lookup(umodem_devs, v, p)
 +
   int umodem_match(device_t, cfdata_t, void *);
   voidumodem_attach(device_t, device_t, void *);
   int umodem_detach(device_t, int);
 @@ -97,22 +102,24 @@
  struct usbif_attach_arg *uaa = aux;
  usb_interface_descriptor_t *id;
  int cm, acm;
 +int ret = UMATCH_NONE;
   -  id = usbd_get_interface_descriptor(uaa-iface);
 -if (uaa-subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL 
 -(id-bInterfaceClass == UICLASS_CDC_DATA 
 - id-bInterfaceSubClass == UISUBCLASS_DATA))
 -return (UMATCH_IFACECLASS_IFACESUBCLASS);
 -
 -if (uaa-class != UICLASS_CDC ||
 -uaa-subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL ||
 -!(uaa-proto == UIPROTO_CDC_NOCLASS || uaa-proto ==
 -!UIPROTO_CDC_AT))
 -return (UMATCH_NONE);
 +if (umodem_lookup(uaa-vendor, uaa-product))
 +ret = UMATCH_VENDOR_PRODUCT;
   +  if (uaa-class == UICLASS_CDC 
 +uaa-subclass == UISUBCLASS_ABSTRACT_CONTROL_MODEL 
 +uaa-proto == UIPROTO_CDC_AT)
 +ret = UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO;
 
 Missing  uaa-proto == UIPROTO_CDC_NOCLASS, I think.
 
 That said, I think there's a bug somewhere else that's causing
 problems here.
 
 Can you boot with -xv flags and an updated -current kernel with
 USB_DEBUG
 and usbdebug set? I've add some more debug output to the kernel.

Hi,

Without umodem.c:1.66.

my USB Modem:
usb_event_thread: woke up
usb_discover
usb_schedsoftintr: polling=0
usb_needs_explore
usb_event_thread: woke up
usb_discover
usb_allocmem: use frag=0x800090519ac0 size=4
usb_freemem: frag=0x800090519ac0
usb_allocmem: use frag=0x800090519ac0 size=4
usb_freemem: frag=0x800090519ac0
usb_allocmem: use frag=0x800090519ac0 size=4
usb_schedsoftintr: polling=0
usb_freemem: frag=0x800090519ac0
usb_schedsoftintr: polling=0
uhub_disconnect: up=0xfe810feb6108 dev=0xfe821d89c410 port=1
usb_disconnect_port: disconnect subdevs
cdce0: detached
cdce0: at uhub1 port 1 (addr 3) disconnected
usb_schedsoftintr: polling=0
usb_allocmem: use frag=0x800090519ac0 size=4
usb_freemem: frag=0x800090519ac0
usb_schedsoftintr: polling=0
usb_needs_explore
usb_event_thread: woke up
usb_discover
usb_allocmem: use frag=0x800090519ac0 size=4
usb_freemem: frag=0x800090519ac0
usb_allocmem: use frag=0x800090519ac0 size=4
usb_freemem: frag=0x800090519ac0
usb_allocmem: use frag=0x800090519ac0 size=4
usb_schedsoftintr: polling=0
usb_freemem: frag=0x800090519ac0
usb_schedsoftintr: polling=0
usb_schedsoftintr: polling=0
usbd_reset_port: port 1 reset done, error=NORMAL_COMPLETION
usb_allocmem: use frag=0x800090519ac0 size=4
usb_schedsoftintr: polling=0
usb_freemem: frag=0x800090519ac0
usb_schedsoftintr: polling=0
usb_allocmem: use frag=0x800090519ac0 size=4
usb_schedsoftintr: polling=0
usb_freemem: frag=0x800090519ac0
usbd_new_device bus=0xfe810fa35048 port=1 depth=2 speed=3
usbd_new_device: high speed port 0
usbd_setup_pipe: dev=0xfe821d89c410 iface=0x0 ep=0xfe821d89c448 
pipe=0xfe821a9a5ab0
usb_allocmem: use frag=0x800090519ac0 size=8
usb_allocmem: use frag=0x800090519a80 size=64
usb_schedsoftintr: polling=0
usb_freemem: frag=0x800090519a80
usb_schedsoftintr: polling=0
usbd_reset_port: port 1 reset done, error=NORMAL_COMPLETION
usb_schedsoftintr: polling=0
usb_allocmem: use frag=0x800090519a80 size=4
usb_schedsoftintr: polling=0
usb_freemem: frag=0x800090519a80
usb_schedsoftintr: polling=0
usbd_new_device: adding unit addr=3, rev=210, class=0, subclass=0, protocol=0, 
maxpacket=64, len=18, speed=3
usbd_setup_pipe: dev=0xfe821d89c410 iface=0x0 ep=0xfe821d89c448 
pipe=0xfe821a9a5ab0
usb_allocmem: use frag=0x800090519a80 size=8
usbd_new_device: setting device address=3
usb_schedsoftintr: polling=0
usbd_setup_pipe: dev=0xfe821d89c410 iface=0x0 ep=0xfe821d89c448 
pipe=0xfe821a9a5ab0
usb_allocmem: use frag=0x800090519a40 size=8
usbd_get_device_desc:
usbd_get_desc: type=1, index=0, len=18
usb_allocmem: use frag=0x800090519a00 size=18
usb_schedsoftintr: polling=0
usb_freemem: frag=0x800090519a00

Re: USB networking (cdce) with Linux host (g_ether)

2015-04-07 Thread Christof Meerwald
On Sun, Apr 05, 2015 at 10:12:50AM +0100, Nick Hudson wrote:
 Can you boot with -xv flags and an updated -current kernel with USB_DEBUG
 and usbdebug set? I've add some more debug output to the kernel.

this is the output I get when plugging in the USB cable with the
-current kernel (leaving umodem.c unpatched):

usbd_new_device bus=0xbfc9205c port=3 depth=2 speed=3
usbd_new_device: adding unit addr=3, rev=200, class=2, subclass=0, protocol=0, 
maxpacket=64, len=18, speed=3
usbd_new_device: new dev (addr 3), dev=0xbff0ce10, parent=0xbfc6a208
usbd_probe_and_attach: trying device specific drivers
usbd_probe_and_attach: no device specific driver found
usbd_probe_and_attach: looping over 2 configurations
usbd_set_config_index: (addr 2) cno=3 attr=0xc0, selfpowered=1, power=500
usbd_set_config_index: set config 2
usbd_attachinterfaces: interface 0 0xbf37b428
usbd_attachinterfaces: interface 1 0xbf37b444
usbd_attachinterfaces: searching for interface 0 class 2 subclass 2 proto ff 
ifaceno 0
usbd_attachinterfaces: searching for interface 1 class a subclass 0 proto 0 
ifaceno 1
umodem0 at uhub2 port 3 configuration 2 interface 1
umodem0: Linux 4.0.0-rc4-bone0 with musb-hdrc RNDIS/Ethernet Gadget, rev 
2.00/4.00, addr 3, iclass 10/0
umodem0: no pointer to data interface
usbd_attachinterfaces: interface 1 claimed behind our back


Christof

-- 

http://cmeerw.org  sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org   xmpp:cmeerw at cmeerw.org


Re: USB networking (cdce) with Linux host (g_ether)

2015-04-05 Thread Ryo ONODERA
From: Nick Hudson sk...@netbsd.org, Date: Sun, 05 Apr 2015 10:12:50 +0100

 On 04/05/15 01:52, Ryo ONODERA wrote:
 Hi,

 I believe that following patch is good for us because my USB modem
 device
 is bad information and it should be treated as special case.

 Index: sys/dev/usb/umodem.c
 ===
 RCS file: /cvsroot/src/sys/dev/usb/umodem.c,v
 retrieving revision 1.66
 diff -u -r1.66 umodem.c
 --- sys/dev/usb/umodem.c 6 Apr 2014 02:01:43 -   1.66
 +++ sys/dev/usb/umodem.c 5 Apr 2015 00:49:30 -
 @@ -81,6 +81,11 @@
  NULL,
   };
   +Static const struct usb_devno umodem_devs[] = {
 +{ USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_MODEM_1},
 +};
 +#define umodem_lookup(v, p) usb_lookup(umodem_devs, v, p)
 +
   int umodem_match(device_t, cfdata_t, void *);
   voidumodem_attach(device_t, device_t, void *);
   int umodem_detach(device_t, int);
 @@ -97,22 +102,24 @@
  struct usbif_attach_arg *uaa = aux;
  usb_interface_descriptor_t *id;
  int cm, acm;
 +int ret = UMATCH_NONE;
   -  id = usbd_get_interface_descriptor(uaa-iface);
 -if (uaa-subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL 
 -(id-bInterfaceClass == UICLASS_CDC_DATA 
 - id-bInterfaceSubClass == UISUBCLASS_DATA))
 -return (UMATCH_IFACECLASS_IFACESUBCLASS);
 -
 -if (uaa-class != UICLASS_CDC ||
 -uaa-subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL ||
 -!(uaa-proto == UIPROTO_CDC_NOCLASS || uaa-proto ==
 -!UIPROTO_CDC_AT))
 -return (UMATCH_NONE);
 +if (umodem_lookup(uaa-vendor, uaa-product))
 +ret = UMATCH_VENDOR_PRODUCT;
   +  if (uaa-class == UICLASS_CDC 
 +uaa-subclass == UISUBCLASS_ABSTRACT_CONTROL_MODEL 
 +uaa-proto == UIPROTO_CDC_AT)
 +ret = UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO;
 
 Missing  uaa-proto == UIPROTO_CDC_NOCLASS, I think.

It is right.
UIPROTO_CDC_NOCLASS should be added.

 That said, I think there's a bug somewhere else that's causing
 problems here.
 
 Can you boot with -xv flags and an updated -current kernel with
 USB_DEBUG
 and usbdebug set? I've add some more debug output to the kernel.

I will post the output later.
(I am working on pkgsrc/misc/libreoffice4 now.)

 Thanks,
 Nick

Thank you.

--
Ryo ONODERA // ryo...@yk.rim.or.jp
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3


Re: USB networking (cdce) with Linux host (g_ether)

2015-04-05 Thread Nick Hudson

On 04/05/15 01:52, Ryo ONODERA wrote:

Hi,

I believe that following patch is good for us because my USB modem device
is bad information and it should be treated as special case.

Index: sys/dev/usb/umodem.c
===
RCS file: /cvsroot/src/sys/dev/usb/umodem.c,v
retrieving revision 1.66
diff -u -r1.66 umodem.c
--- sys/dev/usb/umodem.c6 Apr 2014 02:01:43 -   1.66
+++ sys/dev/usb/umodem.c5 Apr 2015 00:49:30 -
@@ -81,6 +81,11 @@
NULL,
  };
  
+Static const struct usb_devno umodem_devs[] = {

+   { USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_MODEM_1},
+};
+#define umodem_lookup(v, p) usb_lookup(umodem_devs, v, p)
+
  int umodem_match(device_t, cfdata_t, void *);
  voidumodem_attach(device_t, device_t, void *);
  int umodem_detach(device_t, int);
@@ -97,22 +102,24 @@
struct usbif_attach_arg *uaa = aux;
usb_interface_descriptor_t *id;
int cm, acm;
+   int ret = UMATCH_NONE;
  
-	id = usbd_get_interface_descriptor(uaa-iface);

-   if (uaa-subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL 
-   (id-bInterfaceClass == UICLASS_CDC_DATA 
-id-bInterfaceSubClass == UISUBCLASS_DATA))
-   return (UMATCH_IFACECLASS_IFACESUBCLASS);
-
-   if (uaa-class != UICLASS_CDC ||
-   uaa-subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL ||
-   !(uaa-proto == UIPROTO_CDC_NOCLASS || uaa-proto == 
UIPROTO_CDC_AT))
-   return (UMATCH_NONE);
+   if (umodem_lookup(uaa-vendor, uaa-product))
+   ret = UMATCH_VENDOR_PRODUCT;
  
+	if (uaa-class == UICLASS_CDC 

+   uaa-subclass == UISUBCLASS_ABSTRACT_CONTROL_MODEL 
+   uaa-proto == UIPROTO_CDC_AT)
+   ret = UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO;


Missing  uaa-proto == UIPROTO_CDC_NOCLASS, I think.

That said, I think there's a bug somewhere else that's causing problems 
here.


Can you boot with -xv flags and an updated -current kernel with USB_DEBUG
and usbdebug set? I've add some more debug output to the kernel.

Thanks,
Nick





Re: USB networking (cdce) with Linux host (g_ether)

2015-04-04 Thread Christof Meerwald
On Sat, Apr 04, 2015 at 08:50:01AM +0900, Ryo ONODERA wrote:
 Please remove cdce(4) and umodem(4) entries from your kernel configuration
 file (your device should be recognized as ugen(4)) and run
 $ gcc -o probe_usb probe_usb.c
 # ./probe_usb /dev/ugen0.00

# ./probe_usb /dev/ugen0.00
length: 9
descriptor type: 2
total length: 2147470578
num interface: 2
config value: 2
configuration: 0
Attributes: (0xc0) Self powered 
max power: 500 mA

Interface 0:
  Length: 9
  Descriptor Type: 4
  Interface No: 0
  Alt Setting: 0
  Num Endpoints: 1
  Interface Class: 2
  Interface SubClass: 2
  Interface Protocol: 255
  Interface: 4
  Endpoint 0:
Length: 7
Length: 5
Length: (0x82) 2 (in)
Attributes: (0x3) interrupt 
Max Packet Size: 2147470544
Interval: 9

Interface 1:
  Length: 9
  Descriptor Type: 4
  Interface No: 1
  Alt Setting: 0
  Num Endpoints: 2
  Interface Class: 10
  Interface SubClass: 0
  Interface Protocol: 0
  Interface: 5
  Endpoint 0:
Length: 7
Length: 5
Length: (0x81) 1 (in)
Attributes: (0x2) bulk 
Max Packet Size: 2147470544
Interval: 0
  Endpoint 1:
Length: 7
Length: 5
Length: (0x1) 1 (out)
Attributes: (0x2) bulk 
Max Packet Size: 2147470544
Interval: 0


Christof

-- 

http://cmeerw.org  sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org   xmpp:cmeerw at cmeerw.org


Re: USB networking (cdce) with Linux host (g_ether)

2015-04-04 Thread Christof Meerwald
On Sat, Apr 04, 2015 at 04:13:28PM +0100, Nick Hudson wrote:
 On 04/04/15 10:55, Christof Meerwald wrote:
if (uaa-class == UICLASS_CDC_DATA 
 uaa-subclass == UISUBCLASS_DATA)
return (UMATCH_IFACECLASS_IFACESUBCLASS);
 
 which clearly looks wrong to me.
 
 Yeah, I agree with this.
 
 What's the full dmesg when you have umodem.c:1.66 reverted?

NetBSD 7.0_BETA (ODROID-C1) #3: Fri Apr  3 15:47:14 BST 2015
cmeerw@droid:/usr/src/sys/arch/evbarm/compile/ODROID-C1
total memory = 1024 MB
avail memory = 1009 MB
sysctl_createv: sysctl_create(machine_arch) returned 17
kern.module.path=/stand/evbarm/7.0/modules
timecounter: Timecounters tick every 10.000 msec
mainbus0 (root)
cpu0 at mainbus0 core 0: 1 GHz Cortex-A5 r0p1 (Cortex V7A core)
cpu0: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu0: isar: [0]=0x10 [1]=0x13112111 [2]=0x21232041 [3]=0x2131, 
[4]=0x11142, [5]=0
cpu0: mmfr: [0]=0x100103 [1]=0x4000 [2]=0x123 [3]=0x102211
cpu0: pfr: [0]=0x1231 [1]=0x11
cpu0: 32KB/32B 2-way L1 VIPT Instruction cache
cpu0: 32KB/32B 4-way write-back-locking-C L1 PIPT Data cache
cpu0: 512KB/32B 8-way **unknown 12** L2 PIPT Unified cache
vfp0 at cpu0: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
vfp0: mvfr: [0]=0x10110222 [1]=0x
cpu1 at mainbus0 core 1
cpu2 at mainbus0 core 2
cpu3 at mainbus0 core 3
armperiph0 at mainbus0
armgic0 at armperiph0: Generic Interrupt Controller, 256 sources (245 valid)
armgic0: 32 Priorities, 224 SPIs, 5 PPIs, 16 SGIs
a9tmr0 at armperiph0: A5 Global 64-bit Timer (378 MHz)
a9tmr0: interrupting on irq 27
a9wdt0 at armperiph0: A5 Watchdog Timer, default period is 12 seconds
arml2cc0 at armperiph0: ARM PL310 r3p3 L2 Cache Controller (disabled)
arml2cc0: cache enabled
amlogicio0 at mainbus0
amlogiccom0 at amlogicio0 port 0: console
amlogiccom0: interrupting at irq 122
genfb0 at amlogicio0: switching to framebuffer console
genfb0: framebuffer at 0xc920, size 1920x1080, depth 24, stride 5760
wsdisplay0 at genfb0 kbdmux 1: console (default, vt100 emulation)
wsmux1: connecting to wsdisplay0
wsdisplay0: screen 1-3 added (default, vt100 emulation)
amlogicrng0 at amlogicio0
dwctwo0 at amlogicio0 port 0: USB controller
dwctwo1 at amlogicio0 port 1: USB controller
awge0 at amlogicio0: Gigabit Ethernet Controller
awge0: interrupting on irq 40
awge0: Ethernet address: 00:1e:06:c3:43:12
rgephy0 at awge0 phy 0: RTL8169S/8110S/8211 1000BASE-T media interface, rev. 6
rgephy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, auto
rgephy1 at awge0 phy 1: RTL8169S/8110S/8211 1000BASE-T media interface, rev. 6
rgephy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT-FDX, auto
amlogicsdhc0 at amlogicio0 port 1: SDHC controller
amlogicsdhc0: interrupting on irq 110
amlogicrtc0 at amlogicio0: RTC battery not present or discharged
usb0 at dwctwo0: USB revision 2.0
usb1 at dwctwo1: USB revision 2.0
timecounter: Timecounter clockinterrupt frequency 100 Hz quality 0
timecounter: Timecounter a9tmr0 frequency 37800 Hz quality 500
cpu3: 1 GHz Cortex-A5 r0p1 (Cortex V7A core)
cpu3: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu3: isar: [0]=0x10 [1]=0x13112111 [2]=0x21232041 [3]=0x2131, 
[4]=0x11142, [5]=0
cpu3: mmfr: [0]=0x100103 [1]=0x4000 [2]=0x123 [3]=0x102211
cpu3: pfr: [0]=0x1231 [1]=0x11
cpu3: 32KB/32B 2-way L1 VIPT Instruction cache
cpu3: 32KB/32B 4-way write-back-locking-C L1 PIPT Data cache
cpu3: 512KB/32B 8-way **unknown 12** L2 PIPT Unified cache
vfp3 at cpu3: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
vfp3: mvfr: [0]=0x10110222 [1]=0x
cpu2: 1 GHz Cortex-A5 r0p1 (Cortex V7A core)
cpu2: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu2: isar: [0]=0x10 [1]=0x13112111 [2]=0x21232041 [3]=0x2131, 
[4]=0x11142, [5]=0
cpu2: mmfr: [0]=0x100103 [1]=0x4000 [2]=0x123 [3]=0x102211
cpu2: pfr: [0]=0x1231 [1]=0x11
cpu2: 32KB/32B 2-way L1 VIPT Instruction cache
cpu2: 32KB/32B 4-way write-back-locking-C L1 PIPT Data cache
cpu2: 512KB/32B 8-way **unknown 12** L2 PIPT Unified cache
vfp2 at cpu2: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
vfp2: mvfr: [0]=0x10110222 [1]=0x
cpu1: 1 GHz Cortex-A5 r0p1 (Cortex V7A core)
cpu1: DC enabled IC enabled WB disabled EABT branch prediction enabled
cpu1: isar: [0]=0x10 [1]=0x13112111 [2]=0x21232041 [3]=0x2131, 
[4]=0x11142, [5]=0
cpu1: mmfr: [0]=0x100103 [1]=0x4000 [2]=0x123 [3]=0x102211
cpu1: pfr: [0]=0x1231 [1]=0x11
cpu1: 32KB/32B 2-way L1 VIPT Instruction cache
cpu1: 32KB/32B 4-way write-back-locking-C L1 PIPT Data cache
cpu1: 512KB/32B 8-way **unknown 12** L2 PIPT Unified cache
vfp1 at cpu1: NEON MPE (VFP 3.0+), rounding, NaN propagation, denormals
vfp1: mvfr: [0]=0x10110222 [1]=0x
sdmmc0 at amlogicsdhc0
uhub0 at usb0: vendor 0x DWC2 root hub, class 9/0, rev 2.00/1.00, addr 1
uhub0: 1 port with 1 removable, self powered
uhub1 at usb1: vendor 

Re: USB networking (cdce) with Linux host (g_ether)

2015-04-04 Thread Ryo ONODERA
Hi,

I believe that following patch is good for us because my USB modem device
is bad information and it should be treated as special case.

Index: sys/dev/usb/umodem.c
===
RCS file: /cvsroot/src/sys/dev/usb/umodem.c,v
retrieving revision 1.66
diff -u -r1.66 umodem.c
--- sys/dev/usb/umodem.c6 Apr 2014 02:01:43 -   1.66
+++ sys/dev/usb/umodem.c5 Apr 2015 00:49:30 -
@@ -81,6 +81,11 @@
NULL,
 };
 
+Static const struct usb_devno umodem_devs[] = {
+   { USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_MODEM_1},
+};
+#define umodem_lookup(v, p) usb_lookup(umodem_devs, v, p)
+
 int umodem_match(device_t, cfdata_t, void *);
 voidumodem_attach(device_t, device_t, void *);
 int umodem_detach(device_t, int);
@@ -97,22 +102,24 @@
struct usbif_attach_arg *uaa = aux;
usb_interface_descriptor_t *id;
int cm, acm;
+   int ret = UMATCH_NONE;
 
-   id = usbd_get_interface_descriptor(uaa-iface);
-   if (uaa-subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL 
-   (id-bInterfaceClass == UICLASS_CDC_DATA 
-id-bInterfaceSubClass == UISUBCLASS_DATA))
-   return (UMATCH_IFACECLASS_IFACESUBCLASS);
-
-   if (uaa-class != UICLASS_CDC ||
-   uaa-subclass != UISUBCLASS_ABSTRACT_CONTROL_MODEL ||
-   !(uaa-proto == UIPROTO_CDC_NOCLASS || uaa-proto == 
UIPROTO_CDC_AT))
-   return (UMATCH_NONE);
+   if (umodem_lookup(uaa-vendor, uaa-product))
+   ret = UMATCH_VENDOR_PRODUCT;
 
+   if (uaa-class == UICLASS_CDC 
+   uaa-subclass == UISUBCLASS_ABSTRACT_CONTROL_MODEL 
+   uaa-proto == UIPROTO_CDC_AT)
+   ret = UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO;
+
+   if (ret == UMATCH_NONE)
+   return UMATCH_NONE;
+
+   id = usbd_get_interface_descriptor(uaa-iface);
if (umodem_get_caps(uaa-device, cm, acm, id) == -1)
return (UMATCH_NONE);
 
-   return (UMATCH_IFACECLASS_IFACESUBCLASS_IFACEPROTO);
+   return (ret);
 }
 
 void 
Index: sys/dev/usb/usbdevs
===
RCS file: /cvsroot/src/sys/dev/usb/usbdevs,v
retrieving revision 1.693
diff -u -r1.693 usbdevs
--- sys/dev/usb/usbdevs 17 Mar 2015 08:14:30 -  1.693
+++ sys/dev/usb/usbdevs 5 Apr 2015 00:49:31 -
@@ -3345,6 +3345,7 @@
 /* Conexant */
 product CONEXANT PRISM_GT_10x2000  PrismGT USB 2.0 WLAN
 product CONEXANT PRISM_GT_20x2002  PrismGT USB 2.0 WLAN
+product CONEXANT MODEM_1   0x1329  USB Modem
 
 /* Yamaha products */
 product YAMAHA UX256   0x1000  UX256 MIDI I/F
Index: sys/dev/usb/usbdevs.h
===
RCS file: /cvsroot/src/sys/dev/usb/usbdevs.h,v
retrieving revision 1.685
diff -u -r1.685 usbdevs.h
--- sys/dev/usb/usbdevs.h   17 Mar 2015 08:15:48 -  1.685
+++ sys/dev/usb/usbdevs.h   5 Apr 2015 00:49:31 -
@@ -1,10 +1,10 @@
-/* $NetBSD: usbdevs.h,v 1.685 2015/03/17 08:15:48 macallan Exp $   */
+/* $NetBSD$*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- * NetBSD: usbdevs,v 1.692 2015/03/15 01:37:47 nonaka Exp
+ * NetBSD: usbdevs,v 1.693 2015/03/17 08:14:30 macallan Exp
  */
 
 /*
@@ -3352,6 +3352,7 @@
 /* Conexant */
 #defineUSB_PRODUCT_CONEXANT_PRISM_GT_1 0x2000  /* PrismGT USB 
2.0 WLAN */
 #defineUSB_PRODUCT_CONEXANT_PRISM_GT_2 0x2002  /* PrismGT USB 
2.0 WLAN */
+#defineUSB_PRODUCT_CONEXANT_MODEM_10x1329  /* USB Modem */
 
 /* Yamaha products */
 #defineUSB_PRODUCT_YAMAHA_UX2560x1000  /* UX256 MIDI 
I/F */
Index: sys/dev/usb/usbdevs_data.h
===
RCS file: /cvsroot/src/sys/dev/usb/usbdevs_data.h,v
retrieving revision 1.686
diff -u -r1.686 usbdevs_data.h
--- sys/dev/usb/usbdevs_data.h  17 Mar 2015 08:15:48 -  1.686
+++ sys/dev/usb/usbdevs_data.h  5 Apr 2015 00:49:31 -
@@ -1,10 +1,10 @@
-/* $NetBSD: usbdevs_data.h,v 1.686 2015/03/17 08:15:48 macallan Exp $  
*/
+/* $NetBSD$*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- * NetBSD: usbdevs,v 1.692 2015/03/15 01:37:47 nonaka Exp
+ * NetBSD: usbdevs,v 1.693 2015/03/17 08:14:30 macallan Exp
  */
 
 /*
@@ -4510,6 +4510,8 @@
5167, 4710, 5175, 5140, 0,
USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_PRISM_GT_2, 
5167, 4710, 5175, 5140, 0,
+   USB_VENDOR_CONEXANT, USB_PRODUCT_CONEXANT_MODEM_1, 
+   4710, 4845, 0,
USB_VENDOR_YAMAHA, USB_PRODUCT_YAMAHA_UX256, 
18766, 15980, 15971, 0,
USB_VENDOR_YAMAHA, USB_PRODUCT_YAMAHA_MU1000, 
@@ -5280,7 +5282,7 @@
GNU\0 /* 1 refs @ 4689 */
USRP\0 /* 2 

Re: USB networking (cdce) with Linux host (g_ether)

2015-04-03 Thread Christof Meerwald
On Fri, Apr 03, 2015 at 12:08:00PM +0200, Christof Meerwald wrote:
 I then recompiled the NetBSD kernel with the umodem driver disabled
 and it suddenly started working:
 
 cdce0 at uhub2 port 3 configuration 1 interface 0
 cdce0: Linux 4.0.0-rc4-bone0 with musb-hdrc RNDIS/Ethernet Gadget, rev 
 2.00/4.00, addr 3
 cdce0: address 16:15:aa:ef:a8:71

I have now enabled the umodem driver again, but reverted
/src/sys/dev/usb/umodem.c to revision 1.65 and it's still working for
me. So looks like the changes done in r1.66 result in the umodem
driver kicking in (and interfering with the cdce driver) when it
shouldn't. Does that make some sense to anyone?

http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/usb/umodem.c.diff?r1=1.65r2=1.66only_with_tag=MAINf=h


Christof

-- 

http://cmeerw.org  sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org   xmpp:cmeerw at cmeerw.org


Re: USB networking (cdce) with Linux host (g_ether)

2015-04-03 Thread Martin Husemann
On Sat, Apr 04, 2015 at 08:50:01AM +0900, Ryo ONODERA wrote:
 blymn@ provides me the program to print interface detail.
 See http://mail-index.netbsd.org/current-users/2014/01/21/msg024127.html
 or attached probe_usb.c .

Yes, that is what I was thinking of - we should make it work with any usb
driver and integrate it into usbdevs(8).

Can you show the output on your device as well?

Martin


Re: USB networking (cdce) with Linux host (g_ether)

2015-04-03 Thread Ryo ONODERA
Hi,

From: Martin Husemann mar...@duskware.de, Date: Fri, 3 Apr 2015 19:44:09 +0200

 On Fri, Apr 03, 2015 at 05:02:15PM +0200, Christof Meerwald wrote:
 I have now enabled the umodem driver again, but reverted
 /src/sys/dev/usb/umodem.c to revision 1.65 and it's still working for
 me. So looks like the changes done in r1.66 result in the umodem
 driver kicking in (and interfering with the cdce driver) when it
 shouldn't. Does that make some sense to anyone?
 
 http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/usb/umodem.c.diff?r1=1.65r2=1.66only_with_tag=MAINf=h
 
 Good catch - I guess we will need to make the additional match that
 Onodera-san was after more specific.
 
 And we also need to add code to print interface details to usbdevs(8).

Hi,

blymn@ provides me the program to print interface detail.
See http://mail-index.netbsd.org/current-users/2014/01/21/msg024127.html
or attached probe_usb.c .

Please remove cdce(4) and umodem(4) entries from your kernel configuration
file (your device should be recognized as ugen(4)) and run
$ gcc -o probe_usb probe_usb.c
# ./probe_usb /dev/ugen0.00

Thank you.

--
Ryo ONODERA // ryo...@yk.rim.or.jp
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
#include stdio.h
#include stdlib.h
#include fcntl.h
#include errno.h
#include sys/ioctl.h
#include dev/usb/usb.h

main(int argc, char **argv)
{
struct usb_config_desc desc;
int fd, i, j;
struct usb_interface_desc int_desc;
struct usb_endpoint_desc end_desc;

fd = open(argv[1], O_RDONLY, 0);

if (fd  0) {
printf(open failed %d\n, errno);
exit(0);
}

desc.ucd_config_index = USB_CURRENT_CONFIG_INDEX;

if (ioctl(fd, USB_GET_CONFIG_DESC, desc)  0) {
printf(ioctl failed, %d\n, errno);
exit(0);
}

printf(length: %d\n, desc.ucd_desc.bLength);
printf(descriptor type: %d\n, desc.ucd_desc.bDescriptorType);
printf(total length: %d\n, desc.ucd_desc.wTotalLength);
printf(num interface: %d\n, desc.ucd_desc.bNumInterface);
printf(config value: %d\n, desc.ucd_desc.bConfigurationValue);
printf(configuration: %d\n, desc.ucd_desc.iConfiguration);
printf(Attributes: (0x%x) , desc.ucd_desc.bmAttributes);
/*if ((desc.ucd_desc.bmAttributes  UC_BUS_POWERED) == UC_BUS_POWERED)
printf(Bus powered );*/
if ((desc.ucd_desc.bmAttributes  UC_SELF_POWERED) == UC_SELF_POWERED)
printf(Self powered );
if ((desc.ucd_desc.bmAttributes  UC_REMOTE_WAKEUP)
== UC_REMOTE_WAKEUP)
printf(Remote Wakeup );
printf(\n);
printf(max power: %d mA\n,
   desc.ucd_desc.bMaxPower * UC_POWER_FACTOR);

int_desc.uid_config_index = USB_CURRENT_CONFIG_INDEX;
int_desc.uid_alt_index = USB_CURRENT_ALT_INDEX;
end_desc.ued_config_index = USB_CURRENT_CONFIG_INDEX;
end_desc.ued_alt_index = USB_CURRENT_ALT_INDEX;
for (i = 0; i = desc.ucd_desc.bNumInterface - 1; i++) {
printf(\nInterface %d:\n, i);
int_desc.uid_interface_index = i;
if (ioctl(fd, USB_GET_INTERFACE_DESC, int_desc)  0) {
printf(ioctl failed, %d\n, errno);
exit(0);
}
printf(  Length: %d\n, int_desc.uid_desc.bLength);
printf(  Descriptor Type: %d\n, 
int_desc.uid_desc.bDescriptorType);
printf(  Interface No: %d\n, 
int_desc.uid_desc.bInterfaceNumber);
printf(  Alt Setting: %d\n, 
int_desc.uid_desc.bAlternateSetting);
printf(  Num Endpoints: %d\n, 
int_desc.uid_desc.bNumEndpoints);
printf(  Interface Class: %d\n, 
int_desc.uid_desc.bInterfaceClass);
printf(  Interface SubClass: %d\n, 
int_desc.uid_desc.bInterfaceSubClass);
printf(  Interface Protocol: %d\n, 
int_desc.uid_desc.bInterfaceProtocol);
printf(  Interface: %d\n, int_desc.uid_desc.iInterface);

end_desc.ued_interface_index = i;
for (j = 0; j  int_desc.uid_desc.bNumEndpoints; j++) {
printf(  Endpoint %d:\n, j);
end_desc.ued_endpoint_index = j;
if (ioctl(fd, USB_GET_ENDPOINT_DESC, end_desc)  0) {
printf(ioctl failed, %d\n, errno);
exit(0);
}
printf(Length: %d\n, end_desc.ued_desc.bLength);
printf(Length: %d\n,
   end_desc.ued_desc.bDescriptorType);
printf(Length: (0x%x) %d ,
   end_desc.ued_desc.bEndpointAddress,
   UE_GET_ADDR(end_desc.ued_desc.bEndpointAddress));
if 

Re: USB networking (cdce) with Linux host (g_ether)

2015-04-03 Thread Martin Husemann
On Fri, Apr 03, 2015 at 12:08:00PM +0200, Christof Meerwald wrote:
 But surely there must be a better way to get it working...

What devices/interfaces does it present?
You should be able to query with usbdevs(8).

Martin