Changeset a8723748 in mainline for uspace/drv/bus
- Timestamp:
- 2017-12-15T10:55:09Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 64d138b
- Parents:
- 837d53d
- Location:
- uspace/drv/bus/usb/usbdiag
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/usbdiag/Makefile
r837d53d ra8723748 29 29 USPACE_PREFIX = ../../../.. 30 30 31 LIBS = usbd ev usb drv31 LIBS = usbdiag usbdev usb drv 32 32 33 33 BINARY = usbdiag -
uspace/drv/bus/usb/usbdiag/main.c
r837d53d ra8723748 32 32 /** 33 33 * @file 34 * Main routines of USB d ebugdevice driver.34 * Main routines of USB diagnostic device driver. 35 35 */ 36 36 #include <errno.h> 37 37 #include <usb/debug.h> 38 38 #include <usb/dev/driver.h> 39 #include <usb/diag/diag.h> 39 40 40 41 #include "usbdiag.h" … … 42 43 43 44 #define NAME "usbdiag" 45 46 static void usb_diag_test_impl(ipc_callid_t rid, ipc_call_t *request) 47 { 48 int x = IPC_GET_ARG1(*request); 49 int ret = 4200 + x; 50 async_answer_0(rid, ret); 51 } 44 52 45 53 static int device_add(usb_device_t *dev) … … 99 107 } 100 108 101 /** USB debug driver ops. */ 109 static void connection(ipc_callid_t iid, ipc_call_t *icall, void *arg) 110 { 111 bool cont = true; 112 113 async_answer_0(iid, EOK); 114 115 while (cont) { 116 ipc_call_t call; 117 ipc_callid_t callid = async_get_call(&call); 118 119 if (!IPC_GET_IMETHOD(call)) 120 break; 121 122 switch (IPC_GET_IMETHOD(call)) { 123 case USB_DIAG_IN_TEST: 124 usb_diag_test_impl(callid, &call); 125 break; 126 default: 127 async_answer_0(callid, ENOTSUP); 128 break; 129 } 130 } 131 } 132 133 static int server_fibril(void *arg) 134 { 135 // async_set_client_data_constructor(NULL); 136 // async_set_client_data_destructor(NULL); 137 async_set_fallback_port_handler(connection, NULL); 138 // async_event_task_subscribe(); 139 // service_register(); 140 async_manager(); 141 142 /* Never reached. */ 143 return EOK; 144 } 145 146 /** USB diagnostic driver ops. */ 102 147 static const usb_driver_ops_t diag_driver_ops = { 103 148 .device_add = device_add, … … 108 153 }; 109 154 110 /** USB d ebugdriver. */155 /** USB diagnostic driver. */ 111 156 static const usb_driver_t diag_driver = { 112 157 .name = NAME, … … 117 162 int main(int argc, char *argv[]) 118 163 { 119 printf(NAME ": USB d ebugdevice driver.\n");164 printf(NAME ": USB diagnostic device driver.\n"); 120 165 121 166 log_init(NAME); 167 168 /* Start usbdiag service. */ 169 fid_t srv = fibril_create(server_fibril, NULL); 170 if (!srv) 171 return ENOMEM; 172 fibril_add_ready(srv); 122 173 123 174 return usb_driver_main(&diag_driver);
Note:
See TracChangeset
for help on using the changeset viewer.
