Ïêϸ½éÉÜ Linux 2.6 É豸µÄÇý¶¯Ä£ÐÍ
linux 2.6 É豸Çý¶¯Ä£ÐÍ
1.±³¾°
Ëæ×ÅÉ豸ÍØÆ˽ṹԽÀ´Ô½¸´ÔÓ£¬ÐèҪΪÄں˽¨Á¢Ò»¸öͳһµÄÉ豸ģÐÍ£¬¶Ôϵͳ½á¹¹×öÒ»°ãÐԵijéÏóÃèÊö¡£
ÓÐÁ˸óéÏó½á¹¹£¬¿ÉÖ§³Ö¶àÖÖ²»Í¬µÄÈÎÎñ£º
a) µçÔ´¹ÜÀí Íê³ÉµçÔ´¹ÜÀí¹¤×÷ÐèÒª¶Ôϵͳ½á¹¹µÄÀí½â£¬ÇÒÓÐÑϸñµÄ˳Ðò£¬È磺һ¸öUSBËÞÖ÷ÊÊÅäÆ÷£¬ÔÚ´¦ÀíÍêËùÓÐÓëÆäÏàÁ¬½ÓµÄÉ豸ÃæÇ°ÊDz»Äܹرյģ»
b) ÓëÓû§¿Õ¼äͨÐÅ ÓÉ/sysfsÐéÄâÎļþϵͳչʾÉ豸µÄÊôÐÔ
c) ÈȲå°ÎÉ豸
d) ¶ÔÏóÉúÃüÖÜÆÚ
2.sysfs ÐéÄâÎļþϵͳ
sysfs ÊÇÒ»¸öÌØÊâµÄÎļþϵͳ£¬ÀàËÆÓÚ/proc¡£sysfs²»½öÏó/procÒ»ÑùÔÊÐíÓû§¿Õ¼ä·ÃÎÊÄں˵ÄÊý¾Ý£¬¶øÇÒËüÒÔ¸ü½á¹¹»¯µÄ·½Ê½ÏòÓû§ÌṩÄÚºËÊý¾ÝÐÅÏ¢¡£
sysfsµÄÒ»¸öÄ¿µÄ¾ÍÊÇչʾÉ豸Çý¶¯Ä£ÐÍÖи÷×é¼þµÄ²ã´Î¹Øϵ¡£Æ䶥¼¶Ä¿Â¼°üÀ¨£º
a) block
b) device
c) bus
d) drivers
e) class
f) power
g) firmware
ÿ¸öĿ¼´ú±íÒ»¸ökobject¶ÔÏó£¬Ã¿¸öÎļþ´ú±íkobjectµÄÊôÐÔ¡£
3. Kobject¡¢Kset ºÍ subsystem
3.1 Kobject
Kobject ÊÇ×é³ÉÉ豸ģÐ͵Ļù±¾½á¹¹¡£ÀàËÆÓÚC++ÖеĻùÀ࣬ËüǶÈëÓÚ¸ü´óµÄ¶ÔÏóµÄ¶ÔÏóÖÐ--ËùνµÄÈÝÆ÷--ÓÃÀ´ÃèÊöÉ豸ģÐ͵Ä×é¼þ¡£Èçbus, devices, drivers ¶¼ÊǵäÐ͵ÄÈÝÆ÷¡£
ÈÝÆ÷ÓÐÁËkobjectÖ®ºó£¬ÔÊÐíÄںˣº
a) ±£´æ¶ÔÈÝÆ÷µÄÒýÓüÆÊý
b) ±£´æÈÝÆ÷Ö®¼äµÄ²ã´Î¹Øϵ
c) Ϊÿ¸öÈÝÆ÷µÄÊôÐÔÌṩһ¸öÓû§ÊÓͼ
struct kobject{
char * k_name;
char name[20];
struct k_ref kref;
struct list_head entry;
struct kobject * parent;
struct kset * kset;
struct ktype *
Ïà¹ØÎĵµ£º
Ò»¡¢ÒýÑÔ£º
±¾ÎĵµµÄÄÚÈݴ󲿷ÝÄÚÈݶ¼ÊÇ´ÓÍøÉÏÊÕ¼¯¶øÀ´£¬È»ºóÅäºÏһЩеĽØͼ£¨Äں˰汾£ºV2.4.19£©¡£ÔÚÿһÅäÖÃÏîºó»áÓÐÒ»¸öÑ¡ÔñÖ¸ÄϵIJ¿·Ý£¬ÓÃÀ´Ö¸µ¼´ó¼ÒÔõôÑù¸ù¾Ý×Ô¼ºµÄÇé¿öÀ´×öÏàÓ¦µÄÑ¡Ôñ£»»¹ÓÐÔÚÿһ¸ö´óÏîºÍÎĵµµÄ×îºó»áÓÐÒ»¸ö¾Ñé̸£¬ËüÊÇһЩ¸ßÊÖÃÇÔÚÓ¦¶ÔÎÊÌâºÍ´¦ÀíÌØÓÐÓ²¼þʱµÄһЩ¾Ñ飨Õâ¸ö»¹µ ......
ÃæÊÔʱһÔٵر»Îʵ½½ø³Ì¼äͨÐŵÄÇé¿ö£¬¶øÎÒµÄÀí½âһֱͣÁôÔÚ¸ÅÄîÉϺÍÃû´ÊÉÏ£¬±ØÐëÒª×öµãʵÑé¼ÓÉîÀí½â¡£
IPC:Interprocess communication¡£ÓÐЩIPCµÄ·½·¨²»½ö¿ÉÒÔÓÃÓÚÏàͬÖ÷»ú£¬Ò²¿ÉÒÔÓÃÓÚ²»Í¬Ö÷»ú£¬ÈçsocketsºÍSTREAMS¡£
¾µäIPCÖ®Ò»£ºpipes(¹ÜµÀ)
,ʹÓÃ×î¹ã·º£¬¾ßÓÐÇ×Ôµ¹Øϵ
µÄ½ø³Ì¼ä²ÅÄÜʹÓùܵÀ½øÐÐIPC¡£
ʹÓÃÁ˹ܵ ......
ÉÏÖÜ×îºóÎÒÃǽ²ÁËsudo,½ñÌìÎÒÃÇÖ÷Ҫ˵˵·ÖÇø¡¢¸ñʽ»¯¡¢SWAP¡¢LVM¡¢Èí¼þRAIDµÄ´´½¨¹þ~
¸ñʽ»¯
²é¿´µ±Ç°·ÖÇø£ºfdisk -l
Õâ¸öÃüÁîÎÒÃÇÒÔÇ°Êǽ²¹ýµÄ,ÎÒÏÖÔÚÎÊÏ£¬IDÄÇÏîÊÇʲôÒâ˼£¿
83 ÊÇ´ú±íEXT2ºÍEXT3
82 ÊÇ´ú±íSWAP·ÖÇø
Ó²Å̽ṹÎÒÃǾͲ»½²ÁË£¬ÏàÐÅ´ó¼Ò¶¼Óлù´¡¡£ÎÒÃǾÍÖ±½Ó½øÈë²Ù×÷
LINUX·ÖÇøʹÓõŤ¾ßÊÇF ......
×î½üÓÖ¿ªÊ¼¿´CarmerµÄÇý¶¯ÁË£¬ÔÚLinuxÏÂͨ³£ÊµÓÃVideo4linux¿ò¼ÜÀ´ÊµÏÖVideo capture/Camera CaptureµÈ¹¦ÄÜ£¬ÏÈ˵һÏÂÉ豸ע²á²¿·Ö£¬ov7670.cÖУ¬×¢²á·½·¨ÈçÏ£º
static struct v4l2_i2c_driver_data v4l2_i2c_data = {
.name = "ov7670",
&nb ......
1.²é¿´Äں˰汾ÃüÁî
1) cat /proc/version
2) uname -a
3) uname -r
2.²é¿´linuxµÄ°æ±¾
1) lsb_release -a
2) cat /etc/redhat-release
3) cat /etc/issue
4) rpm -q redhat-release (redhatϵͳ) ......