// Linux Device Driver Template/Skeleton with mmap
// Kernel Module
#include <linux/module.h>
#include <linux/init.h>
#include <linux/version.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/sched.h>
#include <asm/uaccess.h>
#include <asm/io.h>
#include <linux/vmalloc.h>
#include <linux/mman.h>
#include <linux/slab.h>
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
#include <linux/wrapper.h>
#endif
#define SKELETON_MAJOR 240
#define SKELETON_NAME "skeleton"
#define CASE1 1
#define CASE2 2
static unsigned int counter = 0;
static char string [128];
static int data;
//#define USEASCII
#ifdef USEASCII
static char *kmalloc_area = NULL;
static char *kmalloc_ptr = NULL;
#else
static unsigned int *kmalloc_area = NULL;
static unsigned int *kmalloc_ptr = NULL;
#endif
#define LEN (64*1024)
unsigned long virt_add ......
网上有篇帖子包含里linux下的dnw,我在用idea6410,编译dnw和secbulk后并不能正常使用
LINUX下的DNW程序下载
http://linux.chinaunix.net/bbs/viewthread.php?tid=1055992
secbulk设备未建立,手动建立/dev/secbulk0并不起作用,原因是secbulk probe会匹配id_table,这个是为QQ2440准备的,所以需要改id_table
static struct usb_device_id secbulk_table[]= {
{ USB_DEVICE(0x04e8, 0x1234)},
{ }
};
可以通过lsusb获得idProduct和idVendor,需要在插上板子,并准备下载时此时设备连上时lsusb,0x04e8:0x1234就是我需要的
[zhourr@localhost ~]$ lsusb
Bus 002 Device 005: ID 04e8:1234 Samsung Electronics Co., Ltd
Bus 002 Device 004: ID 064e:a116 Suyin Corp.
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 007 Device 002: ID 093a:2510 Pixart Imaging, Inc.
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 002: ID 067b:2303 ......
功能描述:
获取一些文件相关的信息。
用法:
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int stat(const char *path, struct stat *buf);
int fstat(int filedes, struct stat *buf);
int lstat(const char *path, struct stat *buf);
参数:
path:文件路径名。
filedes:文件描述词。
buf:是以下结构体的指针
struct stat {
dev_t st_dev; /* 文件所在设备的标识 */
ino_t st_ino; /* 文件结点号 */
mode_t st_mode; /* 文件保护模式 */
nlink_t st_nlink; /* 硬连接数 */
uid_t st_uid; /* 文件用户标识 */
gid_t st_gid; /* 文件用户组标识 */
dev_t st_rdev; ......
Get Redhat Enterprise 3.0 from:
Your local RedHat rep�
Get Veritas’ VCS and VM products from:
ftp://ftp.veritas.com/pub/products/fst_ha.lxrt2.2.redhatlinux.tar.gz
ftp://ftp.veritas.com/pub/products/fst_ha.lxrt2.2MP1.redhatlinux.tar.gz
You will need a temporary key to complete this install. Please
contact your local Veritas account team or email me at
rich@robotthoughts.com
Install RedHat Enterprise Linux 3.0:
Put CD1 in your CD drive and reboot.
Make sure you select the smb-server packages during the install. You need that package to run Samba for Windows file-sharing.
Follow the install for your hardware and set up the boot disk to
your liking. Be sure and leave some extra room on the disk (a least an
extra 2-5 Gb) if you plan to encapsulate the boot volume.
Pay attention to how you setup the Ethernet cards. In Linux your
cards will most likely be eth0, eth1, eth2. In my case I had two
on-board Ethernet ports and one PCI based Ethernet card. Most Linux
i ......
linux 下 用c语言创建mysql数据库笔记(一)
-----仅为个人学习摘要,并不断更新中。。。。
在引用头文件时必须包含‘mysql.h’的头文件(必须是mysql.h的绝对地址,一般在mysql下的include目录下,仔细看看你的在哪里?*),
我是ubuntu9。04,在/usr/include/mysql/mysql.h下
有的linux版本可能在/usr/local/mysql/include/mysql/mysql.h下。
---- 对其中几个函数作简单说明,详细说明,可参考MySQL文档:
---- 1. MYSQL *mysql_init(MYSQL *mysql)
---- 初始化一个类型为MYSQL的数据结构,为执行mysql_real_connect()做准备。参数
mysql为指向该结构的指针,如果mysql为NULL,则新建并初始化一个MYSQL的数据结构。
新建的结构将在mysql_close()中释放。
---- 若成功,返回初始化的MYSQL数据结构的指针,否则返回NULL。
---- 2. MYSQL *mysql_real_connect(MYSQL *mysql, const char
*host,
---- const char *user, const char *passwd, const char *db,
---- unsigned int port, const char *unix_socket, unsigned int
client_flag)
---- 与MySQL数据库引擎建立连接。在执行进一步的数据操作之前,必须保证m ......
linux 下 用c语言创建mysql数据库笔记(一)
-----仅为个人学习摘要,并不断更新中。。。。
在引用头文件时必须包含‘mysql.h’的头文件(必须是mysql.h的绝对地址,一般在mysql下的include目录下,仔细看看你的在哪里?*),
我是ubuntu9。04,在/usr/include/mysql/mysql.h下
有的linux版本可能在/usr/local/mysql/include/mysql/mysql.h下。
---- 对其中几个函数作简单说明,详细说明,可参考MySQL文档:
---- 1. MYSQL *mysql_init(MYSQL *mysql)
---- 初始化一个类型为MYSQL的数据结构,为执行mysql_real_connect()做准备。参数
mysql为指向该结构的指针,如果mysql为NULL,则新建并初始化一个MYSQL的数据结构。
新建的结构将在mysql_close()中释放。
---- 若成功,返回初始化的MYSQL数据结构的指针,否则返回NULL。
---- 2. MYSQL *mysql_real_connect(MYSQL *mysql, const char
*host,
---- const char *user, const char *passwd, const char *db,
---- unsigned int port, const char *unix_socket, unsigned int
client_flag)
---- 与MySQL数据库引擎建立连接。在执行进一步的数据操作之前,必须保证m ......
linux 下 用c语言创建mysql数据库笔记(一)
-----仅为个人学习摘要,并不断更新中。。。。
在引用头文件时必须包含‘mysql.h’的头文件(必须是mysql.h的绝对地址,一般在mysql下的include目录下,仔细看看你的在哪里?*),
我是ubuntu9。04,在/usr/include/mysql/mysql.h下
有的linux版本可能在/usr/local/mysql/include/mysql/mysql.h下。
---- 对其中几个函数作简单说明,详细说明,可参考MySQL文档:
---- 1. MYSQL *mysql_init(MYSQL *mysql)
---- 初始化一个类型为MYSQL的数据结构,为执行mysql_real_connect()做准备。参数
mysql为指向该结构的指针,如果mysql为NULL,则新建并初始化一个MYSQL的数据结构。
新建的结构将在mysql_close()中释放。
---- 若成功,返回初始化的MYSQL数据结构的指针,否则返回NULL。
---- 2. MYSQL *mysql_real_connect(MYSQL *mysql, const char
*host,
---- const char *user, const char *passwd, const char *db,
---- unsigned int port, const char *unix_socket, unsigned int
client_flag)
---- 与MySQL数据库引擎建立连接。在执行进一步的数据操作之前,必须保证m ......
linux 下 用c语言创建mysql数据库笔记(二)
-------两个简单的例子,供参考比较
《例一》
#include <stdio.h>
#include <stdlib.h>
#include
"/usr/include/mysql/mysql.h"
int main(){
MYSQL my_connection;
int res;
mysql_init(&my_connection);
if(mysql_real_connect(&my_connection,"localhost","root","123","data",0,NULL,CLIENT_FOUND_ROWS)){
printf("connection success\n");
res= mysql_query(&my_connection,"select * from
ip");
if(!res){
printf("%lu",(unsigned
long)mysql_affected_rows(&my_connection));
}
else{
fprintf(stderr,"insert error
%d:%s\n",mysql_errno(&my_connection),
mysql_error(&my_connection));
}
mys ......
linux 下 用c语言创建mysql数据库笔记(二)
-------两个简单的例子,供参考比较
《例一》
#include <stdio.h>
#include <stdlib.h>
#include
"/usr/include/mysql/mysql.h"
int main(){
MYSQL my_connection;
int res;
mysql_init(&my_connection);
if(mysql_real_connect(&my_connection,"localhost","root","123","data",0,NULL,CLIENT_FOUND_ROWS)){
printf("connection success\n");
res= mysql_query(&my_connection,"select * from
ip");
if(!res){
printf("%lu",(unsigned
long)mysql_affected_rows(&my_connection));
}
else{
fprintf(stderr,"insert error
%d:%s\n",mysql_errno(&my_connection),
mysql_error(&my_connection));
}
mys ......
linux 下 用c语言创建mysql数据库笔记(二)
-------两个简单的例子,供参考比较
《例一》
#include <stdio.h>
#include <stdlib.h>
#include
"/usr/include/mysql/mysql.h"
int main(){
MYSQL my_connection;
int res;
mysql_init(&my_connection);
if(mysql_real_connect(&my_connection,"localhost","root","123","data",0,NULL,CLIENT_FOUND_ROWS)){
printf("connection success\n");
res= mysql_query(&my_connection,"select * from
ip");
if(!res){
printf("%lu",(unsigned
long)mysql_affected_rows(&my_connection));
}
else{
fprintf(stderr,"insert error
%d:%s\n",mysql_errno(&my_connection),
mysql_error(&my_connection));
}
mys ......