usb_template_audio.c (246122) | usb_template_audio.c (246123) |
---|---|
1/* $FreeBSD: head/sys/dev/usb/template/usb_template_audio.c 246122 2013-01-30 15:26:04Z hselasky $ */ | 1/* $FreeBSD: head/sys/dev/usb/template/usb_template_audio.c 246123 2013-01-30 15:46:26Z hselasky $ */ |
2/*- 3 * Copyright (c) 2010 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 37 unchanged lines hidden (view full) --- 47#include <sys/sx.h> 48#include <sys/unistd.h> 49#include <sys/callout.h> 50#include <sys/malloc.h> 51#include <sys/priv.h> 52 53#include <dev/usb/usb.h> 54#include <dev/usb/usbdi.h> | 2/*- 3 * Copyright (c) 2010 Hans Petter Selasky. All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. --- 37 unchanged lines hidden (view full) --- 47#include <sys/sx.h> 48#include <sys/unistd.h> 49#include <sys/callout.h> 50#include <sys/malloc.h> 51#include <sys/priv.h> 52 53#include <dev/usb/usb.h> 54#include <dev/usb/usbdi.h> |
55#include <dev/usb/usb_core.h> |
|
55#include <dev/usb/usb_cdc.h> 56 57#include <dev/usb/template/usb_template.h> 58#endif /* USB_GLOBAL_INCLUDE_FILE */ 59 60enum { 61 INDEX_AUDIO_LANG, 62 INDEX_AUDIO_MIXER, 63 INDEX_AUDIO_RECORD, 64 INDEX_AUDIO_PLAYBACK, 65 INDEX_AUDIO_PRODUCT, 66 INDEX_AUDIO_MAX, 67}; 68 | 56#include <dev/usb/usb_cdc.h> 57 58#include <dev/usb/template/usb_template.h> 59#endif /* USB_GLOBAL_INCLUDE_FILE */ 60 61enum { 62 INDEX_AUDIO_LANG, 63 INDEX_AUDIO_MIXER, 64 INDEX_AUDIO_RECORD, 65 INDEX_AUDIO_PLAYBACK, 66 INDEX_AUDIO_PRODUCT, 67 INDEX_AUDIO_MAX, 68}; 69 |
69#define STRING_LANG \ 70 0x09, 0x04, /* American English */ 71 | |
72#define STRING_AUDIO_PRODUCT \ 73 'A', 0, 'u', 0, 'd', 0, 'i', 0, 'o', 0, ' ', 0, \ 74 'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \ 75 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0, 76 77#define STRING_AUDIO_MIXER \ 78 'M', 0, 'i', 0, 'x', 0, 'e', 0, 'r', 0, ' ', 0, \ 79 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, --- 4 unchanged lines hidden (view full) --- 84 85#define STRING_AUDIO_PLAYBACK \ 86 'P', 0, 'l', 0, 'a', 0, 'y', 0, 'b', 0, 'a', 0, 'c', 0, 'k', 0, ' ', 0, \ 87 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, 88 89 90/* make the real string descriptors */ 91 | 70#define STRING_AUDIO_PRODUCT \ 71 'A', 0, 'u', 0, 'd', 0, 'i', 0, 'o', 0, ' ', 0, \ 72 'T', 0, 'e', 0, 's', 0, 't', 0, ' ', 0, \ 73 'D', 0, 'e', 0, 'v', 0, 'i', 0, 'c', 0, 'e', 0, 74 75#define STRING_AUDIO_MIXER \ 76 'M', 0, 'i', 0, 'x', 0, 'e', 0, 'r', 0, ' ', 0, \ 77 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, --- 4 unchanged lines hidden (view full) --- 82 83#define STRING_AUDIO_PLAYBACK \ 84 'P', 0, 'l', 0, 'a', 0, 'y', 0, 'b', 0, 'a', 0, 'c', 0, 'k', 0, ' ', 0, \ 85 'i', 0, 'n', 0, 't', 0, 'e', 0, 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0, 86 87 88/* make the real string descriptors */ 89 |
92USB_MAKE_STRING_DESC(STRING_LANG, string_lang); | |
93USB_MAKE_STRING_DESC(STRING_AUDIO_MIXER, string_audio_mixer); 94USB_MAKE_STRING_DESC(STRING_AUDIO_RECORD, string_audio_record); 95USB_MAKE_STRING_DESC(STRING_AUDIO_PLAYBACK, string_audio_playback); 96USB_MAKE_STRING_DESC(STRING_AUDIO_PRODUCT, string_audio_product); 97 98/* prototypes */ 99 100/* --- 281 unchanged lines hidden (view full) --- 382 * Return values: 383 * NULL: Failure. No such string. 384 * Else: Success. Pointer to string descriptor is returned. 385 *------------------------------------------------------------------------*/ 386static const void * 387audio_get_string_desc(uint16_t lang_id, uint8_t string_index) 388{ 389 static const void *ptr[INDEX_AUDIO_MAX] = { | 90USB_MAKE_STRING_DESC(STRING_AUDIO_MIXER, string_audio_mixer); 91USB_MAKE_STRING_DESC(STRING_AUDIO_RECORD, string_audio_record); 92USB_MAKE_STRING_DESC(STRING_AUDIO_PLAYBACK, string_audio_playback); 93USB_MAKE_STRING_DESC(STRING_AUDIO_PRODUCT, string_audio_product); 94 95/* prototypes */ 96 97/* --- 281 unchanged lines hidden (view full) --- 379 * Return values: 380 * NULL: Failure. No such string. 381 * Else: Success. Pointer to string descriptor is returned. 382 *------------------------------------------------------------------------*/ 383static const void * 384audio_get_string_desc(uint16_t lang_id, uint8_t string_index) 385{ 386 static const void *ptr[INDEX_AUDIO_MAX] = { |
390 [INDEX_AUDIO_LANG] = &string_lang, | 387 [INDEX_AUDIO_LANG] = &usb_string_lang_en, |
391 [INDEX_AUDIO_MIXER] = &string_audio_mixer, 392 [INDEX_AUDIO_RECORD] = &string_audio_record, 393 [INDEX_AUDIO_PLAYBACK] = &string_audio_playback, 394 [INDEX_AUDIO_PRODUCT] = &string_audio_product, 395 }; 396 397 if (string_index == 0) { | 388 [INDEX_AUDIO_MIXER] = &string_audio_mixer, 389 [INDEX_AUDIO_RECORD] = &string_audio_record, 390 [INDEX_AUDIO_PLAYBACK] = &string_audio_playback, 391 [INDEX_AUDIO_PRODUCT] = &string_audio_product, 392 }; 393 394 if (string_index == 0) { |
398 return (&string_lang); | 395 return (&usb_string_lang_en); |
399 } 400 if (lang_id != 0x0409) { 401 return (NULL); 402 } 403 if (string_index < INDEX_AUDIO_MAX) { 404 return (ptr[string_index]); 405 } 406 return (NULL); 407} | 396 } 397 if (lang_id != 0x0409) { 398 return (NULL); 399 } 400 if (string_index < INDEX_AUDIO_MAX) { 401 return (ptr[string_index]); 402 } 403 return (NULL); 404} |