免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1688 | 回复: 3
打印 上一主题 下一主题

请教关于编译驱动的问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-03-13 23:47 |只看该作者 |倒序浏览
我用的thinkpad t42的指点干在winxp下有专门的驱动

我在linux下找了很长时间后,终于找到了,但是只有源代码,编写驱动的人说要自己编译,帮忙看看怎么编译吧

diff -uNr linux-2.6.9-vanilla/drivers/input/mouse/Makefile linux-2.6.9/drivers/input/mouse/Makefile
--- linux-2.6.9-vanilla/drivers/input/mouse/Makefile        2004-10-18 17:53:43.000000000 -0400
+++ linux-2.6.9/drivers/input/mouse/Makefile        2004-10-28 19:30:58.000000000 -0400
@@ -14,4 +14,4 @@
obj-$(CONFIG_MOUSE_SERIAL)        += sermouse.o
obj-$(CONFIG_MOUSE_VSXXXAA)        += vsxxxaa.o

-psmouse-objs  := psmouse-base.o logips2pp.o synaptics.o
+psmouse-objs  := psmouse-base.o logips2pp.o synaptics.o trackpoint.o
diff -uNr linux-2.6.9-vanilla/drivers/input/mouse/psmouse-base.c linux-2.6.9/drivers/input/mouse/psmouse-base.c
--- linux-2.6.9-vanilla/drivers/input/mouse/psmouse-base.c        2004-10-18 17:53:43.000000000 -0400
+++ linux-2.6.9/drivers/input/mouse/psmouse-base.c        2005-01-22 14:44:24.000000000 -0500
@@ -21,6 +21,7 @@
#include "psmouse.h"
#include "synaptics.h"
#include "logips2pp.h"
+#include "trackpoint.h"

#define DRIVER_DESC        "S/2 mouse driver"

@@ -77,6 +78,13 @@
        input_regs(dev, regs);

/*
+ * TrackPoint scroll simulation handler if the BTN_MIDDLE is down
+ */
+
+        if(psmouse->;model == PSMOUSE_TRACKPOINT)
+                trackpoint_sim_scroll(psmouse);
+
+/*
  * The PS2++ protocol is a little bit complex
  */

@@ -468,6 +476,16 @@
        int synaptics_hardware = 0;

/*
+ * Try to initialize the IBM TrackPoint
+ */
+        if (psmouse_max_proto >; PSMOUSE_PS2 && trackpoint_init(psmouse) == 0) {
+                psmouse->;vendor = "IBM";
+                psmouse->;name = "TrackPoint";
+
+                return PSMOUSE_PS2;
+        }
+
+/*
  * Try Synaptics TouchPad
  */
        if (max_proto >; PSMOUSE_PS2 && synaptics_detect(psmouse)) {
diff -uNr linux-2.6.9-vanilla/drivers/input/mouse/trackpoint.c linux-2.6.9/drivers/input/mouse/trackpoint.c
--- linux-2.6.9-vanilla/drivers/input/mouse/trackpoint.c        1969-12-31 19:00:00.000000000 -0500
+++ linux-2.6.9/drivers/input/mouse/trackpoint.c        2005-01-22 20:06:49.000000000 -0500
@@ -0,0 +1,583 @@
+/*
+ * Stephen Evanchik <evanchsa@gmail.com>;
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ *
+ * Trademarks are the property of their respective owners.
+ *
+ */
+
+#include <linux/delay.h>;
+#include <linux/serio.h>;
+#include <linux/module.h>;
+#include <linux/moduleparam.h>;
+#include <linux/input.h>;
+#include <linux/proc_fs.h>;
+#include <asm/uaccess.h>;
+#include "psmouse.h"
+#include "trackpoint.h"
+
+
+int tp_sens = TP_DEF_SENS;
+module_param_named(sens, tp_sens, uint, 0);
+MODULE_PARM_DESC(sens, "Sensitivity";
+
+int tp_speed = TP_DEF_SPEED;
+module_param_named(speed, tp_speed, uint, 0);
+MODULE_PARM_DESC(speed, "Speed of pointer";
+
+int tp_backup = TP_DEF_BACKUP;
+module_param_named(backup, tp_backup, uint, 0);
+MODULE_PARM_DESC(backup, "Backup Range";
+
+int tp_draghyst = TP_DEF_DRAG_HYST;
+module_param_named(draghyst, tp_draghyst, uint, 0);
+MODULE_PARM_DESC(draghyst, "Resistance to dragging";
+
+int tp_mindrag = TP_DEF_MIN_DRAG;
+module_param_named(mindrag, tp_mindrag, uint, 0);
+MODULE_PARM_DESC(mindrag, "Drag threshold";
+
+int tp_thresh = TP_DEF_THRESH;
+module_param_named(thresh, tp_thresh, uint, 0);
+MODULE_PARM_DESC(thresh, "Force necessary to trigger a press or release";
+
+int tp_upthresh = TP_UP_THRESH;
+module_param_named(upthresh, tp_upthresh, uint, 0);
+MODULE_PARM_DESC(upthresh, "Force necessary to trigger a click";
+
+int tp_ztime = TP_DEF_Z_TIME;
+module_param_named(ztime, tp_ztime, uint, 0);
+MODULE_PARM_DESC(ztime, "Determines how sharp a press is";
+
+int tp_jenks = TP_DEF_JENKS_CURV;
+module_param_named(jenks, tp_jenks, uint, 0);
+MODULE_PARM_DESC(jenks, "Double click sensitivity";
+
+
+/* Toggles */
+int tp_pts = TP_DEF_PTS;
+module_param_named(pts, tp_pts, uint, 0);
+MODULE_PARM_DESC(pts, "ress to Select";
+
+int tp_mb = TP_DEF_MB;
+module_param_named(mb, tp_mb, uint, 0);
+MODULE_PARM_DESC(pts, "Middle button is disabled");
+
+/*
+ * Device IO: read, write and toggle bit
+ */
+static void trackpoint_command(struct psmouse *psmouse, unsigned char cmd)
+{       
+        psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
+        psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0,0, cmd));
+}
+
+static void trackpoint_read(struct psmouse *psmouse, unsigned char loc, unsigned char *results)
+{
+        psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
+        psmouse_command(psmouse, results, MAKE_PS2_CMD(0, 1, loc));
+}
+
+static void trackpoint_write(struct psmouse *psmouse, unsigned char loc, unsigned char val)
+{       
+        psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
+        psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0,0, TP_WRITE_MEM));
+        psmouse_command(psmouse, &val, MAKE_PS2_CMD(1,0, loc));
+}
+
+static int trackpoint_toggle_bit(struct psmouse *psmouse, unsigned char loc, unsigned char mask)
+{
+        /* Bad things will happen if the loc param isn't in this range */
+        if(loc < 0x20 || loc >;= 0x2F)
+                return -1;
+       
+        psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_COMMAND));
+        psmouse_command(psmouse, NULL, MAKE_PS2_CMD(0, 0, TP_TOGGLE));
+        psmouse_command(psmouse, &mask, MAKE_PS2_CMD(1, 0, loc));
+       
+        return 0;
+}
+
+
+#ifdef CONFIG_PROC_FS
+
+#define PROC_READ_NAME(name) name##_read_func
+#define PROC_WRITE_NAME(name) name##_write_func
+#define PROC_TOGGLE_NAME(name) name##_toggle_func
+
+#define MAKE_PROC_READ(name, item) \
+        static int name(char* page, char** start, off_t off, int count, int* eof, void* data) \
+        { \
+                int len; \
+                struct psmouse *psmouse = (struct psmouse *)data; \
+                struct trackpoint_data *tp = (struct trackpoint_data*)psmouse->;private; \
+                len = sprintf(page, "%d\n", tp->;item); \
+                *eof = 1; \
+                return len; \
+        }
+
+#define MAKE_PROC_WRITE(name, item, command) \
+        static int name(struct file *file, const char __user *buffer, unsigned

论坛徽章:
0
2 [报告]
发表于 2005-03-14 16:18 |只看该作者

请教关于编译驱动的问题

关注中

论坛徽章:
0
3 [报告]
发表于 2005-03-14 17:26 |只看该作者

请教关于编译驱动的问题

你试一试用gcc -o -o 文件名.exe  文件名.c(如果这是一个点c的文件的话)

论坛徽章:
5
4 [报告]
发表于 2005-03-15 13:13 |只看该作者

请教关于编译驱动的问题

看着怎么像patch, 在Makefile所在的目录下,试一下
make  / make install
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP