Changeset cd50486 in mainline for uspace/lib/usb/src
- Timestamp:
- 2011-02-06T22:03:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 25971d2
- Parents:
- 1110ebd (diff), 960ff451 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- uspace/lib/usb/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/src/addrkeep.c
r1110ebd rcd50486 149 149 &addresses->default_condvar_guard); 150 150 } 151 addresses->default_available = false; 151 152 fibril_mutex_unlock(&addresses->default_condvar_guard); 152 153 } -
uspace/lib/usb/src/debug.c
r1110ebd rcd50486 67 67 /** Serialization mutex for logging functions. */ 68 68 static FIBRIL_MUTEX_INITIALIZE(log_serializer); 69 static FILE *log_stream = NULL; 69 70 70 71 /** Find or create new tag with given name. … … 171 172 log_prefix = message_prefix; 172 173 log_level = level; 174 if (log_stream == NULL) { 175 char *fname; 176 int rc = asprintf(&fname, "/log/%s", message_prefix); 177 if (rc > 0) { 178 log_stream = fopen(fname, "w"); 179 free(fname); 180 } 181 } 173 182 } 174 183 … … 197 206 void usb_log_printf(usb_log_level_t level, const char *format, ...) 198 207 { 199 if (level > log_level) { 200 return; 201 } 202 203 FILE *stream = NULL; 208 FILE *screen_stream = NULL; 204 209 switch (level) { 205 210 case USB_LOG_LEVEL_FATAL: 206 211 case USB_LOG_LEVEL_ERROR: 207 s tream = stderr;212 screen_stream = stderr; 208 213 break; 209 214 default: 210 s tream = stdout;215 screen_stream = stdout; 211 216 break; 212 217 } 213 assert(s tream != NULL);218 assert(screen_stream != NULL); 214 219 215 220 va_list args; 216 va_start(args, format); 217 221 222 /* 223 * Serialize access to log files. 224 * Always print to log file, to screen print only when the enabled 225 * log level is high enough. 226 */ 218 227 fibril_mutex_lock(&log_serializer); 219 fprintf(stream, "[%s]%s: ", log_prefix, log_level_name(level)); 220 vfprintf(stream, format, args); 228 229 const char *level_name = log_level_name(level); 230 231 if (log_stream != NULL) { 232 va_start(args, format); 233 234 fprintf(log_stream, "[%s]%s: ", log_prefix, level_name); 235 vfprintf(log_stream, format, args); 236 fflush(log_stream); 237 238 va_end(args); 239 } 240 241 if (level <= log_level) { 242 va_start(args, format); 243 244 fprintf(screen_stream, "[%s]%s: ", log_prefix, level_name); 245 vfprintf(screen_stream, format, args); 246 fflush(screen_stream); 247 248 va_end(args); 249 } 250 221 251 fibril_mutex_unlock(&log_serializer); 222 223 va_end(args);224 252 } 225 253 -
uspace/lib/usb/src/pipes.c
r1110ebd rcd50486 90 90 91 91 leave: 92 ipc_hangup(hc_phone);92 async_hangup(hc_phone); 93 93 return rc; 94 94 } … … 211 211 } 212 212 213 int rc = ipc_hangup(pipe->hc_phone);213 int rc = async_hangup(pipe->hc_phone); 214 214 if (rc != EOK) { 215 215 return rc; -
uspace/lib/usb/src/recognise.c
r1110ebd rcd50486 33 33 * @brief Functions for recognising kind of attached devices. 34 34 */ 35 #include <sys/types.h> 35 36 #include <usb_iface.h> 36 37 #include <usb/usbdrv.h> … … 359 360 { 360 361 static size_t device_name_index = 0; 362 static FIBRIL_MUTEX_INITIALIZE(device_name_index_mutex); 363 364 size_t this_device_name_index; 365 366 fibril_mutex_lock(&device_name_index_mutex); 367 this_device_name_index = device_name_index; 368 device_name_index++; 369 fibril_mutex_unlock(&device_name_index_mutex); 370 361 371 362 372 device_t *child = NULL; … … 374 384 * naming etc., something more descriptive could be created. 375 385 */ 376 rc = asprintf(&child_name, "usbdev%02zu", device_name_index);386 rc = asprintf(&child_name, "usbdev%02zu", this_device_name_index); 377 387 if (rc < 0) { 378 388 goto failure; … … 396 406 } 397 407 398 device_name_index++;399 400 408 return EOK; 401 409 -
uspace/lib/usb/src/usbdrv.c
r1110ebd rcd50486 80 80 IPC_M_USB_GET_HOST_CONTROLLER_HANDLE, &h); 81 81 82 ipc_hangup(parent_phone);82 async_hangup(parent_phone); 83 83 84 84 if (rc != EOK) { -
uspace/lib/usb/src/usbmem.c
r1110ebd rcd50486 1 1 /* 2 * Copyright (c) 201 0Matus Dekanek2 * Copyright (c) 2011 Matus Dekanek 3 3 * All rights reserved. 4 4 * … … 69 69 } 70 70 71 static void addr_remove_callback(link_t * item)71 static void addr_remove_callback(link_t * item) 72 72 { 73 73 //delete item
Note:
See TracChangeset
for help on using the changeset viewer.