Re: attaching ugen(4) on multi interface USB devices

2004-10-07 Thread Niki Denev
Bernd Walter writes:
On Wed, Oct 06, 2004 at 03:30:05PM +0300, Niki Denev wrote:
Hello everyone!, 

The last 1-2 days i've been trying to make some userspace OBEX utilities to 
work with a USB based Nokia GSM phone and doing this i discovered something 
that confuses me a little:
The phone in question is Nokia 6230 and it has an USB interface.
The phone has 11 interface descriptors,
2 of them are used for the Modem and CM over data.
Judging from the windows drivers it seems that four of the other interfaces
are OBEX compatible.
But if i kldload umodem and plug the phone it detects only one ucom(4).
and if i plug the phone without any u* modules loaded the kernel attaches
ugen0 only.
From what i understand it attaches the ugen0 using the info in the first 
interface descriptor in the device.
Wouldn't it be more usefull for the kernel to attach ugen for every unknown 
interface in a device.
For example when attaching the phone with umodem loaded, i will get
the ucom(4) device and the other unrecognised interfaces will show up as 
ugens ?
What do you think about that?
ugen attaches to the whole device and supporting all interfaces in one
driver instance.
thanks, i saw this in the ugen(4) manpage. it seems that i haven't noticed 
it before :(

If you already an interface driver atatched then ugen fails to attach
the whole device.
well, i think that this can be a problem sometimes.
actually i don't need kernel driver for obex devices, because everyting can 
and will be probably better done in the userland via ugen. 
but this means that the phone modem and obex interfaces can't be used 
together.
why not having a ugen(4) for every USB device? even it is supported?
it probably won't harm anyone, but will make possible accessing parts of 
the device that are otherwise hidden.

11 interface descriptors sounds unlikely to be correct - it's more
likely that some of them are alternative configurations and a device
or interface can only be in a single configuration at a given time.
You can switch between alternative configurations via ugen.
It seems that this is the way that the CDC WMC (wireless mobile 
communication) devices are made.
At least that is what i understand when reading some of the specifications 
published at usb.org

I don't know about OBEX, but why don't you just create an interface
class driver that attaches to OBEX interfaces - writing USB drivers is
not very difficult if you know USB and a few kernel basics.
I've done some testing in this area and i've made a driver based on 
ucom/umodem that attaches to OBEX devices. (only attaches at the moment).
And here i discovered that usbdevs can't show more than 4 interfaces on USB 
device. I tracked down this to USB_MAX_DEVNAMES=4.
Is there a reason for this to be set this low?

P.S.: anyone know some good way to list the attached usb devices beyond 
usbdevs?
It seems that the information that can be gathered from usbdevs is very 
limited. For example 'lsusb' in linux can show much more info. What do you 
think about that too?
I like usbctl from NetBSDs usbutils.
An older port draft is available under:
http://www.cosmo-project.de/~bernd/usbutil.tgz
It will also show you the interface configurations with all
alternatives.
usbctl and friends are nice! :) 
i would love to see them in freebsd by default :)

P.S.:yesterday i have managed to panic my 6.0-current kernel 
with usbctl, but i'm not sure if this is related to changes that i have 
done.
i will cvsup to clean any problems in my source/rebuild and then report if 
there are problems.

--
B.Walter   BWCThttp://www.bwct.de
[EMAIL PROTECTED]  [EMAIL PROTECTED]

thanks!
--niki


pgpxGEIXLkMwb.pgp
Description: PGP signature


Re: attaching ugen(4) on multi interface USB devices

2004-10-07 Thread Bernd Walter
On Thu, Oct 07, 2004 at 04:22:12PM +0300, Niki Denev wrote:
 Bernd Walter writes:
 On Wed, Oct 06, 2004 at 03:30:05PM +0300, Niki Denev wrote:
 If you already an interface driver atatched then ugen fails to attach
 the whole device.
 
 well, i think that this can be a problem sometimes.

