ÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐÓ²¼þ×°±¸µÄÇý¶¯ºÍÖÎÀí£¿
ÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐÓ²¼þ×°±¸µÄÇý¶¯ºÍÖÎÀí£¿
÷è÷ë²Ù×÷ϵͳÊÇ»ùÓÚLinuxµÄ¿ªÔ´²Ù×÷ϵͳ£¬¾ßÓÐÎȹÌÐԸߡ¢ÐÔÄܺõÈÌص㡣ÔÚʹÓÃ÷è÷ë²Ù×÷ϵͳʱ£¬ÎÒÃǾ³£ÐèÒª¶ÔÓ²¼þ×°±¸¾ÙÐÐÇý¶¯ºÍÖÎÀí¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐÓ²¼þ×°±¸µÄÇý¶¯ºÍÖÎÀí£¬²¢¸ø³öÏìÓ¦µÄ´úÂëʾÀý¡£
Ò»¡¢Çý¶¯µÄÑ¡Ôñ
ÔÚÑ¡ÔñÓ²¼þ×°±¸Çý¶¯Ê±£¬Ê×ÏÈÐèҪȷ¶¨Ó²¼þ×°±¸µÄÀàÐͺͰ汾¡£÷è÷ë²Ù×÷ϵͳ֧³Ö½Ï¶àÖÖÀàµÄÓ²¼þ×°±¸£¬ÈçÉù¿¨¡¢ÏÔ¿¨¡¢Íø¿¨µÈ¡£Æ¾Ö¤Ó²¼þ×°±¸µÄÀàÐͺͰ汾£¬ÎÒÃÇ¿ÉÒÔÑ¡ÔñÏìÓ¦µÄÇý¶¯³ÌÐò¡£
÷è÷ë²Ù×÷ϵͳµÄÇý¶¯³ÌÐòͨ³£ÒÔÄÚºËÄ£¿éµÄÐÎʽ±£´æ£¬¿ÉÒÔÖ±½Ó¼ÓÔص½ÄÚºËÖС£ÄÚºËÄ£¿éÊÇÒ»ÖÖ¶¯Ì¬¼ÓÔصĴúÂ룬¿ÉÒÔÔÚÔËÐÐʱ¼ÓÔغÍжÔØ£¬ÊµÏÖ¶ÔÓ²¼þ×°±¸µÄÇý¶¯ºÍÖÎÀí¡£
¶þ¡¢Çý¶¯µÄ¼ÓÔØ
¼ÓÔØÇý¶¯³ÌÐò֮ǰ£¬ÎÒÃÇÐèÒªÏÈÉó²éϵͳÖÐÒѼÓÔصÄÇý¶¯³ÌÐò£¬È·¶¨ÊÇ·ñÒѾÓÐÏìÓ¦µÄÇý¶¯¼ÓÔØ¡£ÎÒÃÇ¿ÉÒÔͨ¹ýÏÂÁî”lsmod”À´Éó²éÒѼÓÔصÄÇý¶¯³ÌÐò£¬ÈçÏÂËùʾ£º
$ lsmod Module Size Used by snd_hda_codec_hdmi 49152 1 snd_hda_codec_realtek 81920 1 snd_hda_codec_generic 73728 1 snd_hda_codec_realtek
µÇ¼ºó¸´ÖÆ
ÒÔÉÏЧ¹ûÏÔʾÁËÈý¸öÒѼÓÔصÄÇý¶¯³ÌÐò£¬°üÀ¨Éù¿¨ºÍÏÔ¿¨µÄÇý¶¯¡£
ÈôÊÇϵͳÖÐûÓÐÏìÓ¦µÄÇý¶¯³ÌÐò£¬ÎÒÃÇ¿ÉÒÔ´Ó¹Ù·½ÍøÕ¾»òÆäËûȪԴÏÂÔز¢×°Öá£ÏÂÃæÒÔÉù¿¨Çý¶¯ÎªÀý£¬ÏÈÈݼÓÔØÇý¶¯µÄ°ì·¨¡£
Ê×ÏÈ£¬ÎÒÃÇÐèÒªÏÂÔØÉù¿¨Çý¶¯µÄѹËõ°ü£¬Èç”sound_driver.tar.gz”¡£
½âѹËõÇý¶¯Ñ¹Ëõ°ü¡£Ê¹ÓÃÒÔÏÂÏÂÁ
$ tar -zxvf sound_driver.tar.gz
µÇ¼ºó¸´ÖÆ
½øÈë½âѹºóµÄĿ¼£¬²¢Ö´ÐДmake”ÏÂÁî±àÒëÇý¶¯³ÌÐò¡£
$ cd sound_driver $ make
µÇ¼ºó¸´ÖÆ
±àÒëÀֳɺó£¬Ö´ÐДmake install”ÏÂÁÇý¶¯³ÌÐò×°Öõ½ÏµÍ³ÖС£
$ make install
µÇ¼ºó¸´ÖÆ
×°ÖÃÍê³Éºó£¬Ê¹ÓÔmodprobe”ÏÂÁî¼ÓÔØÇý¶¯³ÌÐò¡£
$ modprobe sound_driver
µÇ¼ºó¸´ÖÆ
Èý¡¢Çý¶¯µÄÖÎÀí
³ýÁ˼ÓÔØÇý¶¯³ÌÐò£¬ÎÒÃÇ»¹¿ÉÒÔ¶ÔÒѼÓÔصÄÇý¶¯³ÌÐò¾ÙÐÐÖÎÀíºÍÉèÖá£
Éó²éÒѼÓÔصÄÇý¶¯³ÌÐò¼°Æä״̬¡£ÎÒÃÇ¿ÉÒÔʹÓÔlsmod”ÏÂÁîÀ´Éó²éÒѼÓÔصÄÇý¶¯³ÌÐò£¬ÒÔ¼°ÆäʹÓÃÇéÐκÍÒÀÀµ¹Øϵ¡£
$ lsmod
µÇ¼ºó¸´ÖÆ
жÔز»ÐèÒªµÄÇý¶¯³ÌÐò¡£ÈôÊÇÎÒÃDz»ÔÙÐèҪij¸öÇý¶¯³ÌÐò£¬¿ÉÒÔʹÓÔrmmod”ÏÂÁÆäжÔØ¡£
$ rmmod sound_driver
µÇ¼ºó¸´ÖÆ
ÉèÖÃÇý¶¯³ÌÐò¡£ÓÐЩÇý¶¯³ÌÐòÐèÒª¾ÙÐÐһЩÉèÖòŻªÕý³£ÊÂÇé¡£ÎÒÃÇ¿ÉÒÔͨ¹ý±à¼ÏìÓ¦µÄÉèÖÃÎļþÀ´¾ÙÐÐÉèÖá£
$ vi /etc/sound_driver.conf
µÇ¼ºó¸´ÖÆ
ÒÔÉÏÊÇÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐÓ²¼þ×°±¸µÄÇý¶¯ºÍÖÎÀíµÄ»ù±¾°ì·¨¡£Í¨¹ýÒÔÉÏ°ì·¨£¬ÎÒÃÇ¿ÉÒÔ¼ÓÔØ¡¢Ð¶ÔغÍÉèÖÃÓ²¼þ×°±¸µÄÇý¶¯³ÌÐò£¬ÊµÏÖ¶ÔÓ²¼þ×°±¸µÄÇý¶¯ºÍÖÎÀí¡£
¸½£º´úÂëʾÀý£¨ÒÔÉù¿¨Çý¶¯ÎªÀý£©
#include <linux/module.h> #include <linux/init.h> #include <linux/device.h> static int __init sound_driver_init(void) { printk(KERN_INFO "Sound driver initialized "); return 0; } static void __exit sound_driver_exit(void) { printk(KERN_INFO "Sound driver exited "); } module_init(sound_driver_init); module_exit(sound_driver_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Your Name"); MODULE_DESCRIPTION("Sound driver for Linux");
µÇ¼ºó¸´ÖÆ
ÒÔÉÏÊÇÒ»¸ö×î¼òÆÓµÄÉù¿¨Çý¶¯³ÌÐòʾÀý¡£ÔÚ³õʼ»¯º¯ÊýÖУ¬ÎÒÃÇ¿ÉÒÔÔÚ¼ÓÔØÇý¶¯³ÌÐòʱִÐÐһЩ³õʼ»¯²Ù×÷£¬Èç×¢²á×°±¸¡¢ÉêÇë×ÊÔ´µÈ¡£ÔÚÍ˳öº¯ÊýÖУ¬ÎÒÃÇ¿ÉÒÔÔÚжÔØÇý¶¯³ÌÐòʱִÐÐһЩÕûÀí²Ù×÷£¬ÈçÊÍ·Å×ÊÔ´¡¢×¢Ïú×°±¸µÈ¡£
ÒÔÉϾÍÊǹØÓÚÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐÓ²¼þ×°±¸µÄÇý¶¯ºÍÖÎÀíµÄÏÈÈÝ£¬ÒÔ¼°Ïà¹ØµÄ´úÂëʾÀý¡£Ï£ÍûÄܶԶÁÕßÓÐËù×ÊÖú¡£
ÒÔÉϾÍÊÇÔõÑùÔÚ÷è÷ë²Ù×÷ϵͳÉϾÙÐÐÓ²¼þ×°±¸µÄÇý¶¯ºÍÖÎÀí£¿µÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