1/* 2 * Copyright (c) 2007-2013 ETH Zurich. 3 * All rights reserved. 4 * 5 * This file is distributed under the terms in the attached LICENSE file. 6 * If you do not find this file, copies can be found by writing to: 7 * ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group. 8 */ 9 10#include <stdio.h> 11#include <stdlib.h> 12#include <barrelfish/barrelfish.h> 13 14 15#include <usb/usb.h> 16 17#include "usb_manager_service.h" 18 19static struct usb_manager_thc_export_info export_info; 20static struct usb_manager_thc_service_binding_t service; 21static struct usb_manager_binding *binding; 22static iref_t service_iref; 23 24 25/** 26 * \brief this function initalizes the USB Manager service 27 * using THC 28 * 29 * XXX: Currently this is not used. 30 */ 31errval_t usb_manager_service_init(void) 32{ 33 errval_t err; 34 35 err = usb_manager_thc_export(&export_info, USB_MANAGER_SERVICE, 36 get_default_waitset(), IDC_EXPORT_FLAGS_DEFAULT, &service_iref); 37 38 if (err_is_fail(err)) { 39 USER_PANIC_ERR(err, "failed to export THC service."); 40 return (err); 41 } 42 43 err = usb_manager_thc_accept(&export_info, &binding); 44 if (err_is_fail(err)) { 45 USER_PANIC_ERR(err, "THC accept failed."); 46 return (err); 47 } 48 49 err = usb_manager_thc_init_service(&service, binding, binding); 50 if (err_is_fail(err)) { 51 USER_PANIC_ERR(err, "THC init failed."); 52 return (err); 53 } 54 return (SYS_ERR_OK); 55} 56 57 58void usb_manager_service_start(void) 59{ 60 usb_manager_service_msg_t msg; 61 62 struct usb_manager_service_selector selector; 63 64 while(1) { 65 66 service.recv_any(&service, &msg, selector); 67 68 switch(msg.msg) { 69 case usb_manager_connect: 70 71 break; 72 73 default: 74 75 break; 76 77 } 78 } 79} 80