vfs: check userland buffers before reading them.
[haiku.git] / src / add-ons / kernel / bus_managers / usb / Interface.cpp
blob7ceb7fb22d41e71503358119886b51e7dcdddb88
1 /*
2 * Copyright 2006, Haiku Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Michael Lotz <mmlr@mlotz.ch>
7 */
9 #include "usb_private.h"
12 Interface::Interface(Object *parent, uint8 interfaceIndex)
13 : Object(parent),
14 fInterfaceIndex(interfaceIndex)
16 TRACE("creating interface\n");
20 status_t
21 Interface::SetFeature(uint16 selector)
23 TRACE("set feature %u\n", selector);
24 return ((Device *)Parent())->DefaultPipe()->SendRequest(
25 USB_REQTYPE_STANDARD | USB_REQTYPE_INTERFACE_OUT,
26 USB_REQUEST_SET_FEATURE,
27 selector,
28 fInterfaceIndex,
30 NULL,
32 NULL);
36 status_t
37 Interface::ClearFeature(uint16 selector)
39 TRACE("clear feature %u\n", selector);
40 return ((Device *)Parent())->DefaultPipe()->SendRequest(
41 USB_REQTYPE_STANDARD | USB_REQTYPE_INTERFACE_OUT,
42 USB_REQUEST_CLEAR_FEATURE,
43 selector,
44 fInterfaceIndex,
46 NULL,
48 NULL);
52 status_t
53 Interface::GetStatus(uint16 *status)
55 TRACE("get status\n");
56 return ((Device *)Parent())->DefaultPipe()->SendRequest(
57 USB_REQTYPE_STANDARD | USB_REQTYPE_INTERFACE_IN,
58 USB_REQUEST_GET_STATUS,
59 fInterfaceIndex,
62 (void *)status,
64 NULL);