Changeset b5ba8f6 in mainline for uspace/app


Ignore:
Timestamp:
2013-09-13T13:11:53Z (12 years ago)
Author:
Maurizio Lombardi <m.lombardi85@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
1eaa3cf
Parents:
95027b5 (diff), 1c5f6f8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

merge mainline changes

Location:
uspace/app
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/sportdmp/sportdmp.c

    r95027b5 rb5ba8f6  
    4444        sysarg_t baud = 9600;
    4545        service_id_t svc_id;
    46        
     46
    4747        int arg = 1;
    4848        int rc;
    49                
     49
    5050        if (argc > arg && str_test_prefix(argv[arg], "--baud=")) {
    5151                size_t arg_offset = str_lsize(argv[arg], 7);
     
    6565                arg++;
    6666        }
    67        
     67
    6868        if (argc > arg) {
    6969                rc = loc_service_get_id(argv[arg], &svc_id, 0);
     
    7777        else {
    7878                category_id_t serial_cat_id;
    79                
     79
    8080                rc = loc_category_get_id("serial", &serial_cat_id, 0);
    8181                if (rc != EOK) {
     
    8484                        return 1;
    8585                }
    86                
     86
    8787                service_id_t *svc_ids;
    8888                size_t svc_count;
    89                
    90                 rc = loc_category_get_svcs(serial_cat_id, &svc_ids, &svc_count);                if (rc != EOK) {
     89
     90                rc = loc_category_get_svcs(serial_cat_id, &svc_ids, &svc_count);
     91                if (rc != EOK) {
    9192                        fprintf(stderr, "Failed getting list of services\n");
    9293                        return 1;
    9394                }
    94                
     95
    9596                if (svc_count == 0) {
    9697                        fprintf(stderr, "No service in category 'serial'\n");
     
    9899                        return 1;
    99100                }
    100                
     101
    101102                svc_id = svc_ids[0];
    102103                free(svc_ids);
    103104        }
    104        
     105
    105106        if (argc > arg) {
    106107                fprintf(stderr, "Too many arguments\n");
     
    108109                return 1;
    109110        }
    110        
    111        
     111
     112
    112113        async_sess_t *sess = loc_service_connect(EXCHANGE_SERIALIZE, svc_id,
    113114            IPC_FLAG_BLOCKING);
     
    115116                fprintf(stderr, "Failed connecting to service\n");
    116117        }
    117        
     118
    118119        async_exch_t *exch = async_exchange_begin(sess);
    119120        rc = async_req_4_0(exch, SERIAL_SET_COM_PROPS, baud,
    120121            SERIAL_NO_PARITY, 8, 1);
    121122        async_exchange_end(exch);
    122        
     123
    123124        if (rc != EOK) {
    124125                fprintf(stderr, "Failed setting serial properties\n");
    125126                return 2;
    126127        }
    127        
     128
    128129        uint8_t *buf = (uint8_t *) malloc(BUF_SIZE);
    129130        if (buf == NULL) {
     
    131132                return 3;
    132133        }
    133        
     134
    134135        while (true) {
    135136                ssize_t read = char_dev_read(sess, buf, BUF_SIZE);
     
    144145                fflush(stdout);
    145146        }
    146        
     147
    147148        free(buf);
    148149        return 0;
    149150}
     151
  • uspace/app/wavplay/dplay.c

    r95027b5 rb5ba8f6  
    151151            device_event_callback, pb);
    152152        if (ret != EOK) {
    153                 printf("Failed to register event callback.\n");
     153                printf("Failed to register event callback: %s.\n",
     154                    str_error(ret));
    154155                return;
    155156        }
     
    285286                            pb->f.sample_format);
    286287                        if (ret != EOK) {
    287                                 printf("Failed to start playback\n");
     288                                printf("Failed to start playback: %s\n",
     289                                    str_error(ret));
    288290                                return;
    289291                        }
     
    291293                        ret = audio_pcm_get_buffer_pos(pb->device, &pos);
    292294                        if (ret != EOK) {
    293                                 printf("Failed to update position indicator\n");
     295                                printf("Failed to update position indicator "
     296                                   "%s\n", str_error(ret));
    294297                        }
    295298                }
     
    308311                const int ret = audio_pcm_get_buffer_pos(pb->device, &pos);
    309312                if (ret != EOK) {
    310                         printf("Failed to update position indicator\n");
     313                        printf("Failed to update position indicator %s\n",
     314                            str_error(ret));
    311315                }
    312316                getuptime(&time);
     
    350354        ret = audio_pcm_get_info_str(session, &info);
    351355        if (ret != EOK) {
    352                 printf("Failed to get PCM info.\n");
     356                printf("Failed to get PCM info: %s.\n", str_error(ret));
    353357                goto close_session;
    354358        }
  • uspace/app/wavplay/main.c

    r95027b5 rb5ba8f6  
    7979            &format.sampling_rate, &format.sample_format, &error);
    8080        if (ret != EOK) {
    81                 printf("Error parsing wav header: %s.\n", error);
     81                printf("Error parsing `%s' wav header: %s.\n", filename, error);
    8282                fclose(source);
    8383                return EINVAL;
    8484        }
     85
     86        printf("File `%s' format: %u channel(s), %uHz, %s.\n", filename,
     87            format.channels, format.sampling_rate,
     88            pcm_sample_format_str(format.sample_format));
    8589
    8690        /* Allocate buffer and create new context */
     
    136140            &format.sampling_rate, &format.sample_format, &error);
    137141        if (ret != EOK) {
    138                 printf("Error parsing wav header: %s.\n", error);
     142                printf("Error parsing `%s' wav header: %s.\n", filename, error);
    139143                fclose(source);
    140144                return EINVAL;
    141145        }
     146        printf("File `%s' format: %u channel(s), %uHz, %s.\n", filename,
     147            format.channels, format.sampling_rate,
     148            pcm_sample_format_str(format.sample_format));
    142149
    143150        /* Connect new playback context */
  • uspace/app/wavplay/wave.c

    r95027b5 rb5ba8f6  
    8181        }
    8282
    83         if (uint16_t_le2host(header->subchunk1_size) != PCM_SUBCHUNK1_SIZE) {
     83        if (uint32_t_le2host(header->subchunk1_size) != PCM_SUBCHUNK1_SIZE) {
     84                //TODO subchunk 1 sizes other than 16 are allowed ( 18, 40)
     85                //http://www-mmsp.ece.mcgill.ca/documents/AudioFormats/WAVE/WAVE.html
    8486                if (error)
    8587                        *error = "invalid subchunk1 size";
    86                 return EINVAL;
     88//              return EINVAL;
    8789        }
    8890
     
    9496
    9597        if (str_lcmp(header->subchunk2_id, SUBCHUNK2_ID, 4) != 0) {
     98                //TODO basedd on subchunk1 size, we might be reading wrong
     99                //offset
    96100                if (error)
    97101                        *error = "invalid subchunk2 id";
    98                 return EINVAL;
     102//              return EINVAL;
    99103        }
    100104
    101105
     106        //TODO data and data_size are incorrect in extended wav formats
     107        //pcm params are OK
    102108        if (data)
    103109                *data = header->data;
Note: See TracChangeset for help on using the changeset viewer.