Revision 72ff25e4 audio/ossaudio.c
b/audio/ossaudio.c | ||
---|---|---|
240 | 240 |
} |
241 | 241 |
#endif |
242 | 242 |
|
243 |
#ifdef USE_DSP_POLICY |
|
244 |
static int oss_get_version (int fd, int *version, const char *typ) |
|
245 |
{ |
|
246 |
if (ioctl (fd, OSS_GETVERSION, &version)) { |
|
247 |
#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) |
|
248 |
/* |
|
249 |
* Looks like atm (20100109) FreeBSD knows OSS_GETVERSION |
|
250 |
* since 7.x, but currently only on the mixer device (or in |
|
251 |
* the Linuxolator), and in the native version that part of |
|
252 |
* the code is in fact never reached so the ioctl fails anyway. |
|
253 |
* Until this is fixed, just check the errno and if its what |
|
254 |
* FreeBSD's sound drivers return atm assume they are new enough. |
|
255 |
*/ |
|
256 |
if (errno == EINVAL) { |
|
257 |
*version = 0x040000; |
|
258 |
return 0; |
|
259 |
} |
|
260 |
#endif |
|
261 |
oss_logerr2 (errno, typ, "Failed to get OSS version\n"); |
|
262 |
return -1; |
|
263 |
} |
|
264 |
return 0; |
|
265 |
} |
|
266 |
#endif |
|
267 |
|
|
243 | 268 |
static int oss_open (int in, struct oss_params *req, |
244 | 269 |
struct oss_params *obt, int *pfd) |
245 | 270 |
{ |
... | ... | |
289 | 314 |
if (conf.policy >= 0) { |
290 | 315 |
int version; |
291 | 316 |
|
292 |
if (ioctl (fd, OSS_GETVERSION, &version)) { |
|
293 |
oss_logerr2 (errno, typ, "Failed to get OSS version\n"); |
|
294 |
} |
|
295 |
else { |
|
317 |
if (!oss_get_version (fd, &version, typ)) { |
|
296 | 318 |
if (conf.debug) { |
297 | 319 |
dolog ("OSS version = %#x\n", version); |
298 | 320 |
} |
Also available in: Unified diff