Lines Matching refs:err
55 int err; in snd_config_integer_add() local
57 err = snd_config_imake_integer(&leaf, id, integer); in snd_config_integer_add()
58 if (err < 0) in snd_config_integer_add()
59 return err; in snd_config_integer_add()
60 err = snd_config_add(father, leaf); in snd_config_integer_add()
61 if (err < 0) { in snd_config_integer_add()
63 return err; in snd_config_integer_add()
70 int err; in snd_config_integer64_add() local
72 err = snd_config_imake_integer64(&leaf, id, integer); in snd_config_integer64_add()
73 if (err < 0) in snd_config_integer64_add()
74 return err; in snd_config_integer64_add()
75 err = snd_config_add(father, leaf); in snd_config_integer64_add()
76 if (err < 0) { in snd_config_integer64_add()
78 return err; in snd_config_integer64_add()
85 int err; in snd_config_string_add() local
87 err = snd_config_imake_string(&leaf, id, string); in snd_config_string_add()
88 if (err < 0) in snd_config_string_add()
89 return err; in snd_config_string_add()
90 err = snd_config_add(father, leaf); in snd_config_string_add()
91 if (err < 0) { in snd_config_string_add()
93 return err; in snd_config_string_add()
101 int err; in snd_config_compound_add() local
103 err = snd_config_make_compound(&leaf, id, join); in snd_config_compound_add()
104 if (err < 0) in snd_config_compound_add()
105 return err; in snd_config_compound_add()
106 err = snd_config_add(father, leaf); in snd_config_compound_add()
107 if (err < 0) { in snd_config_compound_add()
109 return err; in snd_config_compound_add()
175 int err; in add_tlv_comments() local
183 err = snd_config_string_add(comment, "tlv", s); in add_tlv_comments()
185 if (err < 0) { in add_tlv_comments()
186 error("snd_config_string_add: %s", snd_strerror(err)); in add_tlv_comments()
187 return err; in add_tlv_comments()
192 err = snd_tlv_parse_dB_info(tlv, sizeof(tlv), &db); in add_tlv_comments()
193 if (err <= 0) in add_tlv_comments()
199 if (err < 0) in add_tlv_comments()
200 return err; in add_tlv_comments()
205 err = snd_config_compound_add(comment, "dbvalue", 1, &value); in add_tlv_comments()
206 if (err < 0) { in add_tlv_comments()
207 error("snd_config_compound_add: %s", snd_strerror(err)); in add_tlv_comments()
208 return err; in add_tlv_comments()
212 err = snd_tlv_convert_to_dB(db, rangemin, rangemax, in add_tlv_comments()
214 if (err < 0) { in add_tlv_comments()
215 error("snd_tlv_convert_to_dB: %s", snd_strerror(err)); in add_tlv_comments()
216 return err; in add_tlv_comments()
218 err = snd_config_integer_add(value, num_str(i), dbgain); in add_tlv_comments()
219 if (err < 0) { in add_tlv_comments()
220 error("snd_config_integer_add: %s", snd_strerror(err)); in add_tlv_comments()
221 return err; in add_tlv_comments()
236 int err; in get_control() local
244 err = snd_ctl_elem_info(handle, info); in get_control()
245 if (err < 0) { in get_control()
246 error("Cannot read control info '%s': %s", id_str(id), snd_strerror(err)); in get_control()
247 return err; in get_control()
253 err = snd_ctl_elem_read(handle, ctl); in get_control()
254 if (err < 0) { in get_control()
255 error("Cannot read control '%s': %s", id_str(id), snd_strerror(err)); in get_control()
256 return err; in get_control()
259 err = snd_config_compound_add(top, num_str(snd_ctl_elem_info_get_numid(info)), 0, &control); in get_control()
260 if (err < 0) { in get_control()
261 error("snd_config_compound_add: %s", snd_strerror(err)); in get_control()
262 return err; in get_control()
264 err = snd_config_make_compound(&comment, "comment", 0); in get_control()
265 if (err < 0) { in get_control()
266 error("snd_config_make_compound: %s", snd_strerror(err)); in get_control()
267 return err; in get_control()
284 err = snd_config_string_add(comment, "access", buf + 1); in get_control()
285 if (err < 0) { in get_control()
286 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
287 return err; in get_control()
297 err = snd_config_string_add(comment, "type", s); in get_control()
298 if (err < 0) { in get_control()
299 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
300 return err; in get_control()
302 err = snd_config_integer_add(comment, "count", count); in get_control()
303 if (err < 0) { in get_control()
304 error("snd_config_integer_add: %s", snd_strerror(err)); in get_control()
305 return err; in get_control()
320 err = snd_config_string_add(comment, "range", buf); in get_control()
321 if (err < 0) { in get_control()
322 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
323 return err; in get_control()
326 err = add_tlv_comments(handle, id, info, ctl, comment); in get_control()
327 if (err < 0) in get_control()
328 return err; in get_control()
341 err = snd_config_string_add(comment, "range", buf); in get_control()
342 if (err < 0) { in get_control()
343 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
344 return err; in get_control()
351 err = snd_config_compound_add(comment, "item", 1, &item); in get_control()
352 if (err < 0) { in get_control()
353 error("snd_config_compound_add: %s", snd_strerror(err)); in get_control()
354 return err; in get_control()
359 err = snd_ctl_elem_info(handle, info); in get_control()
360 if (err < 0) { in get_control()
361 error("snd_ctl_card_info: %s", snd_strerror(err)); in get_control()
362 return err; in get_control()
364 err = snd_config_string_add(item, num_str(idx), snd_ctl_elem_info_get_item_name(info)); in get_control()
365 if (err < 0) { in get_control()
366 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
367 return err; in get_control()
376 err = snd_config_string_add(control, "iface", s); in get_control()
377 if (err < 0) { in get_control()
378 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
379 return err; in get_control()
382 err = snd_config_integer_add(control, "device", device); in get_control()
383 if (err < 0) { in get_control()
384 error("snd_config_integer_add: %s", snd_strerror(err)); in get_control()
385 return err; in get_control()
389 err = snd_config_integer_add(control, "subdevice", subdevice); in get_control()
390 if (err < 0) { in get_control()
391 error("snd_config_integer_add: %s", snd_strerror(err)); in get_control()
392 return err; in get_control()
395 err = snd_config_string_add(control, "name", name); in get_control()
396 if (err < 0) { in get_control()
397 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
398 return err; in get_control()
401 err = snd_config_integer_add(control, "index", index); in get_control()
402 if (err < 0) { in get_control()
403 error("snd_config_integer_add: %s", snd_strerror(err)); in get_control()
404 return err; in get_control()
425 err = snd_config_string_add(control, "value", buf); in get_control()
426 if (err < 0) { in get_control()
427 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
428 return err; in get_control()
439 …err = snd_config_string_add(control, "value", snd_ctl_elem_value_get_boolean(ctl, 0) ? "true" : "f… in get_control()
440 if (err < 0) { in get_control()
441 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
442 return err; in get_control()
446 err = snd_config_integer_add(control, "value", snd_ctl_elem_value_get_integer(ctl, 0)); in get_control()
447 if (err < 0) { in get_control()
448 error("snd_config_integer_add: %s", snd_strerror(err)); in get_control()
449 return err; in get_control()
453 err = snd_config_integer64_add(control, "value", snd_ctl_elem_value_get_integer64(ctl, 0)); in get_control()
454 if (err < 0) { in get_control()
455 error("snd_config_integer64_add: %s", snd_strerror(err)); in get_control()
456 return err; in get_control()
463 err = snd_config_search(item, num_str(v), &c); in get_control()
464 if (err == 0) { in get_control()
465 err = snd_config_get_string(c, &s); in get_control()
466 assert(err == 0); in get_control()
467 err = snd_config_string_add(control, "value", s); in get_control()
469 err = snd_config_integer_add(control, "value", v); in get_control()
471 if (err < 0) in get_control()
472 error("snd_config add: %s", snd_strerror(err)); in get_control()
481 err = snd_config_compound_add(control, "value", 1, &value); in get_control()
482 if (err < 0) { in get_control()
483 error("snd_config_compound_add: %s", snd_strerror(err)); in get_control()
484 return err; in get_control()
490 …err = snd_config_string_add(value, num_str(idx), snd_ctl_elem_value_get_boolean(ctl, idx) ? "true"… in get_control()
491 if (err < 0) { in get_control()
492 error("snd_config_string_add: %s", snd_strerror(err)); in get_control()
493 return err; in get_control()
499 err = snd_config_integer_add(value, num_str(idx), snd_ctl_elem_value_get_integer(ctl, idx)); in get_control()
500 if (err < 0) { in get_control()
501 error("snd_config_integer_add: %s", snd_strerror(err)); in get_control()
502 return err; in get_control()
508 err = snd_config_integer64_add(value, num_str(idx), snd_ctl_elem_value_get_integer64(ctl, idx)); in get_control()
509 if (err < 0) { in get_control()
510 error("snd_config_integer64_add: %s", snd_strerror(err)); in get_control()
511 return err; in get_control()
519 err = snd_config_search(item, num_str(v), &c); in get_control()
520 if (err == 0) { in get_control()
521 err = snd_config_get_string(c, &s); in get_control()
522 assert(err == 0); in get_control()
523 err = snd_config_string_add(value, num_str(idx), s); in get_control()
525 err = snd_config_integer_add(value, num_str(idx), v); in get_control()
527 if (err < 0) { in get_control()
528 error("snd_config add: %s", snd_strerror(err)); in get_control()
529 return err; in get_control()
539 err = snd_config_add(control, comment); in get_control()
540 if (err < 0) { in get_control()
541 error("snd_config_add: %s", snd_strerror(err)); in get_control()
542 return err; in get_control()
555 int err; in get_controls() local
564 err = snd_ctl_open(&handle, name, SND_CTL_READONLY); in get_controls()
565 if (err < 0) { in get_controls()
566 error("snd_ctl_open error: %s", snd_strerror(err)); in get_controls()
567 return err; in get_controls()
569 err = snd_ctl_card_info(handle, info); in get_controls()
570 if (err < 0) { in get_controls()
571 error("snd_ctl_card_info error: %s", snd_strerror(err)); in get_controls()
575 err = snd_config_search(top, "state", &state); in get_controls()
576 if (err == 0 && in get_controls()
579 err = -EINVAL; in get_controls()
582 if (err < 0) { in get_controls()
583 err = snd_config_compound_add(top, "state", 1, &state); in get_controls()
584 if (err < 0) { in get_controls()
585 error("snd_config_compound_add: %s", snd_strerror(err)); in get_controls()
589 err = snd_config_search(state, id, &card); in get_controls()
590 if (err == 0 && in get_controls()
593 err = -EINVAL; in get_controls()
596 if (err < 0) { in get_controls()
597 err = snd_config_compound_add(state, id, 0, &card); in get_controls()
598 if (err < 0) { in get_controls()
599 error("snd_config_compound_add: %s", snd_strerror(err)); in get_controls()
603 err = snd_config_search(card, "control", &control); in get_controls()
604 if (err == 0) { in get_controls()
605 err = snd_config_delete(control); in get_controls()
606 if (err < 0) { in get_controls()
607 error("snd_config_delete: %s", snd_strerror(err)); in get_controls()
611 err = snd_ctl_elem_list(handle, list); in get_controls()
612 if (err < 0) { in get_controls()
613 error("Cannot determine controls: %s", snd_strerror(err)); in get_controls()
617 err = snd_config_compound_add(card, "control", count > 0, &control); in get_controls()
618 if (err < 0) { in get_controls()
619 error("snd_config_compound_add: %s", snd_strerror(err)); in get_controls()
623 err = 0; in get_controls()
631 if ((err = snd_ctl_elem_list(handle, list)) < 0) { in get_controls()
632 error("Cannot determine controls (2): %s", snd_strerror(err)); in get_controls()
637 err = get_control(handle, elem_id, control); in get_controls()
638 if (err < 0) in get_controls()
642 err = 0; in get_controls()
647 return err; in get_controls()
748 int err; in config_enumerated() local
750 err = snd_ctl_elem_info(handle, info); in config_enumerated()
751 if (err < 0) { in config_enumerated()
752 error("snd_ctl_elem_info: %s", snd_strerror(err)); in config_enumerated()
753 return err; in config_enumerated()
763 int err = snd_config_get_integer(n, val); in config_integer() local
764 if (err < 0 && force_restore && doit) { in config_integer()
766 return err; in config_integer()
770 return err; in config_integer()
775 int err = snd_config_get_integer64(n, val); in config_integer64() local
776 if (err < 0 && force_restore && doit) { in config_integer64()
778 return err; in config_integer64()
782 return err; in config_integer64()
835 int err; in get_comment_range() local
841 err = sscanf(s, "%li - %li (step %li)", imin, imax, istep); in get_comment_range()
842 if (err != 3) { in get_comment_range()
844 err = sscanf(s, "%li - %li", imin, imax); in get_comment_range()
845 if (err != 2) in get_comment_range()
864 int err; in get_comment_items() local
886 err = snd_config_get_string(item, &items->strings[numid]); in get_comment_items()
887 if (err < 0) in get_comment_items()
888 return err; in get_comment_items()
906 int err; in add_user_control() local
921 err = get_comment_type(n); in add_user_control()
922 if (err < 0) in add_user_control()
924 ctype = err; in add_user_control()
928 err = get_comment_range(n, ctype, &imin, &imax, &istep); in add_user_control()
929 if (err < 0) in add_user_control()
935 if ((err = snd_config_get_integer(n, &v)) < 0) in add_user_control()
941 err = get_comment_items(n, &enum_items); in add_user_control()
942 if (err < 0) in add_user_control()
948 if ((err = snd_config_get_string(n, &s)) < 0) in add_user_control()
953 err = -EINVAL; in add_user_control()
967 err = -EINVAL; in add_user_control()
970 err = snd_ctl_elem_add_integer(handle, id, count, imin, imax, istep); in add_user_control()
971 if (err < 0) in add_user_control()
977 err = snd_ctl_elem_add_boolean(handle, id, count); in add_user_control()
980 err = snd_ctl_elem_add_enumerated(handle, id, count, in add_user_control()
984 err = snd_ctl_elem_add_iec958(handle, id); in add_user_control()
987 err = -EINVAL; in add_user_control()
994 if (err < 0) in add_user_control()
995 return err; in add_user_control()
1036 int err; in convert_to_new_db() local
1040 err = config_integer(value, &val, doit); in convert_to_new_db()
1041 if (err < 0) in convert_to_new_db()
1042 return err; in convert_to_new_db()
1048 err = snd_ctl_convert_from_dB(device, id, db, &val, db > 0); in convert_to_new_db()
1049 if (err < 0) in convert_to_new_db()
1050 return err; in convert_to_new_db()
1136 int err; in restore_config_value() local
1147 err = config_integer(value, &val, doit); in restore_config_value()
1148 if (err == 0) { in restore_config_value()
1154 err = config_integer64(value, &lval, doit); in restore_config_value()
1155 if (err == 0) { in restore_config_value()
1183 int err = restore_config_value(handle, info, type, value, ctl, idx, doit); in restore_config_value2() local
1186 if (err != 0) in restore_config_value2()
1187 return err; in restore_config_value2()
1191 err = snd_config_get_integer(value, &val); in restore_config_value2()
1192 if (err < 0 || val < 0 || val > 255) { in restore_config_value2()
1227 int err; in set_control() local
1236 err = snd_config_get_id(control, &id); in set_control()
1237 if (err < 0) { in set_control()
1316 err = -EINVAL; in set_control()
1319 err = snd_ctl_elem_info(handle, info); in set_control()
1321 if (err < 0 && name) { in set_control()
1328 err = snd_ctl_elem_info(handle, info); in set_control()
1329 if (err < 0 && comment && check_comment_access(comment, "user")) { in set_control()
1330 err = add_user_control(handle, info, comment); in set_control()
1331 if (err < 0) { in set_control()
1333 numid, snd_strerror(err)); in set_control()
1334 return err; in set_control()
1338 if (err < 0) { in set_control()
1339 cerror(doit, "failed to obtain info for control #%d (%s)", numid, snd_strerror(err)); in set_control()
1350 if (err |= numid != numid1 && !force_restore) in set_control()
1353 if (err |= iface != iface1) in set_control()
1355 if (err |= device != device1) in set_control()
1357 if (err |= subdevice != subdevice1) in set_control()
1359 if (err |= strcmp(name, name1)) in set_control()
1361 if (err |= index != index1) in set_control()
1363 if (err < 0) { in set_control()
1364 cerror(doit, "failed to obtain info for control #%d (%s)", numid, snd_strerror(err)); in set_control()
1389 err = restore_config_value(handle, info, type, value, ctl, 0, doit); in set_control()
1390 if (err < 0) in set_control()
1391 return err; in set_control()
1392 if (err > 0) in set_control()
1400 err = snd_config_get_string(value, &buf); in set_control()
1401 if (err >= 0) { in set_control()
1435 err = restore_config_value2(handle, info, type, value, in set_control()
1437 if (err < 0) in set_control()
1438 return err; in set_control()
1457 err = restore_config_value2(handle, info, type, n, in set_control()
1459 if (err < 0) in set_control()
1460 return err; in set_control()
1461 if (err > 0) in set_control()
1473 err = doit ? snd_ctl_elem_write(handle, ctl) : 0; in set_control()
1474 if (err < 0) { in set_control()
1475 … control '%d:%ld:%ld:%s:%ld' : %s", (int)iface, device, subdevice, name, index, snd_strerror(err)); in set_control()
1476 return err; in set_control()
1490 int err, maxnumid = -1, maxnumid2 = -1; in set_controls() local
1500 err = snd_ctl_open(&handle, name, 0); in set_controls()
1501 if (err < 0) { in set_controls()
1502 error("snd_ctl_open error: %s", snd_strerror(err)); in set_controls()
1503 return err; in set_controls()
1505 err = snd_ctl_card_info(handle, info); in set_controls()
1506 if (err < 0) { in set_controls()
1507 error("snd_ctl_card_info error: %s", snd_strerror(err)); in set_controls()
1512 err = snd_config_searchv(top, &control, "state", id, "control", 0); in set_controls()
1513 if (err < 0) { in set_controls()
1516 err = snd_config_searchv(top, &control, "state", tmpid, "control", 0); in set_controls()
1517 if (! err) in set_controls()
1520 if (err < 0) { in set_controls()
1532 err = set_control(handle, n, &maxnumid, doit); in set_controls()
1533 if (err < 0 && (!force_restore || !doit)) in set_controls()
1540 err = snd_ctl_elem_list(handle, list); in set_controls()
1541 if (err < 0) { in set_controls()
1542 error("Cannot determine controls: %s", snd_strerror(err)); in set_controls()
1554 if ((err = snd_ctl_elem_list(handle, list)) < 0) { in set_controls()
1555 error("Cannot determine controls (2): %s", snd_strerror(err)); in set_controls()
1578 err = -EAGAIN; in set_controls()
1587 dbg("result code: %i", err); in set_controls()
1588 return err; in set_controls()
1593 int err; in save_state() local
1602 err = snd_config_top(&config); in save_state()
1603 if (err < 0) { in save_state()
1604 error("snd_config_top error: %s", snd_strerror(err)); in save_state()
1605 return err; in save_state()
1612 err = -ENOMEM; in save_state()
1619 err = lock_fd; in save_state()
1623 if (!stdio && (err = snd_input_stdio_open(&in, file, "r")) >= 0) { in save_state()
1624 err = snd_config_load(config, in); in save_state()
1627 if (err < 0) { in save_state()
1628 error("snd_config_load error: %s", snd_strerror(err)); in save_state()
1634 err = snd_card_iterator_sinit(&iter, cardname); in save_state()
1635 if (err < 0) in save_state()
1638 if ((err = get_controls(iter.card, config))) in save_state()
1642 err = snd_card_iterator_error(&iter); in save_state()
1647 err = snd_output_stdio_attach(&out, stdout, 0); in save_state()
1649 err = snd_output_stdio_open(&out, nfile, "w"); in save_state()
1651 if (err < 0) { in save_state()
1652 error("Cannot open %s for writing: %s", file, snd_strerror(err)); in save_state()
1653 err = -errno; in save_state()
1656 err = snd_config_save(config, out); in save_state()
1658 if (err < 0) { in save_state()
1659 error("snd_config_save: %s", snd_strerror(err)); in save_state()
1661 err = rename(nfile, file); in save_state()
1662 if (err < 0) in save_state()
1663 error("rename failed: %s (%s)", strerror(-err), file); in save_state()
1671 return err; in save_state()
1678 int err, finalerr = 0, open_failed; in load_state() local
1684 err = load_configuration(file, &config, &open_failed); in load_state()
1685 if (err < 0 && !open_failed) in load_state()
1686 return err; in load_state()
1689 error("Cannot open %s for reading: %s", file, snd_strerror(err)); in load_state()
1690 finalerr = err; in load_state()
1692 err = snd_card_iterator_sinit(&iter, cardname); in load_state()
1693 if (err < 0) in load_state()
1694 return err; in load_state()
1698 err = init(cfgdir, initfile, initflags | FLAG_UCM_FBOOT | FLAG_UCM_BOOT, cardname1); in load_state()
1699 if (err < 0) { in load_state()
1700 finalerr = err; in load_state()
1701 initfailed(iter.card, "init", err); in load_state()
1705 err = finalerr; in load_state()
1707 err = 0; /* no cards, no error code */ in load_state()
1711 err = snd_card_iterator_sinit(&iter, cardname); in load_state()
1712 if (err < 0) in load_state()
1719 err = init(cfgdir, initfile, initflags | FLAG_UCM_BOOT, cardname1); in load_state()
1720 if (err < 0) { in load_state()
1721 initfailed(iter.card, "init", err); in load_state()
1722 finalerr = err; in load_state()
1725 if ((err = set_controls(iter.card, config, 1))) { in load_state()
1727 finalerr = err; in load_state()
1728 initfailed(iter.card, "restore", err); in load_state()
1731 err = finalerr ? finalerr : snd_card_iterator_error(&iter); in load_state()
1736 return err; in load_state()