xref: /haiku/src/add-ons/kernel/bus_managers/usb/Interface.cpp (revision 9d6d3fcf5fe8308cd020cecf89dede440346f8c4)
1 /*
2  * Copyright 2006, Haiku Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  *
5  * Authors:
6  *		Michael Lotz <mmlr@mlotz.ch>
7  */
8 
9 #include "usb_p.h"
10 
11 
12 Interface::Interface(Object *parent, uint8 interfaceIndex)
13 	:	Object(parent),
14 		fInterfaceIndex(interfaceIndex)
15 {
16 }
17 
18 
19 status_t
20 Interface::SetFeature(uint16 selector)
21 {
22 	return ((Device *)Parent())->DefaultPipe()->SendRequest(
23 		USB_REQTYPE_STANDARD | USB_REQTYPE_INTERFACE_OUT,
24 		USB_REQUEST_SET_FEATURE,
25 		selector,
26 		fInterfaceIndex,
27 		0,
28 		NULL,
29 		0,
30 		NULL);
31 }
32 
33 
34 status_t
35 Interface::ClearFeature(uint16 selector)
36 {
37 	return ((Device *)Parent())->DefaultPipe()->SendRequest(
38 		USB_REQTYPE_STANDARD | USB_REQTYPE_INTERFACE_OUT,
39 		USB_REQUEST_CLEAR_FEATURE,
40 		selector,
41 		fInterfaceIndex,
42 		0,
43 		NULL,
44 		0,
45 		NULL);
46 }
47 
48 
49 status_t
50 Interface::GetStatus(uint16 *status)
51 {
52 	return ((Device *)Parent())->DefaultPipe()->SendRequest(
53 		USB_REQTYPE_STANDARD | USB_REQTYPE_INTERFACE_IN,
54 		USB_REQUEST_GET_STATUS,
55 		fInterfaceIndex,
56 		0,
57 		2,
58 		(void *)status,
59 		2,
60 		NULL);
61 }
62