1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
|
#ifndef _PSP2_UDCD_H_
#define _PSP2_UDCD_H_
#include <stdint.h>
#include <scetypes.h>
#ifdef __cplusplus
extern "C" {
#endif
/** USB Status */
typedef enum SceUdcdStatus {
SCE_UDCD_STATUS_CONNECTION_NEW = 0x0001,
SCE_UDCD_STATUS_CONNECTION_ESTABLISHED = 0x0002,
SCE_UDCD_STATUS_CONNECTION_SUSPENDED = 0x0004,
SCE_UDCD_STATUS_CABLE_DISCONNECTED = 0x0010,
SCE_UDCD_STATUS_CABLE_CONNECTED = 0x0020,
SCE_UDCD_STATUS_DEACTIVATED = 0x0100,
SCE_UDCD_STATUS_ACTIVATED = 0x0200,
SCE_UDCD_STATUS_IS_CHARGING = 0x0400,
SCE_UDCD_STATUS_USE_USB_CHARGING = 0x0800,
SCE_UDCD_STATUS_UNKNOWN_1000 = 0x1000,
SCE_UDCD_STATUS_UNKNOWN_2000 = 0x2000
} SceUdcdStatus;
/** USB Driver status
*/
typedef enum SceUdcdStatusDriver {
SCE_UDCD_STATUS_DRIVER_STARTED = 0x01,
SCE_UDCD_STATUS_DRIVER_REGISTERED = 0x02
} SceUdcdStatusDriver;
typedef struct {
uint8_t info[64];
} SceUdcdDeviceInfo;
typedef struct SceUdcdWaitParam {
int unk_00;
int status;
int unk_08;
int unk_0C;
int unk_10;
const char *driverName;
} SceUdcdWaitParam;
typedef struct SceUdcdDeviceState {
int unk_00;
int state;
int cable;
int connection;
int use_usb_charging;
int unk_14;
} SceUdcdDeviceState;
/**
* Get device state
*
* @param[out] state - Device state
*
* @return 0 on success, < 0 on error.
*/
int sceUdcdGetDeviceState(SceUdcdDeviceState *state);
/**
* Get device information
*
* @param[out] devInfo - Device information
*
* @return 0 on success, < 0 on error.
*/
int sceUdcdGetDeviceInfo(SceUdcdDeviceInfo *devInfo);
/**
* Get state of a specific USB driver
*
* @param driverName - name of USB driver to get status from
*
* @return SCE_UDCD_STATUS_DRIVER_STARTED if the driver has been started, SCE_UDCD_STATUS_DRIVER_REGISTERED if it is stopped
*/
int sceUdcdGetDrvState(const char *driverName);
/**
* Register callback
*
* @param[in] cbid - Callback UID
* @param[in] state - State
*
* @return 0 on success, < 0 on error.
*/
int sceUdcdRegisterCallback(SceUID cbid, int state);
/**
* Unregister callback
*
* @param[in] cbid - Callback UID
*
* @return 0 on success, < 0 on error.
*/
int sceUdcdUnregisterCallback(SceUID cbid);
/**
* Wait for state
*
* @param[in] waitParam - Wait parameter
* @param[in] timeout - Timeout
*
* @return 0 on success, < 0 on error.
*/
int sceUdcdWaitState(SceUdcdWaitParam *waitParam, unsigned int timeout);
#ifdef __cplusplus
}
#endif
#endif /* _PSP2_UDCD_H_ */
|