Yes - this is very often a problem :(

 actually i don't need kernel driver for obex devices, because everyting can 
 and will be probably better done in the userland via ugen. 
 but this means that the phone modem and obex interfaces can't be used 
 together.

Exactly that's the reason why you want a obex kernel driver.
That doesn't mean it has to provide more functionality then ugen and
you can still do the processing in userland.

 why not having a ugen(4) for every USB device? even it is supported?
 it probably won't harm anyone, but will make possible accessing parts of 
 the device that are otherwise hidden.

It can harm.
Say you have other drivers attached and ugen switches the configuration
of the device/interface that the other driver(s) uses.
Many safety checks need to added to ugen for this.

Copy the ugen driver to uobex, swtich it to be an interface level driver
and strip the functionality down to what you really need.

 11 interface descriptors sounds unlikely to be correct - it's more
 likely that some of them are alternative configurations and a device
 or interface can only be in a single configuration at a given time.
 You can switch between alternative configurations via ugen.
 
 
 It seems that this is the way that the CDC WMC (wireless mobile 
 communication) devices are made.
 At least that is what i understand when reading some of the specifications 
 published at usb.org

Well - as I already wrote - I know almost nothing about this type of
devices, but it still sound unlikely to be correct to what I know about
USB - that doesn't mean it can't be correct.

 I don't know about OBEX, but why don't you just create an interface
 class driver that attaches to OBEX interfaces - writing USB drivers is
 not very difficult if you know USB and a few kernel basics.
 
 
 I've done some testing in this area and i've made a driver based on 
 ucom/umodem that attaches to OBEX devices. (only attaches at the moment).
 And here i discovered that usbdevs can't show more than 4 interfaces on USB 
 device. I tracked down this to USB_MAX_DEVNAMES=4.
 Is there a reason for this to be set this low?

As I already wrote - 11 interfaces is very unusual and therfor you
usually don't have that many drivers attached as well.
Raise the limit if you need - or better make it a kernel tunable and
document that your OBEX driver needs at least 11.

-- 
B.Walter   BWCThttp://www.bwct.de
[EMAIL PROTECTED]  [EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


attaching ugen(4) on multi interface USB devices

2004-10-06 Thread Niki Denev
Hello everyone!, 

The last 1-2 days i've been trying to make some userspace OBEX utilities to 
work with a USB based Nokia GSM phone and doing this i discovered something 
that confuses me a little:
The phone in question is Nokia 6230 and it has an USB interface.
The phone has 11 interface descriptors,
2 of them are used for the Modem and CM over data.
Judging from the windows drivers it seems that four of the other interfaces
are OBEX compatible.
But if i kldload umodem and plug the phone it detects only one ucom(4).
and if i plug the phone without any u* modules loaded the kernel attaches
ugen0 only.
From what i understand it attaches the ugen0 using the info in the first 
interface descriptor in the device.
Wouldn't it be more usefull for the kernel to attach ugen for every unknown 
interface in a device.
For example when attaching the phone with umodem loaded, i will get
the ucom(4) device and the other unrecognised interfaces will show up as 
ugens ?
What do you think about that?

P.S.: anyone know some good way to list the attached usb devices beyond 
usbdevs?
It seems that the information that can be gathered from usbdevs is very 
limited. For example 'lsusb' in linux can show much more info. What do you 
think about that too?

Thanks in advance for any info and/or flames :)
--niki


pgpVnYXvweLLA.pgp
Description: PGP signature


Re: attaching ugen(4) on multi interface USB devices

2004-10-06 Thread Bernd Walter
On Wed, Oct 06, 2004 at 03:30:05PM +0300, Niki Denev wrote:
 
 Hello everyone!, 
 
 The last 1-2 days i've been trying to make some userspace OBEX utilities to 
 work with a USB based Nokia GSM phone and doing this i discovered something 
 that confuses me a little:
 The phone in question is Nokia 6230 and it has an USB interface.
 The phone has 11 interface descriptors,
 2 of them are used for the Modem and CM over data.
 Judging from the windows drivers it seems that four of the other interfaces
 are OBEX compatible.
 But if i kldload umodem and plug the phone it detects only one ucom(4).
 and if i plug the phone without any u* modules loaded the kernel attaches
 ugen0 only.
 From what i understand it attaches the ugen0 using the info in the first 
 interface descriptor in the device.
 Wouldn't it be more usefull for the kernel to attach ugen for every unknown 
 interface in a device.
 For example when attaching the phone with umodem loaded, i will get
 the ucom(4) device and the other unrecognised interfaces will show up as 
 ugens ?
 What do you think about that?

ugen attaches to the whole device and supporting all interfaces in one
driver instance.
If you already an interface driver atatched then ugen fails to attach
the whole device.
11 interface descriptors sounds unlikely to be correct - it's more
likely that some of them are alternative configurations and a device
or interface can only be in a single configuration at a given time.
You can switch between alternative configurations via ugen.

I don't know about OBEX, but why don't you just create an interface
class driver that attaches to OBEX interfaces - writing USB drivers is
not very difficult if you know USB and a few kernel basics.

 P.S.: anyone know some good way to list the attached usb devices beyond 
 usbdevs?
 It seems that the information that can be gathered from usbdevs is very 
 limited. For example 'lsusb' in linux can show much more info. What do you 
 think about that too?

I like usbctl from NetBSDs usbutils.
An older port draft is available under:
http://www.cosmo-project.de/~bernd/usbutil.tgz
It will also show you the interface configurations with all
alternatives.

-- 
B.Walter   BWCThttp://www.bwct.de
[EMAIL PROTECTED]  [EMAIL PROTECTED]

___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: attaching ugen(4) on multi interface USB devices

2004-10-06 Thread Mathew Kanner
On Oct 06, Niki Denev wrote:
 The last 1-2 days i've been trying to make some userspace OBEX utilities to 
 work with a USB based Nokia GSM phone and doing this i discovered something 
 that confuses me a little:
 The phone in question is Nokia 6230 and it has an USB interface.
 The phone has 11 interface descriptors,
 2 of them are used for the Modem and CM over data.
 Judging from the windows drivers it seems that four of the other interfaces
 are OBEX compatible.
 But if i kldload umodem and plug the phone it detects only one ucom(4).
 and if i plug the phone without any u* modules loaded the kernel attaches
 ugen0 only.
 From what i understand it attaches the ugen0 using the info in the first 
 interface descriptor in the device.
 Wouldn't it be more usefull for the kernel to attach ugen for every unknown 
 interface in a device.
 For example when attaching the phone with umodem loaded, i will get
 the ucom(4) device and the other unrecognised interfaces will show up as 
 ugens ?
 What do you think about that?
 
 
 P.S.: anyone know some good way to list the attached usb devices beyond 
 usbdevs?
 It seems that the information that can be gathered from usbdevs is very 
 limited. For example 'lsusb' in linux can show much more info. What do you 
 think about that too?
 
 
 Thanks in advance for any info and/or flames :)

