Skip to content

Commit 509387e

Browse files
committed
speaker-test fail at unknown op type
1 parent b4ad757 commit 509387e

File tree

1 file changed

+10
-22
lines changed

1 file changed

+10
-22
lines changed

virtio-snd.c

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -308,63 +308,51 @@ static void virtio_snd_read_pcm_set_params(struct virtq_desc *vq_desc,
308308
info->rate = (1 << VIRTIO_SND_PCM_RATE_44100);
309309
info->padding = 0;
310310
#endif
311-
fprintf(stderr, "virtio_snd_read_pcm_set_params");
311+
fprintf(stderr, "virtio_snd_read_pcm_set_params\n");
312312
}
313313

314314
static void virtio_snd_read_pcm_prepare(struct virtq_desc *vq_desc,
315315
const virtio_snd_query_info_t *query)
316316
{
317-
virtio_snd_pcm_hdr_t *hdr =
318-
(virtio_snd_pcm_hdr_t *) ((uintptr_t) vq_desc[2].addr);
319-
320317
/* TODO: let application to set stream_id at will */
321-
hdr->hdr.code = VIRTIO_SND_R_PCM_PREPARE;
322-
hdr->stream_id = 0;
323318

324319
/* Control the callback to prepare the buffer */
325320
/* TODO: add lock to avoid race condition */
326321
guest_playing = false;
322+
323+
fprintf(stderr, "virtio_snd_read_pcm_prepare\n");
327324
}
328325

329326
static void virtio_snd_read_pcm_start(struct virtq_desc *vq_desc,
330327
const virtio_snd_query_info_t *query)
331328
{
332-
virtio_snd_pcm_hdr_t *hdr =
333-
(virtio_snd_pcm_hdr_t *) ((uintptr_t) vq_desc[2].addr);
334-
335329
/* TODO: let application to set stream_id at will */
336-
hdr->hdr.code = VIRTIO_SND_R_PCM_START;
337-
hdr->stream_id = 0;
338330

339331
/* Control the callback to start playing */
340332
/* TODO: add lock to avoid race condition */
341333
guest_playing = true;
334+
335+
fprintf(stderr, "virtio_snd_read_pcm_start\n");
342336
}
343337

344338
static void virtio_snd_read_pcm_stop(struct virtq_desc *vq_desc,
345339
const virtio_snd_query_info_t *query)
346340
{
347-
virtio_snd_pcm_hdr_t *hdr =
348-
(virtio_snd_pcm_hdr_t *) ((uintptr_t) vq_desc[2].addr);
349-
350341
/* TODO: let application to set stream_id at will */
351-
hdr->hdr.code = VIRTIO_SND_R_PCM_STOP;
352-
hdr->stream_id = 0;
353342

354343
/* Control the callback to stop playing */
355344
/* TODO: add lock to avoid race condition */
356345
guest_playing = false;
346+
347+
fprintf(stderr, "virtio_snd_read_pcm_stop\n");
357348
}
358349

359350
static void virtio_snd_read_pcm_release(struct virtq_desc *vq_desc,
360351
const virtio_snd_query_info_t *query)
361352
{
362-
virtio_snd_pcm_hdr_t *hdr =
363-
(virtio_snd_pcm_hdr_t *) ((uintptr_t) vq_desc[2].addr);
364-
365353
/* TODO: let application to set stream_id at will */
366-
hdr->hdr.code = VIRTIO_SND_R_PCM_RELEASE;
367-
hdr->stream_id = 0;
354+
355+
fprintf(stderr, "virtio_snd_read_pcm_release\n");
368356
}
369357

370358
static void virtio_snd_cb(struct CNFADriver *dev,
@@ -466,7 +454,7 @@ static int virtio_snd_desc_handler(virtio_snd_state_t *vsnd,
466454
virtio_snd_read_pcm_stop(vq_desc, query);
467455
break;
468456
default:
469-
fprintf(stderr, "unsupported virtio-snd operation!\n");
457+
fprintf(stderr, "%d: unsupported virtio-snd operation!\n", type);
470458
response->code = VIRTIO_SND_S_NOT_SUPP;
471459
*plen = 0;
472460
return -1;

0 commit comments

Comments
 (0)