Camera showing up twice in port list when multiple cameras attached

View: New views
5 Messages — Rating Filter:   Alert me  

Camera showing up twice in port list when multiple cameras attached

by Jim Nelson-4 :: Rate this Message:

| View Threaded | Show Only this Message

Hello,

My application monitors for cameras being attached and detached.  When I attach two cameras to my Ubuntu system, the same camera shows up twice in the auto-detected listing:

$ gphoto2 --auto-detect
Model                          Port                                           
----------------------------------------------------------
Canon PowerShot A720 IS (PTP mode) usb:           
USB PTP Class Camera           usb:008,035    
Canon PowerShot A720 IS (PTP mode) usb:008,034    

Although I can use the model to detect duplicates, this seems imprecise (for example, the unlikely-but-not-impossible case where the user has two cameras of the same model).

Additionally, if the user disconnects one of these cameras, the long-form of the USB port is lost:

$ gphoto2 --auto-detect
Model                          Port                                           
----------------------------------------------------------
USB PTP Class Camera           usb:           

Thus, the camera which remains attached appears to have a different port.  I'm assuming the camera object will continue to operate without setting a new GPPortInfo, but it means I have only the model ID to use for tracking, which as I said, is imprecise.

Two questions: One, is this the expected behavior?  Why have a usb: port mirror the usb:xxx,yyy?  (I'm a bit new to this.)

Two, is there a unique way of identifying each camera on the system?  I'm thinking of a HAL UID, but I don't know how to convert "usb:" or "usb:008,034" to a UID.

Thanks,

-- Jim Nelson
Yorba

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@...
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

Re: Camera showing up twice in port list when multiple cameras attached

by Bugzilla from marcus@jet.franken.de :: Rate this Message:

| View Threaded | Show Only this Message

On Thu, Apr 16, 2009 at 11:06:34AM -0700, Jim Nelson wrote:

> Hello,
>
> My application monitors for cameras being attached and detached.  When I
> attach two cameras to my Ubuntu system, the same camera shows up twice in
> the auto-detected listing:
>
> $ gphoto2 --auto-detect
> Model
> Port
> ----------------------------------------------------------
> Canon PowerShot A720 IS (PTP mode) usb:
> USB PTP Class Camera           usb:008,035
> Canon PowerShot A720 IS (PTP mode) usb:008,034
>
> Although I can use the model to detect duplicates, this seems imprecise (for
> example, the unlikely-but-not-impossible case where the user has two cameras
> of the same model).

Hmm. Have to review this, I thought I had it solved but
as I see now its not.

> Additionally, if the user disconnects one of these cameras, the long-form of
> the USB port is lost:

You can still use it however.

> $ gphoto2 --auto-detect
> Model
> Port
> ----------------------------------------------------------
> USB PTP Class Camera           usb:
>
> Thus, the camera which remains attached appears to have a different port.
> I'm assuming the camera object will continue to operate without setting a
> new GPPortInfo, but it means I have only the model ID to use for tracking,
> which as I said, is imprecise.
>
> Two questions: One, is this the expected behavior?  Why have a usb: port
> mirror the usb:xxx,yyy?  (I'm a bit new to this.)
>
> Two, is there a unique way of identifying each camera on the system?  I'm
> thinking of a HAL UID, but I don't know how to convert "usb:" or
> "usb:008,034" to a UID.

It is the USB Bus and Device Number.

So usb:002,010 would be:

  linux.device_file = '/dev/bus/usb/002/010'  (string)
  usb_device.bus_number = 2  (0x2)  (int)
  usb_device.linux.device_number = 10  (0xa)  (int)


Btw, what USB PTP Class Camera is this and what are its ids, for our database? :)

Ciao, Marcus

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@...
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

Re: Camera showing up twice in port list when multiple cameras attached

by Hub Figuière :: Rate this Message:

| View Threaded | Show Only this Message

On 04/16/2009 02:06 PM, Jim Nelson wrote:

> Hello,
>
> My application monitors for cameras being attached and detached.  When I
> attach two cameras to my Ubuntu system, the same camera shows up twice in
> the auto-detected listing:
>
> $ gphoto2 --auto-detect
> Model
> Port
> ----------------------------------------------------------
> Canon PowerShot A720 IS (PTP mode) usb:
> USB PTP Class Camera           usb:008,035
> Canon PowerShot A720 IS (PTP mode) usb:008,034
>
> Although I can use the model to detect duplicates, this seems imprecise (for
> example, the unlikely-but-not-impossible case where the user has two cameras
> of the same model).
>
> Additionally, if the user disconnects one of these cameras, the long-form of
> the USB port is lost:
>
> $ gphoto2 --auto-detect
> Model
> Port
> ----------------------------------------------------------
> USB PTP Class Camera           usb:
>
> Thus, the camera which remains attached appears to have a different port.
> I'm assuming the camera object will continue to operate without setting a
> new GPPortInfo, but it means I have only the model ID to use for tracking,
> which as I said, is imprecise.
>
> Two questions: One, is this the expected behavior?  Why have a usb: port
> mirror the usb:xxx,yyy?  (I'm a bit new to this.)


Just ignore the "usb:". It is kept for compatibility purpose, for back
when we didn't support more that one camera.
Albeit in the second case you should still have two entries.

> Two, is there a unique way of identifying each camera on the system?  I'm
> thinking of a HAL UID, but I don't know how to convert "usb:" or
> "usb:008,034" to a UID.

One of the thing is that these numbers are the one allocated  by the USB
subsystem. Therefor they change at each connect/disconnect.


Hub

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@...
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

Re: Camera showing up twice in port list when multiple cameras attached

by Jim Nelson-4 :: Rate this Message:

| View Threaded | Show Only this Message


Hmm. Have to review this, I thought I had it solved but
as I see now its not.

Ok -- good, I thought I was going crazy.
 
It is the USB Bus and Device Number.

So usb:002,010 would be:

 linux.device_file = '/dev/bus/usb/002/010'  (string)
 usb_device.bus_number = 2  (0x2)  (int)
 usb_device.linux.device_number = 10  (0xa)  (int)

Great -- i think I see a way around this, at least for now.
 
Btw, what USB PTP Class Camera is this and what are its ids, for our database? :)

It is a Kodak EasyShare M1063, 10.3 megapixels.  Device Manager reports:

usb.product_id = 1486 (0x5ce)
usb.vendor_id = 1034 (0x40a)

Is this the information you're asking for?

-- Jim Nelson
Yorba

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@...
https://lists.sourceforge.net/lists/listinfo/gphoto-devel

Re: Camera showing up twice in port list when multiple cameras attached

by Jason Holt :: Rate this Message:

| View Threaded | Show Only this Message


I had the same problem the other day.  I normally work with multiple cameras,
so my code ignores the plain usb: entry because it's redundant, and deals with
the fact that there's one more entry than there are cameras.  But when I tried
to use my code with just one camera, it saw the single entry and concluded
that there were n-1=0 cameras attached.

------------------------------------------------------------------------------
Stay on top of everything new and different, both inside and
around Java (TM) technology - register by April 22, and save
$200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco.
300 plus technical and hands-on sessions. Register today.
Use priority code J9JMT32. http://p.sf.net/sfu/p
_______________________________________________
Gphoto-devel mailing list
Gphoto-devel@...
https://lists.sourceforge.net/lists/listinfo/gphoto-devel