|
From: Ali S. <ca...@gm...> - 2008-02-17 01:44:58
|
Hi,
Investigating into the specifics of how this can be accomplished it doesn't
seem very difficult to implement this, by simply using
get_mtp_usb_device_list and creating a list of structs with vid/pid
combinations along with the raw libusb device.
We then free this mtpdevice_list and return the list of raw device structs.
Opening from the raw device structs can be accomplished by doing a
prime_device_memory, assign_known_device_flags, configure_usb_device etc on
the singular device only.
It will require more specific functions that, will (as you mentioned)
require a bit of refactoring. As an example prime_device_memory will need to
take a singular device as param, this allows it to be called multiple times
(when we try to detect all devices) or when we just want to initialize one
chosen device
This comes with a few grey areas
1) The client application will need to be notified via HAL/DBUS when a
device has been disconnected/connected
2) Its not completely clear how we HAL detections to the libusb raw devices.
3) unfortunately this method does not give alot of information to the client
application, besides, here is a list of raw devices, please pick from one..
Please let me know if i'm not on the right track :)
Ali
On Jan 14, 2008 4:39 PM, Linus Walleij <lin...@gm...> wrote:
> 2008/1/11, Alan McGovern <ala...@gm...>:
>
> > // Returns 0 if successful, otherwise an errorcode.
> > // devices: an array of Device structs representing connected devices
> > // count: the number of devices in the array
> > int LIBMTP_Detect_Devices(Device** devices, int* count)
>
> Looks sound, I would call it LIBMTP_Detect_Raw_Devices(),
> LIBMTP_Connect_Raw_Device() and the struct
> LIBMTP_Raw_Device (typed LIBMTP_Raw_Device_t)
>
> > the Device struct could be something along the lines of:
> > struct Device {
> > int usbPort;
> > int usbDevice;
>
> Are these available from libusb? (I haven't looked closely.)
>
> > int productId;
> > int vendorId;
> > // Add in anything else which may be useful.
> > }
>
> I don't think anything else will be useful :-)
>
> > Even still, someone more familiar with the code could probably advise
> > a better pattern, which would simplify the merger into libgphoto
> > later.
>
> Nah well, none of us do this for a living really. All code is welcome,
> we'll shape it up, if it's going in the right direction.
>
> Linus
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
>
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Libmtp-discuss mailing list
> Lib...@li...
> https://lists.sourceforge.net/lists/listinfo/libmtp-discuss
>
|