Changeset e172429 in mainline


Ignore:
Timestamp:
2017-12-08T21:03:35Z (6 years ago)
Author:
Jiří Zárevúcky <zarevucky.jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
86bbca4
Parents:
a99cbc1e
git-author:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 02:50:42)
git-committer:
Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:03:35)
Message:

Let audio_pcm_query_cap() return value separately from error code.

Location:
uspace
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/wavplay/dplay.c

    ra99cbc1e re172429  
    345345        }
    346346        printf("Playing on device: %s.\n", device);
    347         if (audio_pcm_query_cap(session, AUDIO_CAP_PLAYBACK) <= 0) {
     347        sysarg_t val;
     348        ret = audio_pcm_query_cap(session, AUDIO_CAP_PLAYBACK, &val);
     349        if (ret != EOK || !val) {
    348350                printf("Device %s does not support playback\n", device);
    349351                ret = ENOTSUP;
     
    386388                goto cleanup;
    387389        }
    388         if (audio_pcm_query_cap(pb.device, AUDIO_CAP_BUFFER_POS) > 0) {
     390        ret = audio_pcm_query_cap(pb.device, AUDIO_CAP_BUFFER_POS, &val);
     391        if (ret == EOK && val) {
    389392                play(&pb);
    390393        } else {
    391                 if (audio_pcm_query_cap(pb.device, AUDIO_CAP_INTERRUPT) > 0)
     394                ret = audio_pcm_query_cap(pb.device, AUDIO_CAP_INTERRUPT, &val);
     395                if (ret == EOK && val)
    392396                        play_fragment(&pb);
    393397                else
  • uspace/app/wavplay/drec.c

    ra99cbc1e re172429  
    176176        int ret = EOK;
    177177        audio_pcm_sess_t *session = NULL;
     178        sysarg_t val;
    178179        if (str_cmp(device, "default") == 0) {
    179180                session = audio_pcm_open_default();
     
    186187        }
    187188        printf("Recording on device: %s.\n", device);
    188         if (audio_pcm_query_cap(session, AUDIO_CAP_CAPTURE) <= 0) {
     189        ret = audio_pcm_query_cap(session, AUDIO_CAP_CAPTURE, &val);
     190        if (ret != EOK || !val) {
    189191                printf("Device %s does not support recording\n", device);
    190192                ret = ENOTSUP;
     
    225227                goto cleanup;
    226228        }
    227         if (audio_pcm_query_cap(rec.device, AUDIO_CAP_INTERRUPT) > 0)
     229        ret = audio_pcm_query_cap(rec.device, AUDIO_CAP_INTERRUPT, &val);
     230        if (ret == EOK && val)
    228231                record_fragment(&rec, format);
    229232        else
  • uspace/lib/drv/generic/remote_audio_pcm.c

    ra99cbc1e re172429  
    221221 * @param sess Audio device session.
    222222 * @param cap  Audio device capability.
    223  * @param val  Place to store queried value.
    224  *
    225  * @return Error code.
    226  */
    227 int audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap)
    228 {
    229         async_exch_t *exch = async_exchange_begin(sess);
    230         sysarg_t value = 0;
     223 * @param[out] val  Place to store queried value.
     224 *
     225 * @return Error code.
     226 */
     227int audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap, sysarg_t *value)
     228{
     229        async_exch_t *exch = async_exchange_begin(sess);
    231230        const int ret = async_req_2_1(exch,
    232231            DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_QUERY_CAPS,
    233             cap, &value);
    234         async_exchange_end(exch);
    235         if (ret == EOK)
    236                 return value;
     232            cap, value);
     233        async_exchange_end(exch);
    237234        return ret;
    238235}
  • uspace/lib/drv/include/audio_pcm_iface.h

    ra99cbc1e re172429  
    8383int audio_pcm_test_format(audio_pcm_sess_t *, unsigned *, unsigned *,
    8484    pcm_sample_format_t *);
    85 int audio_pcm_query_cap(audio_pcm_sess_t *, audio_cap_t);
     85int audio_pcm_query_cap(audio_pcm_sess_t *, audio_cap_t, sysarg_t *);
    8686int audio_pcm_register_event_callback(audio_pcm_sess_t *,
    8787    async_port_handler_t, void *);
  • uspace/srv/audio/hound/audio_device.c

    ra99cbc1e re172429  
    121121{
    122122        assert(dev);
    123         if (audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE))
     123        sysarg_t val;
     124        int rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE, &val);
     125        if (rc == EOK && val)
    124126                return &dev->source;
    125127        return NULL;
     
    135137{
    136138        assert(dev);
    137         if (audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK))
     139        sysarg_t val;
     140        int rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK, &val);
     141        if (rc == EOK && val)
    138142                return &dev->sink;
    139143        return NULL;
Note: See TracChangeset for help on using the changeset viewer.