On Sat, 10 Dec 2005, gary clark wrote:

> Hi Alan,
> 
> Thanks for questions and quick reponse and 
> I will attempt to be more clearer. This problem caused
> me alot of confusion. Using the device specified in
> the USB file system I attempted to perform the
> following:
> 
> code=USBDEVFS_CONNECT;
> 
> p->ioctl_code=code;
> fd=open(tmpPtr->path,O_RDWR | O_NONBLOCK)
> {
>    perror("open");
>    close(fd);
> }
> 
> p->ifno=tmpPtr->revisionId;
> 
> if (ioctl(fd,USBDEBVFS_IOCTL,p)==-1)
> {
>    perror("connect failed")
> }
> else
> {
>    printf("Succeeded");   
> }
> close(fd);
> 
> 
> Ok the above rough code outline simply performs a
> CONNECT
> on a usb device using its path in the file system.
> When I disconnect replacing code USBDEVFS_DISCONNECT
> it removes the devices as you would expect. The
> problem I saw was that if you have multiple USB
> storage devices connected to my PC and you use the
> path of that device in the file system and perform a
> USBDEVFS_DISCONNECT on a selected device it would
> inturn remove that device from the file system which
> is what you expect. However if I then perform a
> USBDEVFS_CONNECT on a different usb device, the
> disconnected devices becomes reconnected and I can see
> this in the /dev/. Not what I wanted. Hence I maintain
> locally a list of all usb devices in my code. I cycle
> through those devices I want to be connected first and
> then those devices I want to be disconnected. It
> appears to work.

Okay, now I understand.

> Does this make sence now? It may not be a bug, but it
> threw me because I didnt think it worked like that. It
> maybe that this is the way its suppose to be handled?
> I dont know.

I don't know either.  It does behave the way you described: the
USBDEVFS_CONNECT ioctl causes _all_ unbound USB interfaces to be probed
for drivers.  Perhaps that's what was originally intended, perhaps not.  
It doesn't really make sense; you would expect it to affect only the
interface specified in the ioctl.

The kernel could be changed.  The problem is that some programs may depend 
on the current behavior, so changing it might not be a good thing.

Maybe someone on the mailing list knows whether this deserves to be fixed.

> Terminology. Please excuse me I didnt know anything
> about USB device handling until 5 weeks ago so please
> excuse my ignorance. Is a usb device logically
> considered to be an endpoint? Thats a question.

No, a device is different from an endpoint.  You already know what a
device is.  An endpoint is sort of the USB equivalent of a TCP/IP port;  
it's a number that stands for a communications source or destination
within a device.  Each USB device can have up to 32 endpoints (16 for IN
transfers and 16 for OUT transfers).

Alan Stern



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to