€•ÍNŒsphinx.addnodes”Œdocument”“”)”}”(Œ rawsource”Œ”Œchildren”]”(Œ translations”Œ LanguagesNode”“”)”}”(hhh]”(hŒ pending_xref”“”)”}”(hhh]”Œdocutils.nodes”ŒText”“”ŒChinese (Simplified)”…””}”Œparent”hsbaŒ attributes”}”(Œids”]”Œclasses”]”Œnames”]”Œdupnames”]”Œbackrefs”]”Œ refdomain”Œstd”Œreftype”Œdoc”Œ reftarget”Œ'/translations/zh_CN/sound/cards/pcmtest”Œmodname”NŒ classname”NŒ refexplicit”ˆuŒtagname”hhh ubh)”}”(hhh]”hŒChinese (Traditional)”…””}”hh2sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/zh_TW/sound/cards/pcmtest”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒItalian”…””}”hhFsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/it_IT/sound/cards/pcmtest”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒJapanese”…””}”hhZsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ja_JP/sound/cards/pcmtest”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒKorean”…””}”hhnsbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/ko_KR/sound/cards/pcmtest”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒPortuguese (Brazilian)”…””}”hh‚sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/pt_BR/sound/cards/pcmtest”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubh)”}”(hhh]”hŒSpanish”…””}”hh–sbah}”(h]”h ]”h"]”h$]”h&]”Œ refdomain”h)Œreftype”h+Œ reftarget”Œ'/translations/sp_SP/sound/cards/pcmtest”Œmodname”NŒ classname”NŒ refexplicit”ˆuh1hhh ubeh}”(h]”h ]”h"]”h$]”h&]”Œcurrent_language”ŒEnglish”uh1h hhŒ _document”hŒsource”NŒline”NubhŒcomment”“”)”}”(hŒ SPDX-License-Identifier: GPL-2.0”h]”hŒ SPDX-License-Identifier: GPL-2.0”…””}”hh·sbah}”(h]”h ]”h"]”h$]”h&]”Œ xml:space”Œpreserve”uh1hµhhh²hh³ŒA/var/lib/git/docbuild/linux/Documentation/sound/cards/pcmtest.rst”h´KubhŒsection”“”)”}”(hhh]”(hŒtitle”“”)”}”(hŒThe Virtual PCM Test Driver”h]”hŒThe Virtual PCM Test Driver”…””}”(hhÏh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhÊh²hh³hÇh´KubhŒ paragraph”“”)”}”(hXThe Virtual PCM Test Driver emulates a generic PCM device, and can be used for testing/fuzzing of the userspace ALSA applications, as well as for testing/fuzzing of the PCM middle layer. Additionally, it can be used for simulating hard to reproduce problems with PCM devices.”h]”hXThe Virtual PCM Test Driver emulates a generic PCM device, and can be used for testing/fuzzing of the userspace ALSA applications, as well as for testing/fuzzing of the PCM middle layer. Additionally, it can be used for simulating hard to reproduce problems with PCM devices.”…””}”(hhßh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhhÊh²hubhÉ)”}”(hhh]”(hÎ)”}”(hŒWhat can this driver do?”h]”hŒWhat can this driver do?”…””}”(hhðh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhhíh²hh³hÇh´K ubhŒdefinition_list”“”)”}”(hhh]”hŒdefinition_list_item”“”)”}”(hŒûAt this moment the driver can do the following things: * Simulate both capture and playback processes * Generate random or pattern-based capturing data * Inject delays into the playback and capturing processes * Inject errors during the PCM callbacks ”h]”(hŒterm”“”)”}”(hŒ6At this moment the driver can do the following things:”h]”hŒ6At this moment the driver can do the following things:”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1j h³hÇh´KhjubhŒ definition”“”)”}”(hhh]”hŒ bullet_list”“”)”}”(hhh]”(hŒ list_item”“”)”}”(hŒ,Simulate both capture and playback processes”h]”hÞ)”}”(hj'h]”hŒ,Simulate both capture and playback processes”…””}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khj%ubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj ubj$)”}”(hŒ/Generate random or pattern-based capturing data”h]”hÞ)”}”(hj>h]”hŒ/Generate random or pattern-based capturing data”…””}”(hj@h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khj<ubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj ubj$)”}”(hŒ7Inject delays into the playback and capturing processes”h]”hÞ)”}”(hjUh]”hŒ7Inject delays into the playback and capturing processes”…””}”(hjWh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KhjSubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj ubj$)”}”(hŒ'Inject errors during the PCM callbacks ”h]”hÞ)”}”(hŒ&Inject errors during the PCM callbacks”h]”hŒ&Inject errors during the PCM callbacks”…””}”(hjnh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khjjubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj ubeh}”(h]”h ]”h"]”h$]”h&]”Œbullet”Œ*”uh1jh³hÇh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1jhjubeh}”(h]”h ]”h"]”h$]”h&]”uh1jh³hÇh´Khjubah}”(h]”h ]”h"]”h$]”h&]”uh1hþhhíh²hh³Nh´NubhÞ)”}”(hŒrIt supports up to 8 substreams and 4 channels. Also it supports both interleaved and non-interleaved access modes.”h]”hŒrIt supports up to 8 substreams and 4 channels. Also it supports both interleaved and non-interleaved access modes.”…””}”(hjœh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khhíh²hubhÞ)”}”(hXQAlso, this driver can check the playback stream for containing the predefined pattern, which is used in the corresponding selftest (alsa/pcmtest-test.sh) to check the PCM middle layer data transferring functionality. Additionally, this driver redefines the default RESET ioctl, and the selftest covers this PCM API functionality as well.”h]”hXQAlso, this driver can check the playback stream for containing the predefined pattern, which is used in the corresponding selftest (alsa/pcmtest-test.sh) to check the PCM middle layer data transferring functionality. Additionally, this driver redefines the default RESET ioctl, and the selftest covers this PCM API functionality as well.”…””}”(hjªh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khhíh²hubhÉ)”}”(hhh]”(hÎ)”}”(hŒ Configuration”h]”hŒ Configuration”…””}”(hj»h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj¸h²hh³hÇh´KubhÞ)”}”(hŒLThe driver has several parameters besides the common ALSA module parameters:”h]”hŒLThe driver has several parameters besides the common ALSA module parameters:”…””}”(hjÉh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Khj¸h²hubhŒ block_quote”“”)”}”(hŒ›* fill_mode (bool) - Buffer fill mode (see below) * inject_delay (int) * inject_hwpars_err (bool) * inject_prepare_err (bool) * inject_trigger_err (bool) ”h]”j)”}”(hhh]”(j$)”}”(hŒ/fill_mode (bool) - Buffer fill mode (see below)”h]”hÞ)”}”(hjâh]”hŒ/fill_mode (bool) - Buffer fill mode (see below)”…””}”(hjäh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K!hjàubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hjÝubj$)”}”(hŒinject_delay (int)”h]”hÞ)”}”(hjùh]”hŒinject_delay (int)”…””}”(hjûh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K"hj÷ubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hjÝubj$)”}”(hŒinject_hwpars_err (bool)”h]”hÞ)”}”(hjh]”hŒinject_hwpars_err (bool)”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K#hjubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hjÝubj$)”}”(hŒinject_prepare_err (bool)”h]”hÞ)”}”(hj'h]”hŒinject_prepare_err (bool)”…””}”(hj)h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K$hj%ubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hjÝubj$)”}”(hŒinject_trigger_err (bool) ”h]”hÞ)”}”(hŒinject_trigger_err (bool)”h]”hŒinject_trigger_err (bool)”…””}”(hj@h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K%hj<ubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hjÝubeh}”(h]”h ]”h"]”h$]”h&]”jˆj‰uh1jh³hÇh´K!hjÙubah}”(h]”h ]”h"]”h$]”h&]”uh1j×h³hÇh´K!hj¸h²hubeh}”(h]”Œ configuration”ah ]”h"]”Œ configuration”ah$]”h&]”uh1hÈhhíh²hh³hÇh´KubhÉ)”}”(hhh]”(hÎ)”}”(hŒCapture Data Generation”h]”hŒCapture Data Generation”…””}”(hjkh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhjhh²hh³hÇh´K)ubhÞ)”}”(hŒÓThe driver has two modes of data generation: the first (0 in the fill_mode parameter) means random data generation, the second (1 in the fill_mode) - pattern-based data generation. Let's look at the second mode.”h]”hŒÕThe driver has two modes of data generation: the first (0 in the fill_mode parameter) means random data generation, the second (1 in the fill_mode) - pattern-based data generation. Let’s look at the second mode.”…””}”(hjyh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K+hjhh²hubhÞ)”}”(hŒ÷First of all, you may want to specify the pattern for data generation. You can do it by writing the pattern to the debugfs file. There are pattern buffer debugfs entries for each channel, as well as entries which contain the pattern buffer length.”h]”hŒ÷First of all, you may want to specify the pattern for data generation. You can do it by writing the pattern to the debugfs file. There are pattern buffer debugfs entries for each channel, as well as entries which contain the pattern buffer length.”…””}”(hj‡h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K/hjhh²hubjØ)”}”(hŒ`* /sys/kernel/debug/pcmtest/fill_pattern[0-3] * /sys/kernel/debug/pcmtest/fill_pattern[0-3]_len ”h]”j)”}”(hhh]”(j$)”}”(hŒ+/sys/kernel/debug/pcmtest/fill_pattern[0-3]”h]”hÞ)”}”(hjžh]”hŒ+/sys/kernel/debug/pcmtest/fill_pattern[0-3]”…””}”(hj h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K3hjœubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj™ubj$)”}”(hŒ0/sys/kernel/debug/pcmtest/fill_pattern[0-3]_len ”h]”hÞ)”}”(hŒ//sys/kernel/debug/pcmtest/fill_pattern[0-3]_len”h]”hŒ//sys/kernel/debug/pcmtest/fill_pattern[0-3]_len”…””}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K4hj³ubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj™ubeh}”(h]”h ]”h"]”h$]”h&]”jˆj‰uh1jh³hÇh´K3hj•ubah}”(h]”h ]”h"]”h$]”h&]”uh1j×h³hÇh´K3hjhh²hubhÞ)”}”(hŒKTo set the pattern for the channel 0 you can execute the following command:”h]”hŒKTo set the pattern for the channel 0 you can execute the following command:”…””}”(hj×h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K6hjhh²hubhŒ literal_block”“”)”}”(hŒ?echo -n mycoolpattern > /sys/kernel/debug/pcmtest/fill_pattern0”h]”hŒ?echo -n mycoolpattern > /sys/kernel/debug/pcmtest/fill_pattern0”…””}”hjçsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆŒforce”‰Œlanguage”Œbash”Œhighlight_args”}”uh1jåh³hÇh´K8hjhh²hubhÞ)”}”(hŒœThen, after every capture action performed on the 'pcmtest' device the buffer for the channel 0 will contain 'mycoolpatternmycoolpatternmycoolpatternmy...'.”h]”hŒ¤Then, after every capture action performed on the ‘pcmtest’ device the buffer for the channel 0 will contain ‘mycoolpatternmycoolpatternmycoolpatternmy...’.”…””}”(hjúh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K /sys/module/snd_pcmtest/parameters/inject_hwpars_err”h]”hŒ=echo 1 > /sys/module/snd_pcmtest/parameters/inject_hwpars_err”…””}”hjŽsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjõ‰jöŒbash”jø}”uh1jåh³hÇh´KZhjah²hubhÞ)”}”(hŒ8Errors can be injected into the following PCM callbacks:”h]”hŒ8Errors can be injected into the following PCM callbacks:”…””}”(hjžh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K^hjah²hubjØ)”}”(hŒ:* hw_params (EBUSY) * prepare (EINVAL) * trigger (EINVAL) ”h]”j)”}”(hhh]”(j$)”}”(hŒhw_params (EBUSY)”h]”hÞ)”}”(hjµh]”hŒhw_params (EBUSY)”…””}”(hj·h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´K`hj³ubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj°ubj$)”}”(hŒprepare (EINVAL)”h]”hÞ)”}”(hjÌh]”hŒprepare (EINVAL)”…””}”(hjÎh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´KahjÊubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj°ubj$)”}”(hŒtrigger (EINVAL) ”h]”hÞ)”}”(hŒtrigger (EINVAL)”h]”hŒtrigger (EINVAL)”…””}”(hjåh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kbhjáubah}”(h]”h ]”h"]”h$]”h&]”uh1j#hj°ubeh}”(h]”h ]”h"]”h$]”h&]”jˆj‰uh1jh³hÇh´K`hj¬ubah}”(h]”h ]”h"]”h$]”h&]”uh1j×h³hÇh´K`hjah²hubeh}”(h]”Œerrors-injection”ah ]”h"]”Œerrors injection”ah$]”h&]”uh1hÈhhíh²hh³hÇh´KQubhÉ)”}”(hhh]”(hÎ)”}”(hŒ Playback test”h]”hŒ Playback test”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj h²hh³hÇh´KeubhÞ)”}”(hXªThis driver can be also used for the playback functionality testing - every time you write the playback data to the 'pcmtest' PCM device and close it, the driver checks the buffer for containing the looped pattern (which is specified in the fill_pattern debugfs file for each channel). If the playback buffer content represents the looped pattern, 'pc_test' debugfs entry is set into '1'. Otherwise, the driver sets it to '0'.”h]”hXºThis driver can be also used for the playback functionality testing - every time you write the playback data to the ‘pcmtest’ PCM device and close it, the driver checks the buffer for containing the looped pattern (which is specified in the fill_pattern debugfs file for each channel). If the playback buffer content represents the looped pattern, ‘pc_test’ debugfs entry is set into ‘1’. Otherwise, the driver sets it to ‘0’.”…””}”(hjh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kghj h²hubeh}”(h]”Œ playback-test”ah ]”h"]”Œ playback test”ah$]”h&]”uh1hÈhhíh²hh³hÇh´KeubhÉ)”}”(hhh]”(hÎ)”}”(hŒioctl redefinition test”h]”hŒioctl redefinition test”…””}”(hj7h²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÍhj4h²hh³hÇh´KnubhÞ)”}”(hŒ²The driver redefines the 'reset' ioctl, which is default for all PCM devices. To test this functionality, we can trigger the reset ioctl and check the 'ioctl_test' debugfs entry:”h]”hŒºThe driver redefines the ‘reset’ ioctl, which is default for all PCM devices. To test this functionality, we can trigger the reset ioctl and check the ‘ioctl_test’ debugfs entry:”…””}”(hjEh²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kphj4h²hubjæ)”}”(hŒ(cat /sys/kernel/debug/pcmtest/ioctl_test”h]”hŒ(cat /sys/kernel/debug/pcmtest/ioctl_test”…””}”hjSsbah}”(h]”h ]”h"]”h$]”h&]”hÅhÆjõ‰jöŒbash”jø}”uh1jåh³hÇh´Kthj4h²hubhÞ)”}”(hŒVIf the ioctl is triggered successfully, this file will contain '1', and '0' otherwise.”h]”hŒ^If the ioctl is triggered successfully, this file will contain ‘1’, and ‘0’ otherwise.”…””}”(hjch²hh³Nh´Nubah}”(h]”h ]”h"]”h$]”h&]”uh1hÝh³hÇh´Kxhj4h²hubeh}”(h]”Œioctl-redefinition-test”ah ]”h"]”Œioctl redefinition test”ah$]”h&]”uh1hÈhhíh²hh³hÇh´Knubeh}”(h]”Œwhat-can-this-driver-do”ah ]”h"]”Œwhat can this driver do?”ah$]”h&]”uh1hÈhhÊh²hh³hÇh´K ubeh}”(h]”Œthe-virtual-pcm-test-driver”ah ]”h"]”Œthe virtual pcm test driver”ah$]”h&]”uh1hÈhhh²hh³hÇh´Kubeh}”(h]”h ]”h"]”h$]”h&]”Œsource”hÇuh1hŒcurrent_source”NŒ current_line”NŒsettings”Œdocutils.frontend”ŒValues”“”)”}”(hÍNŒ generator”NŒ datestamp”NŒ source_link”NŒ source_url”NŒ toc_backlinks”Œentry”Œfootnote_backlinks”KŒ sectnum_xform”KŒstrip_comments”NŒstrip_elements_with_classes”NŒ strip_classes”NŒ report_level”KŒ halt_level”KŒexit_status_level”KŒdebug”NŒwarning_stream”NŒ traceback”ˆŒinput_encoding”Œ utf-8-sig”Œinput_encoding_error_handler”Œstrict”Œoutput_encoding”Œutf-8”Œoutput_encoding_error_handler”j¬Œerror_encoding”Œutf-8”Œerror_encoding_error_handler”Œbackslashreplace”Œ language_code”Œen”Œrecord_dependencies”NŒconfig”NŒ id_prefix”hŒauto_id_prefix”Œid”Œ dump_settings”NŒdump_internals”NŒdump_transforms”NŒdump_pseudo_xml”NŒexpose_internals”NŒstrict_visitor”NŒ_disable_config”NŒ_source”hÇŒ _destination”NŒ _config_files”]”Œ7/var/lib/git/docbuild/linux/Documentation/docutils.conf”aŒfile_insertion_enabled”ˆŒ raw_enabled”KŒline_length_limit”M'Œpep_references”NŒ pep_base_url”Œhttps://peps.python.org/”Œpep_file_url_template”Œpep-%04d”Œrfc_references”NŒ rfc_base_url”Œ&https://datatracker.ietf.org/doc/html/”Œ tab_width”KŒtrim_footnote_reference_space”‰Œsyntax_highlight”Œlong”Œ smart_quotes”ˆŒsmartquotes_locales”]”Œcharacter_level_inline_markup”‰Œdoctitle_xform”‰Œ docinfo_xform”KŒsectsubtitle_xform”‰Œ image_loading”Œlink”Œembed_stylesheet”‰Œcloak_email_addresses”ˆŒsection_self_link”‰Œenv”NubŒreporter”NŒindirect_targets”]”Œsubstitution_defs”}”Œsubstitution_names”}”Œrefnames”}”Œrefids”}”Œnameids”}”(j†jƒj~j{jejbjjj^j[j jj1j.jvjsuŒ nametypes”}”(j†‰j~‰je‰j‰j^‰j ‰j1‰jv‰uh}”(jƒhÊj{híjbj¸jjhj[jjjaj.j jsj4uŒ footnote_refs”}”Œ citation_refs”}”Œ autofootnotes”]”Œautofootnote_refs”]”Œsymbol_footnotes”]”Œsymbol_footnote_refs”]”Œ footnotes”]”Œ citations”]”Œautofootnote_start”KŒsymbol_footnote_start”KŒ id_counter”Œ collections”ŒCounter”“”}”…”R”Œparse_messages”]”Œtransform_messages”]”Œ transformer”NŒ include_log”]”Œ decoration”Nh²hub.