Changeset 904b1bc in mainline for uspace/lib/hound/src/protocol.c
- Timestamp:
- 2018-05-22T10:36:58Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- a4eb3ba2
- Parents:
- 4f8772d4
- git-author:
- Jiri Svoboda <jiri@…> (2018-05-21 17:36:30)
- git-committer:
- Jiri Svoboda <jiri@…> (2018-05-22 10:36:58)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/hound/src/protocol.c
r4f8772d4 r904b1bc 79 79 80 80 81 /* ***81 /* 82 82 * CLIENT 83 * ***/83 */ 84 84 85 85 /** Well defined service name */ … … 309 309 int flags, pcm_format_t format, size_t bsize) 310 310 { 311 const format_convert_t c = { .f = { 312 .channels = format.channels, 313 .rate = format.sampling_rate / 100, 314 .format = format.sample_format, 315 }}; 311 const format_convert_t c = { 312 .f = { 313 .channels = format.channels, 314 .rate = format.sampling_rate / 100, 315 .format = format.sample_format, 316 } 317 }; 318 316 319 return async_req_4_0(exch, IPC_M_HOUND_STREAM_ENTER, CAP_HANDLE_RAW(id), 317 320 flags, c.arg, bsize); … … 362 365 } 363 366 364 /* ***367 /* 365 368 * SERVER 366 * ***/369 */ 367 370 368 371 static void hound_server_read_data(void *stream); … … 463 466 if (conn) 464 467 ret = async_data_write_accept( 465 (void **)&conn_name, true, 0, 0, 0, 0);468 (void **)&conn_name, true, 0, 0, 0, 0); 466 469 467 470 if (ret == EOK) … … 559 562 case IPC_M_HOUND_STREAM_ENTER: 560 563 /* check interface functions */ 561 if (!server_iface || !server_iface->is_record_context 562 || !server_iface->add_stream563 ||!server_iface->rem_stream) {564 if (!server_iface || !server_iface->is_record_context || 565 !server_iface->add_stream || 566 !server_iface->rem_stream) { 564 567 async_answer_0(chandle, ENOTSUP); 565 568 break; … … 569 572 id = (cap_handle_t) IPC_GET_ARG1(call); 570 573 flags = IPC_GET_ARG2(call); 571 const format_convert_t c = { .arg = IPC_GET_ARG3(call)};574 const format_convert_t c = { .arg = IPC_GET_ARG3(call) }; 572 575 const pcm_format_t f = { 573 574 575 576 .sampling_rate = c.f.rate * 100, 577 .channels = c.f.channels, 578 .sample_format = c.f.format, 576 579 }; 577 580 size_t bsize = IPC_GET_ARG4(call); … … 587 590 server_iface->server, id); 588 591 if (rec) { 589 if (server_iface->stream_data_read) {592 if (server_iface->stream_data_read) { 590 593 async_answer_0(chandle, EOK); 591 594 /* start answering read calls */ … … 631 634 errno_t ret_answer = EOK; 632 635 /* accept data write or drain */ 633 while (async_data_write_receive_call(&chandle, &call, &size) 634 ||(IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN)) {636 while (async_data_write_receive_call(&chandle, &call, &size) || 637 (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN)) { 635 638 /* check drain first */ 636 639 if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) { … … 660 663 } 661 664 } 662 const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT 663 ?EOK : EINVAL;665 const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT ? 666 EOK : EINVAL; 664 667 665 668 async_answer_0(chandle, ret); … … 678 681 errno_t ret_answer = EOK; 679 682 /* accept data read and drain */ 680 while (async_data_read_receive_call(&chandle, &call, &size) 681 ||(IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN)) {683 while (async_data_read_receive_call(&chandle, &call, &size) || 684 (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN)) { 682 685 /* drain does not make much sense but it is allowed */ 683 686 if (IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_DRAIN) { … … 704 707 } 705 708 } 706 const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT 707 ?EOK : EINVAL;709 const errno_t ret = IPC_GET_IMETHOD(call) == IPC_M_HOUND_STREAM_EXIT ? 710 EOK : EINVAL; 708 711 709 712 async_answer_0(chandle, ret); … … 711 714 712 715 713 /* **716 /* 714 717 * SERVER SIDE 715 * **/718 */ 716 719 717 720 /**
Note:
See TracChangeset
for help on using the changeset viewer.