pict
Documentation for pict is still a work-in-progress
 
Loading...
Searching...
No Matches
cl_backend.h
Go to the documentation of this file.
1
2#ifndef CL_BACKEND_H
3#define CL_BACKEND_H
4
9
12 struct PtpDeviceEntry *prev;
13
14 int id;
15 int vendor_id;
16 int product_id;
17
18 uint32_t endpoint_in;
19 uint32_t endpoint_out;
20 uint32_t endpoint_int;
21
22 char name[16];
23 char manufacturer[16];
24 void *device_handle_ptr;
25
26 struct PtpDeviceEntry *next;
27};
28
32
35
38int ptp_device_open(struct PtpRuntime *r, struct PtpDeviceEntry *entry);
39
42
44int ptp_cmd_write(struct PtpRuntime *r, void *to, unsigned int length);
46int ptp_cmd_read(struct PtpRuntime *r, void *to, unsigned int length);
47
50
52int ptp_send_packet(struct PtpRuntime *r, unsigned int length);
53
56
58int ptp_read_int(struct PtpRuntime *r, void *to, unsigned int length);
59
62
65int ptpip_connect(struct PtpRuntime *r, const char *addr, int port, int extra_tmout);
67int ptpip_cmd_write(struct PtpRuntime *r, void *data, unsigned int size);
69int ptpip_cmd_read(struct PtpRuntime *r, void *data, unsigned int size);
71int ptpip_connect_events(struct PtpRuntime *r, const char *addr, int port);
72int ptpip_event_send(struct PtpRuntime *r, void *data, unsigned int size);
73int ptpip_event_read(struct PtpRuntime *r, void *data, unsigned int size);
76
79
84
88
91
92// old api
93__attribute__((deprecated))
94__attribute__((unused))
95static int ptp_device_init(struct PtpRuntime *r) {
96 return ptp_device_connect(r);
97}
98
100
101#endif
int ptp_send_packet(struct PtpRuntime *r, unsigned int length)
Send packets in r->data.
int ptp_device_reset(struct PtpRuntime *r)
Reset the USB endpoints if possible.
int ptpusb_get_status(struct PtpRuntime *r)
Get status of currently connected device This is a quick and cheap way to check if the connection is ...
int ptp_device_open(struct PtpRuntime *r, struct PtpDeviceEntry *entry)
Open and connect to a device from the PtpDeviceEntry structure.
int ptpip_connect_events(struct PtpRuntime *r, const char *addr, int port)
Connect PTP/IP event socket. Port depends on implementation.
int ptp_device_connect(struct PtpRuntime *r)
Connects to the first PTP device it finds.
void ptp_comm_deinit(struct PtpRuntime *r)
Deinits backend and frees all memory.
struct PtpDeviceEntry * ptpusb_device_list(struct PtpRuntime *r)
Get a linked list of USB or PTP Devices.
int ptp_read_int(struct PtpRuntime *r, void *to, unsigned int length)
Poll the interrupt endpoint.
int ptp_device_close(struct PtpRuntime *r)
Disconnect from the current device.
void ptpusb_free_device_list_entry(void *)
Backend must implement this to free the device_handle_ptr field in each device entry.
int ptp_receive_all_packets(struct PtpRuntime *r)
Receive all packets into r->data.
int ptpip_cmd_write(struct PtpRuntime *r, void *data, unsigned int size)
Send data over the raw command endpoint for USB backend.
int ptpip_connect(struct PtpRuntime *r, const char *addr, int port, int extra_tmout)
Connect to a TCP port on the default network adapter.
void ptpusb_free_device_list(struct PtpDeviceEntry *e)
Frees the device entry linked list.
int ptpip_cmd_read(struct PtpRuntime *r, void *data, unsigned int size)
Receive raw data over the command endpoint for USB backend.
int ptp_cmd_read(struct PtpRuntime *r, void *to, unsigned int length)
Receive raw data over the command endpoint for USB backend.
int ptp_cmd_write(struct PtpRuntime *r, void *to, unsigned int length)
Send data over the raw command endpoint for USB backend.
int ptpip_device_close(struct PtpRuntime *r)
Disconnect from a PTP/IP device.
int ptp_comm_init(struct PtpRuntime *r)
Initializes backend context.
PUB __attribute__((noreturn)) void ptp_panic(char *fmt
Client has no way out, crash the application.
Linked-list entry for a single USB device.
Definition cl_backend.h:11
Represents a single device connection.
Definition libpict.h:114