- mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize);
- if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
- oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",
- req->nfrags, req->fragsize);
- goto err;
+ if (ioctl (fd, OSS_GETVERSION, &version)) {
+ oss_logerr2 (errno, typ, "Failed to get OSS version\n");
+ version = 0;
+ }
+
+ if (conf.debug) {
+ dolog ("OSS version = %#x\n", version);
+ }
+
+#ifdef SNDCTL_DSP_POLICY
+ if (conf.policy >= 0 && version >= 0x040000) {
+ int policy = conf.policy;
+ if (ioctl (fd, SNDCTL_DSP_POLICY, &policy)) {
+ oss_logerr2 (errno, typ, "Failed to set timing policy to %d\n",
+ conf.policy);
+ goto err;
+ }
+ }
+ else
+#endif
+ {
+ int mmmmssss = (req->nfrags << 16) | ctz32 (req->fragsize);
+ if (ioctl (fd, SNDCTL_DSP_SETFRAGMENT, &mmmmssss)) {
+ oss_logerr2 (errno, typ, "Failed to set buffer length (%d, %d)\n",
+ req->nfrags, req->fragsize);
+ goto err;
+ }