易截截图软件、单文件、免安装、纯绿色、仅160KB

Linux内核设备模型(5)

译者:郭少悲
2009/12/02
原文:linux/Documentation/driver-model/device.txt
基本的设备数据结构
~~~~~~~~~~~~~~~~~~
struct device {
        struct list_head g_list;
        struct list_head node;
        struct list_head bus_list;
        struct list_head driver_list;
        struct list_head intf_list;
        struct list_head children;
        struct device   * parent;
        char    name[DEVICE_NAME_SIZE];
        char    bus_id[BUS_ID_SIZE];
        spinlock_t      lock;
        atomic_t        refcount;
        struct bus_type * bus;
        struct driver_dir_entry dir;
    u32        class_num;
        struct device_driver *driver;
        void            *driver_data;
        void            *platform_data;
        u32             current_state;
        unsigned char *saved_state;
        void    (*release)(struct device * dev);
};

~~
g_list:    全局设备链表中的节点。
node: 设备的父亲的孩子链表中的节点(父子关系是树结构中的常用关系)。
bus_


相关文档:

实战Linux Bluetooth编程(六) L2CAP编程实例

例一:发送Signaling Packet:
Signaling Command是2个Bluetooth实体之间的L2CAP层命令传输。所以得Signaling Command使用CID 0x0001.
多个Command可以在一个C-frame(control frame)中发送。
 如果要直接发送Signaling Command.需要建立SOCK_RAW类型的L2CAP连接Socket。这样才有机会自己填充Command Code,Identi ......

在Linux上配置COM口

在linux系统上同样可以配置串口,使用串口来与其他设备进行通信。
在配置串口前,我们有取得linux系统的root权限,这个很重要。否则无法完成下面步骤。
1.切换到root用户.
[root@localhost ~]#su root
2. 查找有效的串设备.
[root@localhost ~]#cat /proc/devices
Character devices:
  1 mem
  4 /dev/v ......

linux下写程序检测ip冲突(ARP)

原理其实很简单,那就是广播一个arp包,然后recv,如果没有数据(这里要设置延时),那么说明这个ip是可用的,否则就检测这个数据是否为回复我们发出的arp的应答包.如果是则证明ip已被使用,否则继续等待.
这里可以看下busybox的dhcp中的检测程序。
networking/udhcp/arpping.c
C代码
/* vi: set sw=4 ......

Linux下常用压缩格式的压缩与解压方法

Linux下常用压缩格式的压缩与解压方法





    
大致总结了一下linux下各种格式的压缩包的压缩、解压方法。但是部分方法我没有用到,也就不全,希望大家帮我补充,我将随时修改完善,谢谢!
作者:Linux爱好者
来自:www.L ......

Linux上安装GCC编译器过程

转自:http://www.yesky.com/366/1793366_1.shtml
2004年4月20日最新版本的GCC编译器3.4.0发布了。目前,GCC可以用来编译C/C++、FORTRAN、JAVA、OBJC、ADA等语言的程序,可根据需要选择安装支持的语言。GCC 3.4.0比以前版本更好地支持了C++标准。本文以在Redhat Linux上安装GCC3.4.0为例,介绍了GCC的安装过程。
  安装 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号