Commit 136bd784 authored by hudson@kremvax.wan's avatar hudson@kremvax.wan
Browse files

PTP works, although UI is still locked in PTP mode

parent e8550f313f2f
......@@ -11,24 +11,41 @@
#include "menu.h"
#include "bmp.h"
#include "hotplug.h"
#include "property.h"
static int
ptp_handler_9999(
void * priv,
struct usb_context * context,
void * r2,
void * r3
struct ptp_context * context,
uint32_t opcode,
uint32_t session,
uint32_t transaction,
uint32_t param1,
uint32_t param2,
uint32_t param3,
uint32_t param4,
uint32_t param5
)
{
struct ptp_msg msg = {
.id = 0x2002,
};
void * (*AllocateMemory)( size_t ) = (void*) 0xFF86DFE8;
void (*FreeMemory)( void * ) = (void*) 0xFF86AF60;
bmp_printf( FONT_LARGE, 0, 30, "usb %08x %08x", context, context->handle );
struct ptp_msg msg = {
.id = PTP_RC_OK,
.session = session,
.transaction = transaction,
.param_count = 4,
.param = { 1, 2, 0xdeadbeef, 3 },
};
//call( "FA_StartLiveView" );
bmp_printf( FONT_MED, 0, 30, "usb %08x %08x", context, context->handle );
bmp_printf( FONT_MED, 0, 50, "%08x %08x %08x %08x %08x",
(unsigned) param1,
(unsigned) param2,
(unsigned) param3,
(unsigned) param4,
(unsigned) param5
);
#if 0
int len = context->len( context->handle );
bmp_printf( FONT_LARGE, 0, 50, "Len = %d", len );
if( !len )
......@@ -57,11 +74,13 @@ ptp_handler_9999(
bmp_hexdump( FONT_LARGE, 0, 50, buf, len );
FreeMemory( buf );
#endif
context->send(
context->handle,
&msg
);
return 0;
}
......
......@@ -23,24 +23,32 @@
#define PTP_AF_START 0x9160
#define PTP_FAPI_MESSAGE_TX 0x91fe
struct usb_handle;
#define PTP_RC_OK 0x2001
#define PTP_RC_ERROR 0x2002
struct ptp_handle;
struct ptp_msg
{
uint16_t id;
uint16_t off_0x02;
uint8_t buf[ 8 ];
uint32_t id;
uint32_t session;
uint32_t transaction;
uint32_t param_count;
uint32_t param[ 5 ];
} __PACKED__;
struct usb_context
SIZE_CHECK_STRUCT( ptp_msg, 0x24 );
struct ptp_context
{
struct usb_handle * handle; // off_0x00;
struct ptp_handle * handle; // off_0x00;
void * off_0x04;
// off 0x08
void (*recv)(
struct usb_handle * handle,
struct ptp_handle * handle,
void * buf,
size_t len,
void (*callback)(
......@@ -54,14 +62,14 @@ struct usb_context
// \note format to be determined
// off_0x0c
int (*send)(
struct usb_handle * handle,
struct ptp_handle * handle,
struct ptp_msg * msg
);
// Returns length of message to receive
// off 0x10
int (*len)(
struct usb_handle * handle
struct ptp_handle * handle
);
void * off_0x14;
......@@ -75,7 +83,7 @@ ptp_register_handler(
uint32_t id,
int (*handler)(
void * priv,
struct usb_context * context,
struct ptp_context * context,
void * r2, // unknown
void * r3 // unknown
),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment