末尾为'\0'
声卡的soc结构中有一个snd_card,该结构中有一个driver字符串数组,长度为16个字符;
在对其初始化snd_soc_bind_card()的时候,使用了snprintf; 我们注意到,声卡的名字是十分长的,超过了16个字符,因此在给这个driver赋值时,就截取了前面的15个字符,末尾加'\0'。
这正是要说明的,当使用snprintf拷贝字符串时,返回的字符串的末尾是加了'\0'的,而不是16个字符。
事实上,在linux-5.10.9中使用的是:soc-core.c: snd_soc_bind_card()
soc_setup_card_name(card->snd_card->shortname,
card->name, NULL, 0);
soc_setup_card_name(card->snd_card->longname,
card->long_name, card->name, 0);
soc_setup_card_name(card->snd_card->driver,
card->driver_name, card->name, 1);
而在linux-4.19中使用的是:soc-core.c: snd_soc_instantiate_card()