Pass read and write calls to the protocol handlers as well, moving the default
of returning B_ERROR to the ProtocolHandler base class. Not used yet, but will be used for the BJoystick <-> JoystickProtocolHandler. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@41835 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
6ec9dff3f3
commit
b5274bc4f6
@ -177,7 +177,7 @@ static status_t
|
||||
usb_hid_open(const char *name, uint32 flags, void **_cookie)
|
||||
{
|
||||
TRACE("open(%s, %lu, %p)\n", name, flags, _cookie);
|
||||
|
||||
|
||||
device_cookie *cookie = new(std::nothrow) device_cookie();
|
||||
if (cookie == NULL)
|
||||
return B_NO_MEMORY;
|
||||
@ -206,21 +206,25 @@ usb_hid_open(const char *name, uint32 flags, void **_cookie)
|
||||
|
||||
|
||||
static status_t
|
||||
usb_hid_read(void *cookie, off_t position, void *buffer, size_t *numBytes)
|
||||
usb_hid_read(void *_cookie, off_t position, void *buffer, size_t *numBytes)
|
||||
{
|
||||
TRACE_ALWAYS("read on hid device\n");
|
||||
*numBytes = 0;
|
||||
return B_ERROR;
|
||||
device_cookie *cookie = (device_cookie *)_cookie;
|
||||
|
||||
TRACE("read(%p, %llu, %p, %p (%lu)\n", cookie, position, buffer, numBytes,
|
||||
numBytes != NULL ? *numBytes : 0);
|
||||
return cookie->handler->Read(&cookie->cookie, position, buffer, numBytes);
|
||||
}
|
||||
|
||||
|
||||
static status_t
|
||||
usb_hid_write(void *cookie, off_t position, const void *buffer,
|
||||
usb_hid_write(void *_cookie, off_t position, const void *buffer,
|
||||
size_t *numBytes)
|
||||
{
|
||||
TRACE_ALWAYS("write on hid device\n");
|
||||
*numBytes = 0;
|
||||
return B_ERROR;
|
||||
device_cookie *cookie = (device_cookie *)_cookie;
|
||||
|
||||
TRACE("write(%p, %llu, %p, %p (%lu)\n", cookie, position, buffer, numBytes,
|
||||
numBytes != NULL ? *numBytes : 0);
|
||||
return cookie->handler->Write(&cookie->cookie, position, buffer, numBytes);
|
||||
}
|
||||
|
||||
|
||||
|
@ -120,10 +120,30 @@ ProtocolHandler::Close(uint32 *cookie)
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ProtocolHandler::Read(uint32 *cookie, off_t position, void *buffer,
|
||||
size_t *numBytes)
|
||||
{
|
||||
TRACE_ALWAYS("unhandled read on protocol handler\n");
|
||||
*numBytes = 0;
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ProtocolHandler::Write(uint32 *cookie, off_t position, const void *buffer,
|
||||
size_t *numBytes)
|
||||
{
|
||||
TRACE_ALWAYS("unhandled write on protocol handler\n");
|
||||
*numBytes = 0;
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
ProtocolHandler::Control(uint32 *cookie, uint32 op, void *buffer, size_t length)
|
||||
{
|
||||
TRACE_ALWAYS("control on base class\n");
|
||||
TRACE_ALWAYS("unhandled control on protocol handler\n");
|
||||
return B_ERROR;
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,11 @@ public:
|
||||
virtual status_t Open(uint32 flags, uint32 *cookie);
|
||||
virtual status_t Close(uint32 *cookie);
|
||||
|
||||
virtual status_t Read(uint32 *cookie, off_t position,
|
||||
void *buffer, size_t *numBytes);
|
||||
virtual status_t Write(uint32 *cookie, off_t position,
|
||||
const void *buffer, size_t *numBytes);
|
||||
|
||||
virtual status_t Control(uint32 *cookie, uint32 op, void *buffer,
|
||||
size_t length);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user