blob: 729446be9959d169ca78b30a7f4e110a03790ab7 [file] [log] [blame]
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00001/*
Linus Walleijb02a0662006-04-25 08:05:09 +00002 * libusb-glue.h
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00003 *
4 * Created by Richard Low on 24/12/2005.
Linus Walleijb02a0662006-04-25 08:05:09 +00005 * Modified by Linus Walleij
Linus Walleijeb8c6fe2006-02-03 09:46:22 +00006 *
7 */
8
Linus Walleijb02a0662006-04-25 08:05:09 +00009#include "ptp.h"
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000010#include <usb.h>
Linus Walleij15e344f2006-03-06 15:15:00 +000011#include "libmtp.h"
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000012
13#define USB_BULK_READ usb_bulk_read
14#define USB_BULK_WRITE usb_bulk_write
15
Linus Walleij2d411db2006-03-22 12:13:09 +000016/**
17 * Internal USB struct (TODO: discard for device struct?)
18 */
19typedef struct _PTP_USB PTP_USB;
20struct _PTP_USB {
Linus Walleijc6210fb2006-05-08 11:11:41 +000021 usb_dev_handle* handle;
22 int interface;
23 int inep;
24 int inep_maxpacket;
25 int outep;
26 int outep_maxpacket;
27 int intep;
Linus Walleij2d411db2006-03-22 12:13:09 +000028};
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000029
Linus Walleij6fd2f082006-03-28 07:19:22 +000030int get_device_list(LIBMTP_device_entry_t ** const devices, int * const numdevs);
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000031int open_device (int busn, int devn, short force, PTP_USB *ptp_usb, PTPParams *params, struct usb_device **dev);
Linus Walleijc6210fb2006-05-08 11:11:41 +000032void dump_usbinfo(PTP_USB *ptp_usb);
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000033void close_device (PTP_USB *ptp_usb, PTPParams *params, uint8_t interfaceNumber);
Linus Walleijeb8c6fe2006-02-03 09:46:22 +000034uint16_t connect_first_device(PTPParams *params, PTP_USB *ptp_usb, uint8_t *interfaceNumber);
35
36/* connect_first_device return codes */
37#define PTP_CD_RC_CONNECTED 0
38#define PTP_CD_RC_NO_DEVICES 1
39#define PTP_CD_RC_ERROR_CONNECTING 2