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_private.h" 10 11 12 Interface::Interface(Object *parent, uint8 interfaceIndex) 13 : Object(parent), 14 fInterfaceIndex(interfaceIndex) 15 { 16 TRACE("creating interface\n"); 17 } 18 19 20 status_t 21 Interface::SetFeature(uint16 selector) 22 { 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, 29 0, 30 NULL, 31 0, 32 NULL); 33 } 34 35 36 status_t 37 Interface::ClearFeature(uint16 selector) 38 { 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, 45 0, 46 NULL, 47 0, 48 NULL); 49 } 50 51 52 status_t 53 Interface::GetStatus(uint16 *status) 54 { 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, 60 0, 61 2, 62 (void *)status, 63 2, 64 NULL); 65 } 66