I seem to recall a problem with ugen that it doesn't discover
endpoints on alt-interfaces.  I've posted patches to this mailing list
to work around the problem. 

--Mat

-- 
Canada is a country whose main exports are hockey players
and cold fronts. Our main imports are baseball players and
acid rain.
- Pierre Elliott Trudeau
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: attaching ugen(4) on multi interface USB devices

2004-10-06 Thread Brian Fundakowski Feldman
On Wed, Oct 06, 2004 at 09:48:49AM -0400, Mathew Kanner wrote:
 On Oct 06, Niki Denev wrote:
  The last 1-2 days i've been trying to make some userspace OBEX utilities to 
  work with a USB based Nokia GSM phone and doing this i discovered something 
  that confuses me a little:
  The phone in question is Nokia 6230 and it has an USB interface.
  The phone has 11 interface descriptors,
  2 of them are used for the Modem and CM over data.
  Judging from the windows drivers it seems that four of the other interfaces
  are OBEX compatible.
  But if i kldload umodem and plug the phone it detects only one ucom(4).
  and if i plug the phone without any u* modules loaded the kernel attaches
  ugen0 only.
  From what i understand it attaches the ugen0 using the info in the first 
  interface descriptor in the device.
  Wouldn't it be more usefull for the kernel to attach ugen for every unknown 
  interface in a device.
  For example when attaching the phone with umodem loaded, i will get
  the ucom(4) device and the other unrecognised interfaces will show up as 
  ugens ?
  What do you think about that?
  
  
  P.S.: anyone know some good way to list the attached usb devices beyond 
  usbdevs?
  It seems that the information that can be gathered from usbdevs is very 
  limited. For example 'lsusb' in linux can show much more info. What do you 
  think about that too?
  
  
  Thanks in advance for any info and/or flames :)
 
   I seem to recall a problem with ugen that it doesn't discover
 endpoints on alt-interfaces.  I've posted patches to this mailing list
 to work around the problem.   

It doesn't work when you call USB_SET_ALTINTERFACE then USB_SET_CONFIG?

-- 
Brian Fundakowski Feldman   \'[ FreeBSD ]''\
   [EMAIL PROTECTED]   \  The Power to Serve! \
 Opinions expressed are my own.   \,,\
___
[EMAIL PROTECTED] mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to [EMAIL PROTECTED]