[linux-usb-devel] [PATCH] usb: Microsoft Natural Ergonomic Keyboard 4000 Driver 0.3.1

2006-08-15 Thread liyu
Changelogs:

1. some code style clean works.
2. rebuild with The HID Simple Driver Interface 0.3.1

NOTE:   This driver requires:
1.  [PATCH] usb: The HID Simple Driver Interface 0.3.1 (core)
2.  [PATCH] usb: HID Simple Driver Interface 0.3.1 (Kconfig and 
Makefile)

It also can apply on 2.6.17.6 and 2.6.17.8 at least. 

PS: I have not Subscribe linux-usb-devel maillist, please CC me your reply, 
thanks. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/usbnek4k.c 
linux-2.6.17.7/drivers/usb/input/usbnek4k.c
--- linux-2.6.17.7/drivers/usb/input.orig/usbnek4k.c1970-01-01 
08:00:00.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/usbnek4k.c 2006-08-16 09:06:04.0 
+0800
@@ -0,0 +1,194 @@
+/*
+ *  Microsoft Natural Ergonomic Keyboard 4000 Driver
+ *
+ *  Version:   0.3.1
+ *
+ *  Copyright (c) 2006 Liyu [EMAIL PROTECTED]
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include linux/kernel.h
+#include linux/input.h
+#include hid.h
+#include hid-simple.h
+
+#define USAGE_ZOOM_IN 0x22d
+#define USAGE_ZOOM_OUT 0x22e
+#define USAGE_HOME 0x223
+#define USAGE_SEARCH   0x221
+#define USAGE_EMAIL0x18a
+#define USAGE_FAVORITES0x182
+#define USAGE_MUTE 0xe2
+#define USAGE_VOLUME_DOWN  0xea
+#define USAGE_VOLUME_UP0xe9
+#define USAGE_PLAY_PAUSE   0xcd
+#define USAGE_CALCULATOR   0x192
+#define USAGE_BACK 0x224
+#define USAGE_FORWARD  0x225
+#define USAGE_CUSTOM   0xff05
+
+#define USAGE_CUSTOM_RELEASE   0x0
+#define USAGE_CUSTOM_1 0x1
+#define USAGE_CUSTOM_2 0x2
+#define USAGE_CUSTOM_3 0x4
+#define USAGE_CUSTOM_4 0x8
+#define USAGE_CUSTOM_5 0x10
+
+#define USAGE_HELP 0x95
+#define USAGE_UNDO 0x21a
+#define USAGE_REDO 0x279
+#define USAGE_NEW  0x201
+#define USAGE_OPEN 0x202
+#define USAGE_CLOSE0x203
+
+#define USAGE_REPLY0x289
+#define USAGE_FWD  0x28b
+#define USAGE_SEND 0x28c
+#define USAGE_SPELL0x1ab
+#define USAGE_SAVE 0x207
+#define USAGE_PRINT0x208
+
+#define USAGE_KEYPAD_EQUAL 0x67
+#define USAGE_KEYPAD_LEFT_PAREN 0xb6
+#define USAGE_KEYPAD_RIGHT_PAREN 0xb7
+
+#define MSNEK4K_ID_VENDOR  0x045e
+#define MSNEK4K_ID_PRODUCT 0x00db
+
+static struct usb_device_id nek4k_id_table[] = {
+   {
+   USB_DEVICE(MSNEK4K_ID_VENDOR, MSNEK4K_ID_PRODUCT)
+   },
+   {}
+};
+
+MODULE_DEVICE_TABLE(usb, nek4k_id_table);
+
+static char driver_name[] = Microsoft Natural Ergonomic Keyboard 4000;
+
+struct usage_block consumer_usage_block[] = {
+   USAGE_BLOCK(USAGE_ZOOM_IN, 0, EV_KEY, KEY_F13, 0),
+   USAGE_BLOCK(USAGE_ZOOM_OUT, 0, EV_KEY, KEY_F14, 0),
+   USAGE_BLOCK(USAGE_HOME, 0, EV_KEY, KEY_HOMEPAGE, 0),
+   USAGE_BLOCK(USAGE_SEARCH, 0, EV_KEY, KEY_SEARCH, 0),
+   USAGE_BLOCK(USAGE_EMAIL, 0, EV_KEY, KEY_EMAIL, 0),
+   USAGE_BLOCK(USAGE_FAVORITES, 0, EV_KEY, KEY_FAVORITES, 0),
+   USAGE_BLOCK(USAGE_MUTE, 0, EV_KEY, KEY_MUTE, 0),
+   USAGE_BLOCK(USAGE_VOLUME_DOWN, 0, EV_KEY, KEY_VOLUMEDOWN, 0),
+   USAGE_BLOCK(USAGE_VOLUME_UP, 0, EV_KEY, KEY_VOLUMEUP, 0),
+   USAGE_BLOCK(USAGE_PLAY_PAUSE, 0, EV_KEY, KEY_PLAYPAUSE, 0),
+   USAGE_BLOCK(USAGE_CALCULATOR, 0, EV_KEY, KEY_CALC, 0),
+   USAGE_BLOCK(USAGE_BACK, 0, EV_KEY, KEY_BACK, 0),
+   USAGE_BLOCK(USAGE_FORWARD, 0, EV_KEY, KEY_FORWARD, 0),
+   USAGE_BLOCK(USAGE_HELP, 0, EV_KEY, KEY_HELP, 0),
+   USAGE_BLOCK(USAGE_UNDO, 0, EV_KEY, KEY_UNDO, 0),
+   USAGE_BLOCK(USAGE_REDO, 0, EV_KEY, KEY_REDO, 0),
+   USAGE_BLOCK(USAGE_NEW, 0, EV_KEY, KEY_NEW, 0),
+   USAGE_BLOCK(USAGE_OPEN, 0, EV_KEY, KEY_OPEN, 0),
+   USAGE_BLOCK(USAGE_CLOSE, 0, EV_KEY, KEY_CLOSE, 0),
+   USAGE_BLOCK(USAGE_REPLY, 0, EV_KEY, KEY_REPLY, 0),
+   USAGE_BLOCK(USAGE_FWD, 0, EV_KEY, KEY_FORWARDMAIL, 0),
+   USAGE_BLOCK(USAGE_SEND, 0, EV_KEY, KEY_SEND, 0),
+   USAGE_BLOCK(USAGE_SPELL, 0, EV_KEY, KEY_F15, 0),
+   USAGE_BLOCK(USAGE_SAVE, 0, EV_KEY, KEY_SAVE, 0),
+   USAGE_BLOCK(USAGE_PRINT, 0, EV_KEY, KEY_PRINT, 0),
+   USAGE_BLOCK_NULL
+};
+
+struct usage_block msvendor_usage_block[] = {
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_1, EV_KEY, KEY_FN_F1, 0),
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_2, EV_KEY, KEY_FN_F2, 0),
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_3, EV_KEY, KEY_FN_F3, 0),
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_4, EV_KEY, KEY_FN_F4, 0),
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_5, EV_KEY, KEY_FN_F5, 0),
+   USAGE_BLOCK_NULL
+};
+
+struct usage_block keyboard_usage_block[] = {
+   USAGE_BLOCK(USAGE_KEYPAD_EQUAL, 0, EV_KEY, KEY_KPEQUAL, 0),
+   USAGE_BLOCK(USAGE_KEYPAD_LEFT_PAREN, 0, EV_KEY, KEY_KPLEFTPAREN, 0),
+   USAGE_BLOCK

[linux-usb-devel] [PATCH] usb: Betop BTP-2118 joystick force-feedback driver

2006-08-15 Thread liyu
Changelogs:

1. the first release.

NOTE:   This driver requires:
1.  [PATCH] usb: The HID Simple Driver Interface 0.3.1 (core)
2.  [PATCH] usb: HID Simple Driver Interface 0.3.1 (Kconfig and 
Makefile)

It also can apply on 2.6.17.6 and 2.6.17.8 at least. 

PS: I have not Subscribe linux-usb-devel maillist, please CC me your reply, 
thanks. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/btp2118.c 
linux-2.6.17.7/drivers/usb/input/btp2118.c
--- linux-2.6.17.7/drivers/usb/input.orig/btp2118.c 1970-01-01 
08:00:00.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/btp2118.c  2006-08-15 15:41:43.0 
+0800
@@ -0,0 +1,438 @@
+/*
+ *  Betop BTP-2118 joystick force-feedback driver
+ *
+ *  Version:   0.1.0
+ *
+ *  Copyright (c) 2006 Liyu [EMAIL PROTECTED]
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include linux/kernel.h
+#include linux/input.h
+#include linux/spinlock.h
+#include linux/timer.h
+#include linux/sched.h
+#include hid.h
+#include hid-simple.h
+
+#define USB_ID_VENDOR  0x12bd
+#define USB_ID_PRODUCT 0xc003
+
+#define USAGE_PAGE_BTP_FF  0x008c /* Bar Code Scanner ? */
+#define USAGE_BTP_FF   0x0002
+
+#define BTP_EFFECT_NONE(-1)
+
+/* usb_btp_info-flags list */
+#define BTP_DISCONNECTING  0
+#define BTP_URB_DONE   1
+#define BTP_BUSY   2   /* avoid to resend urb */
+
+#define IS_BTP_DISCONNECTING(info) (test_bit(BTP_DISCONNECTING, 
(info)-flags))
+#define IS_BTP_URB_DONE(info) \
+   (test_bit(BTP_URB_DONE|BTP_DISCONNECTING, (info)-flags))
+#define IS_BTP_BUSY(info) (test_bit(BTP_BUSY, (info)-flags))
+
+#define BTP_SET_DISCONNECTING(info) (set_bit(BTP_DISCONNECTING, 
(info)-flags))
+#define BTP_SET_URB_DONE(info) (set_bit(BTP_URB_DONE, (info)-flags))
+#define BTP_SET_BUSY(info) (set_bit(BTP_BUSY, (info)-flags))
+
+#define BTP_CLR_BUSY(info) (clear_bit(BTP_BUSY, (info)-flags))
+
+static spinlock_t btp_lock;
+
+struct usb_btp_info {
+   struct timer_list timer;
+   unsigned long flags;
+   /* default shock strength */
+   unsigned char left_strength;
+   unsigned char right_strength;
+   unsigned char start_packet[8];
+   unsigned char stop_packet[8];
+   /* ff data */
+   struct ff_effecteffects[8];
+   int running_effect;
+   int repeat;
+   /* usb data */
+   struct usb_ctrlrequest req;
+   struct usb_device *dev;
+   struct urb *ctrl0;  
+   unsigned int pipe0;
+   int timeout;
+};
+
+static struct usb_device_id btp_id_table[] = {
+   {
+   USB_DEVICE(USB_ID_VENDOR, USB_ID_PRODUCT)
+   },
+   {}
+};
+
+MODULE_DEVICE_TABLE(usb, btp_id_table);
+
+static char driver_name[] = BETOP Vibration Gamepad (BTP-2118) Driver;
+
+/* This gamepad reports three usages, but all are same. */
+static struct usage_block btp_ff_usage_block[] = {
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_GAIN, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_RUMBLE, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_CONSTANT, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_SPRING, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_FRICTION, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_DAMPER, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_INERTIA, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_RAMP, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF_STATUS, 0, FF_STATUS_STOPPED),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF_STATUS, 0, FF_STATUS_PLAYING),
+   USAGE_BLOCK_NULL
+};
+
+static struct usage_page_block btp_ff_usage_page_blockes[] = {
+   USAGE_PAGE_BLOCK(USAGE_PAGE_BTP_FF, btp_ff_usage_block),
+   USAGE_PAGE_BLOCK_NULL
+};
+
+/* usb_complete_t */
+static void urb_complete(struct urb *urb, struct pt_regs *regs)
+{
+   struct usb_btp_info *info = urb-context;
+   
+   info = urb-context;
+   usb_unlink_urb(urb);
+   
+   if (IS_BTP_DISCONNECTING(info))
+   BTP_SET_URB_DONE(info);
+   BTP_CLR_BUSY(info);
+}
+
+static int inline btp_effect_request(struct usb_btp_info *info, char *packet)
+{
+   if (IS_BTP_BUSY(info))
+   return -EBUSY;
+
+   usb_fill_control_urb (info-ctrl0, info-dev, info-pipe0,
+   (char*)info-req,
+   packet,
+   info-req.wLength,
+   urb_complete,
+   info);
+   BTP_SET_BUSY(info);
+   usb_submit_urb(info-ctrl0, GFP_ATOMIC);
+   return 0;
+}
+
+/* run by usb_btp_info-timer

[linux-usb-devel] [PATCH] usb: HID Simple Driver Interface 0.3.1 (Kconfig and Makefile)

2006-08-15 Thread liyu

For simple, I merge the changes with two drivers. you can use two drivers as 
example.

It also can apply on 2.6.17.6 and 2.6.17.8 at least. 

PS: I have not Subscribe linux-usb-devel maillist, please CC me your reply, 
thanks. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/Kconfig 
linux-2.6.17.7/drivers/usb/input/Kconfig
--- linux-2.6.17.7/drivers/usb/input.orig/Kconfig   2006-07-25 
11:36:01.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/Kconfig2006-08-08 08:48:58.0 
+0800
@@ -326,3 +326,31 @@ config USB_APPLETOUCH
 
  To compile this driver as a module, choose M here: the
  module will be called appletouch.
+
+config HID_SIMPLE
+   bool HID simple driver interface
+   depends on USB_HIDINPUT
+   help
+ This simple interface let the writing HID driver more easier. 
Moreover,
+ this allow you write force-feedback driver without touch HID input 
+ implementation code. Also, it can be used as input filter.
+
+config HID_SIMPLE_MSNEK4K
+   tristate Microsoft Natural Ergonomic Keyboard 4000 Driver
+   depends on HID_SIMPLE
+   help
+ Microsoft Natural Ergonomic Keyboard 4000 extend keys support. These
+ may not work without change user space configration, e.g, XKB conf-
+ iguration in X.
+
+config HID_SIMPLE_FF
+   bool HID simple driver interface force feedback support
+   depends on HID_SIMPLE  !HID_FF
+   help
+ This feature can not be compatible with Force feedback support 
(HID_FF).
+
+config HID_SIMPLE_FF_BTP2118
+   tristate Betop 2118 joystick force feedback support
+   depends on HID_SIMPLE_FF
+   help
+ This can enable Betop 2118 joystick force feedback feature.
diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/Makefile 
linux-2.6.17.7/drivers/usb/input/Makefile
--- linux-2.6.17.7/drivers/usb/input.orig/Makefile  2006-07-25 
11:36:01.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/Makefile   2006-08-07 21:11:03.0 
+0800
@@ -44,6 +44,8 @@ obj-$(CONFIG_USB_ACECAD)  += acecad.o
 obj-$(CONFIG_USB_YEALINK)  += yealink.o
 obj-$(CONFIG_USB_XPAD) += xpad.o
 obj-$(CONFIG_USB_APPLETOUCH)   += appletouch.o
+obj-$(CONFIG_HID_SIMPLE_MSNEK4K)   += usbnek4k.o
+obj-$(CONFIG_HID_SIMPLE_FF_BTP2118)+= btp2118.o
 
 ifeq ($(CONFIG_USB_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG



-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH] usb: The HID Simple Driver Interface 0.3.1 (core)

2006-08-15 Thread liyu
Chanelogs: (upto 20060814)

1. add force-feedback driver support.
2. add simple driver module refcnt support.
3. add two CONFIG_HID_SIMPLE and CONFIG_HID_SIMPLE_FF Kconfig entries.
4. refactoring.
5. replace two semaphones with mutex.
6. some bugfixes.

It also can apply on 2.6.17.6 and 2.6.17.8 at least.

PS: I have not Subscribe linux-usb-devel maillist, please CC me your reply, 
thanks. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/hid-core.c 
linux-2.6.17.7/drivers/usb/input/hid-core.c
--- linux-2.6.17.7/drivers/usb/input.orig/hid-core.c2006-07-25 
11:36:01.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/hid-core.c 2006-08-16 09:17:58.0 
+0800
@@ -26,6 +26,7 @@
 #include asm/byteorder.h
 #include linux/input.h
 #include linux/wait.h
+#include linux/mutex.h
 
 #undef DEBUG
 #undef DEBUG_DATA
@@ -33,6 +34,9 @@
 #include linux/usb.h
 
 #include hid.h
+#ifdef CONFIG_HID_SIMPLE
+#include hid-simple.h
+#endif
 #include linux/hiddev.h
 
 /*
@@ -46,6 +50,17 @@
 
 static char *hid_types[] = {Device, Pointer, Mouse, Device, Joystick,
Gamepad, Keyboard, Keypad, Multi-Axis 
Controller};
+
+#ifdef CONFIG_HID_SIMPLE
+/*
+ * The global data structure for simple device driver interface.
+ */
+static DEFINE_MUTEX(matched_lock);
+static DEFINE_MUTEX(simple_lock);
+static struct list_head matched_devices_list;
+static struct list_head simple_drivers_list;
+#endif
+
 /*
  * Module parameters.
  */
@@ -785,8 +800,22 @@ static __inline__ int search(__s32 *arra
 static void hid_process_event(struct hid_device *hid, struct hid_field *field, 
struct hid_usage *usage, __s32 value, int interrupt, struct pt_regs *regs)
 {
hid_dump_input(usage, value);
-   if (hid-claimed  HID_CLAIMED_INPUT)
+   if (hid-claimed  HID_CLAIMED_INPUT) {
+#ifdef CONFIG_HID_SIMPLE
+   /* event filter here */
+   if (hid-simple) {
+   if (hid-simple-pre_event 
+   !hid-simple-pre_event(hid, field, usage, 
+   value, regs))
+   return;
+   }
+#endif
hidinput_hid_event(hid, field, usage, value, regs);
+#ifdef CONFIG_HID_SIMPLE
+   if (hid-simple  hid-simple-post_event)
+   hid-simple-post_event(hid, field, usage, value, regs);
+#endif
+   }
if (hid-claimed  HID_CLAIMED_HIDDEV  interrupt)
hiddev_hid_event(hid, field, usage, value, regs);
 }
@@ -832,7 +861,6 @@ static void hid_input_field(struct hid_d
 field-usage[field-value[n] - min].hid
 search(value, field-value[n], count))
hid_process_event(hid, field, 
field-usage[field-value[n] - min], 0, interrupt, regs);
-
if (value[n] = min  value[n] = max
 field-usage[value[n] - min].hid
 search(field-value, value[n], count))
@@ -1977,7 +2005,11 @@ fail:
 static void hid_disconnect(struct usb_interface *intf)
 {
struct hid_device *hid = usb_get_intfdata (intf);
-
+#ifdef CONFIG_HID_SIMPLE
+   struct list_head *node;
+   struct matched_device *matched;
+#endif
+   
if (!hid)
return;
 
@@ -1991,8 +2023,32 @@ static void hid_disconnect(struct usb_in
del_timer_sync(hid-io_retry);
flush_scheduled_work();
 
-   if (hid-claimed  HID_CLAIMED_INPUT)
+   if (hid-claimed  HID_CLAIMED_INPUT) {
+#ifdef CONFIG_HID_SIMPLE
+   matched = NULL;
+   mutex_lock(matched_lock);
+   list_for_each(node, matched_devices_list) {
+   matched = list_entry(node, struct matched_device, node);
+   if (matched-intf == intf) {
+   list_del(matched-node);
+   break;
+   }
+   matched = NULL;
+   }
+   mutex_unlock(matched_lock);
+   /* disconnect simple device driver if need */
+   if (matched  hid-simple) {
+   hidinput_simple_driver_disconnect(hid);
+   module_put(hid-simple-owner);
+   hidinput_simple_driver_pop(hid, matched);
+   }
+   if (matched) {
+   matched-intf = NULL;
+   kfree(matched);
+   }
+#endif
hidinput_disconnect(hid);
+   }
if (hid-claimed  HID_CLAIMED_HIDDEV)
hiddev_disconnect(hid);
 
@@ -2005,12 +2061,150 @@ static void hid_disconnect(struct usb_in
hid_free_device(hid);
 }
 
+#ifdef CONFIG_HID_SIMPLE
+static int hidinput_simple_driver_bind_one(struct hidinput_simple_driver 
*simple

[linux-usb-devel] [PATCH] usb: The HID Simple Driver Interface 0.3.1 (core)

2006-08-15 Thread liyu

Chanelogs: (upto 20060814)

1. add force-feedback driver support.
2. add simple driver module refcnt support.
3. add two CONFIG_HID_SIMPLE and CONFIG_HID_SIMPLE_FF Kconfig entries.
4. refactoring.
5. replace two semaphones with mutex.
6. some bugfixes.

It also can apply on 2.6.17.6 and 2.6.17.8 at least.

PS: I have not Subscribe linux-usb-devel maillist, please CC me your reply, 
thanks. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/hid-core.c 
linux-2.6.17.7/drivers/usb/input/hid-core.c
--- linux-2.6.17.7/drivers/usb/input.orig/hid-core.c2006-07-25 
11:36:01.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/hid-core.c 2006-08-16 09:17:58.0 
+0800
@@ -26,6 +26,7 @@
 #include asm/byteorder.h
 #include linux/input.h
 #include linux/wait.h
+#include linux/mutex.h
 
 #undef DEBUG
 #undef DEBUG_DATA
@@ -33,6 +34,9 @@
 #include linux/usb.h
 
 #include hid.h
+#ifdef CONFIG_HID_SIMPLE
+#include hid-simple.h
+#endif
 #include linux/hiddev.h
 
 /*
@@ -46,6 +50,17 @@
 
 static char *hid_types[] = {Device, Pointer, Mouse, Device, Joystick,
Gamepad, Keyboard, Keypad, Multi-Axis 
Controller};
+
+#ifdef CONFIG_HID_SIMPLE
+/*
+ * The global data structure for simple device driver interface.
+ */
+static DEFINE_MUTEX(matched_lock);
+static DEFINE_MUTEX(simple_lock);
+static struct list_head matched_devices_list;
+static struct list_head simple_drivers_list;
+#endif
+
 /*
  * Module parameters.
  */
@@ -785,8 +800,22 @@ static __inline__ int search(__s32 *arra
 static void hid_process_event(struct hid_device *hid, struct hid_field *field, 
struct hid_usage *usage, __s32 value, int interrupt, struct pt_regs *regs)
 {
hid_dump_input(usage, value);
-   if (hid-claimed  HID_CLAIMED_INPUT)
+   if (hid-claimed  HID_CLAIMED_INPUT) {
+#ifdef CONFIG_HID_SIMPLE
+   /* event filter here */
+   if (hid-simple) {
+   if (hid-simple-pre_event 
+   !hid-simple-pre_event(hid, field, usage, 
+   value, regs))
+   return;
+   }
+#endif
hidinput_hid_event(hid, field, usage, value, regs);
+#ifdef CONFIG_HID_SIMPLE
+   if (hid-simple  hid-simple-post_event)
+   hid-simple-post_event(hid, field, usage, value, regs);
+#endif
+   }
if (hid-claimed  HID_CLAIMED_HIDDEV  interrupt)
hiddev_hid_event(hid, field, usage, value, regs);
 }
@@ -832,7 +861,6 @@ static void hid_input_field(struct hid_d
 field-usage[field-value[n] - min].hid
 search(value, field-value[n], count))
hid_process_event(hid, field, 
field-usage[field-value[n] - min], 0, interrupt, regs);
-
if (value[n] = min  value[n] = max
 field-usage[value[n] - min].hid
 search(field-value, value[n], count))
@@ -1977,7 +2005,11 @@ fail:
 static void hid_disconnect(struct usb_interface *intf)
 {
struct hid_device *hid = usb_get_intfdata (intf);
-
+#ifdef CONFIG_HID_SIMPLE
+   struct list_head *node;
+   struct matched_device *matched;
+#endif
+   
if (!hid)
return;
 
@@ -1991,8 +2023,32 @@ static void hid_disconnect(struct usb_in
del_timer_sync(hid-io_retry);
flush_scheduled_work();
 
-   if (hid-claimed  HID_CLAIMED_INPUT)
+   if (hid-claimed  HID_CLAIMED_INPUT) {
+#ifdef CONFIG_HID_SIMPLE
+   matched = NULL;
+   mutex_lock(matched_lock);
+   list_for_each(node, matched_devices_list) {
+   matched = list_entry(node, struct matched_device, node);
+   if (matched-intf == intf) {
+   list_del(matched-node);
+   break;
+   }
+   matched = NULL;
+   }
+   mutex_unlock(matched_lock);
+   /* disconnect simple device driver if need */
+   if (matched  hid-simple) {
+   hidinput_simple_driver_disconnect(hid);
+   module_put(hid-simple-owner);
+   hidinput_simple_driver_pop(hid, matched);
+   }
+   if (matched) {
+   matched-intf = NULL;
+   kfree(matched);
+   }
+#endif
hidinput_disconnect(hid);
+   }
if (hid-claimed  HID_CLAIMED_HIDDEV)
hiddev_disconnect(hid);
 
@@ -2005,12 +2061,150 @@ static void hid_disconnect(struct usb_in
hid_free_device(hid);
 }
 
+#ifdef CONFIG_HID_SIMPLE
+static int hidinput_simple_driver_bind_one(struct hidinput_simple_driver 
*simple

[linux-usb-devel] [PATCH] usb: HID Simple Driver Interface 0.3.1 (Kconfig and Makefile)

2006-08-15 Thread liyu


For simple, I merge the changes with two drivers. you can use two drivers as 
example.

It also can apply on 2.6.17.6 and 2.6.17.8 at least. 

PS: I have not Subscribe linux-usb-devel maillist, please CC me your reply, 
thanks. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/Kconfig 
linux-2.6.17.7/drivers/usb/input/Kconfig
--- linux-2.6.17.7/drivers/usb/input.orig/Kconfig   2006-07-25 
11:36:01.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/Kconfig2006-08-08 08:48:58.0 
+0800
@@ -326,3 +326,31 @@ config USB_APPLETOUCH
 
  To compile this driver as a module, choose M here: the
  module will be called appletouch.
+
+config HID_SIMPLE
+   bool HID simple driver interface
+   depends on USB_HIDINPUT
+   help
+ This simple interface let the writing HID driver more easier. 
Moreover,
+ this allow you write force-feedback driver without touch HID input 
+ implementation code. Also, it can be used as input filter.
+
+config HID_SIMPLE_MSNEK4K
+   tristate Microsoft Natural Ergonomic Keyboard 4000 Driver
+   depends on HID_SIMPLE
+   help
+ Microsoft Natural Ergonomic Keyboard 4000 extend keys support. These
+ may not work without change user space configration, e.g, XKB conf-
+ iguration in X.
+
+config HID_SIMPLE_FF
+   bool HID simple driver interface force feedback support
+   depends on HID_SIMPLE  !HID_FF
+   help
+ This feature can not be compatible with Force feedback support 
(HID_FF).
+
+config HID_SIMPLE_FF_BTP2118
+   tristate Betop 2118 joystick force feedback support
+   depends on HID_SIMPLE_FF
+   help
+ This can enable Betop 2118 joystick force feedback feature.
diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/Makefile 
linux-2.6.17.7/drivers/usb/input/Makefile
--- linux-2.6.17.7/drivers/usb/input.orig/Makefile  2006-07-25 
11:36:01.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/Makefile   2006-08-07 21:11:03.0 
+0800
@@ -44,6 +44,8 @@ obj-$(CONFIG_USB_ACECAD)  += acecad.o
 obj-$(CONFIG_USB_YEALINK)  += yealink.o
 obj-$(CONFIG_USB_XPAD) += xpad.o
 obj-$(CONFIG_USB_APPLETOUCH)   += appletouch.o
+obj-$(CONFIG_HID_SIMPLE_MSNEK4K)   += usbnek4k.o
+obj-$(CONFIG_HID_SIMPLE_FF_BTP2118)+= btp2118.o
 
 ifeq ($(CONFIG_USB_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH] usb: Betop BTP-2118 joystick force-feedback driver

2006-08-15 Thread liyu

Changelogs:

1. the first release.

NOTE:   This driver requires:
1.  [PATCH] usb: The HID Simple Driver Interface 0.3.1 (core)
2.  [PATCH] usb: HID Simple Driver Interface 0.3.1 (Kconfig and 
Makefile)

It also can apply on 2.6.17.6 and 2.6.17.8 at least. 

PS: I have not Subscribe linux-usb-devel maillist, please CC me your reply, 
thanks. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/btp2118.c 
linux-2.6.17.7/drivers/usb/input/btp2118.c
--- linux-2.6.17.7/drivers/usb/input.orig/btp2118.c 1970-01-01 
08:00:00.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/btp2118.c  2006-08-15 15:41:43.0 
+0800
@@ -0,0 +1,438 @@
+/*
+ *  Betop BTP-2118 joystick force-feedback driver
+ *
+ *  Version:   0.1.0
+ *
+ *  Copyright (c) 2006 Liyu [EMAIL PROTECTED]
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include linux/kernel.h
+#include linux/input.h
+#include linux/spinlock.h
+#include linux/timer.h
+#include linux/sched.h
+#include hid.h
+#include hid-simple.h
+
+#define USB_ID_VENDOR  0x12bd
+#define USB_ID_PRODUCT 0xc003
+
+#define USAGE_PAGE_BTP_FF  0x008c /* Bar Code Scanner ? */
+#define USAGE_BTP_FF   0x0002
+
+#define BTP_EFFECT_NONE(-1)
+
+/* usb_btp_info-flags list */
+#define BTP_DISCONNECTING  0
+#define BTP_URB_DONE   1
+#define BTP_BUSY   2   /* avoid to resend urb */
+
+#define IS_BTP_DISCONNECTING(info) (test_bit(BTP_DISCONNECTING, 
(info)-flags))
+#define IS_BTP_URB_DONE(info) \
+   (test_bit(BTP_URB_DONE|BTP_DISCONNECTING, (info)-flags))
+#define IS_BTP_BUSY(info) (test_bit(BTP_BUSY, (info)-flags))
+
+#define BTP_SET_DISCONNECTING(info) (set_bit(BTP_DISCONNECTING, 
(info)-flags))
+#define BTP_SET_URB_DONE(info) (set_bit(BTP_URB_DONE, (info)-flags))
+#define BTP_SET_BUSY(info) (set_bit(BTP_BUSY, (info)-flags))
+
+#define BTP_CLR_BUSY(info) (clear_bit(BTP_BUSY, (info)-flags))
+
+static spinlock_t btp_lock;
+
+struct usb_btp_info {
+   struct timer_list timer;
+   unsigned long flags;
+   /* default shock strength */
+   unsigned char left_strength;
+   unsigned char right_strength;
+   unsigned char start_packet[8];
+   unsigned char stop_packet[8];
+   /* ff data */
+   struct ff_effecteffects[8];
+   int running_effect;
+   int repeat;
+   /* usb data */
+   struct usb_ctrlrequest req;
+   struct usb_device *dev;
+   struct urb *ctrl0;  
+   unsigned int pipe0;
+   int timeout;
+};
+
+static struct usb_device_id btp_id_table[] = {
+   {
+   USB_DEVICE(USB_ID_VENDOR, USB_ID_PRODUCT)
+   },
+   {}
+};
+
+MODULE_DEVICE_TABLE(usb, btp_id_table);
+
+static char driver_name[] = BETOP Vibration Gamepad (BTP-2118) Driver;
+
+/* This gamepad reports three usages, but all are same. */
+static struct usage_block btp_ff_usage_block[] = {
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_GAIN, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_RUMBLE, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_CONSTANT, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_SPRING, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_FRICTION, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_DAMPER, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_INERTIA, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_RAMP, 0),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF_STATUS, 0, FF_STATUS_STOPPED),
+   USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF_STATUS, 0, FF_STATUS_PLAYING),
+   USAGE_BLOCK_NULL
+};
+
+static struct usage_page_block btp_ff_usage_page_blockes[] = {
+   USAGE_PAGE_BLOCK(USAGE_PAGE_BTP_FF, btp_ff_usage_block),
+   USAGE_PAGE_BLOCK_NULL
+};
+
+/* usb_complete_t */
+static void urb_complete(struct urb *urb, struct pt_regs *regs)
+{
+   struct usb_btp_info *info = urb-context;
+   
+   info = urb-context;
+   usb_unlink_urb(urb);
+   
+   if (IS_BTP_DISCONNECTING(info))
+   BTP_SET_URB_DONE(info);
+   BTP_CLR_BUSY(info);
+}
+
+static int inline btp_effect_request(struct usb_btp_info *info, char *packet)
+{
+   if (IS_BTP_BUSY(info))
+   return -EBUSY;
+
+   usb_fill_control_urb (info-ctrl0, info-dev, info-pipe0,
+   (char*)info-req,
+   packet,
+   info-req.wLength,
+   urb_complete,
+   info);
+   BTP_SET_BUSY(info);
+   usb_submit_urb(info-ctrl0, GFP_ATOMIC);
+   return 0;
+}
+
+/* run by usb_btp_info-timer

[linux-usb-devel] [PATCH] usb: Microsoft Natural Ergonomic Keyboard 4000 Driver 0.3.1

2006-08-15 Thread liyu

Changelogs:

1. some code style clean works.
2. rebuild with The HID Simple Driver Interface 0.3.1

NOTE:   This driver requires:
1.  [PATCH] usb: The HID Simple Driver Interface 0.3.1 (core)
2.  [PATCH] usb: HID Simple Driver Interface 0.3.1 (Kconfig and 
Makefile)

It also can apply on 2.6.17.6 and 2.6.17.8 at least. 

PS: I have not Subscribe linux-usb-devel maillist, please CC me your reply, 
thanks. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/usbnek4k.c 
linux-2.6.17.7/drivers/usb/input/usbnek4k.c
--- linux-2.6.17.7/drivers/usb/input.orig/usbnek4k.c1970-01-01 
08:00:00.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/usbnek4k.c 2006-08-16 09:06:04.0 
+0800
@@ -0,0 +1,194 @@
+/*
+ *  Microsoft Natural Ergonomic Keyboard 4000 Driver
+ *
+ *  Version:   0.3.1
+ *
+ *  Copyright (c) 2006 Liyu [EMAIL PROTECTED]
+ */
+
+/*
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ */
+
+#include linux/kernel.h
+#include linux/input.h
+#include hid.h
+#include hid-simple.h
+
+#define USAGE_ZOOM_IN 0x22d
+#define USAGE_ZOOM_OUT 0x22e
+#define USAGE_HOME 0x223
+#define USAGE_SEARCH   0x221
+#define USAGE_EMAIL0x18a
+#define USAGE_FAVORITES0x182
+#define USAGE_MUTE 0xe2
+#define USAGE_VOLUME_DOWN  0xea
+#define USAGE_VOLUME_UP0xe9
+#define USAGE_PLAY_PAUSE   0xcd
+#define USAGE_CALCULATOR   0x192
+#define USAGE_BACK 0x224
+#define USAGE_FORWARD  0x225
+#define USAGE_CUSTOM   0xff05
+
+#define USAGE_CUSTOM_RELEASE   0x0
+#define USAGE_CUSTOM_1 0x1
+#define USAGE_CUSTOM_2 0x2
+#define USAGE_CUSTOM_3 0x4
+#define USAGE_CUSTOM_4 0x8
+#define USAGE_CUSTOM_5 0x10
+
+#define USAGE_HELP 0x95
+#define USAGE_UNDO 0x21a
+#define USAGE_REDO 0x279
+#define USAGE_NEW  0x201
+#define USAGE_OPEN 0x202
+#define USAGE_CLOSE0x203
+
+#define USAGE_REPLY0x289
+#define USAGE_FWD  0x28b
+#define USAGE_SEND 0x28c
+#define USAGE_SPELL0x1ab
+#define USAGE_SAVE 0x207
+#define USAGE_PRINT0x208
+
+#define USAGE_KEYPAD_EQUAL 0x67
+#define USAGE_KEYPAD_LEFT_PAREN 0xb6
+#define USAGE_KEYPAD_RIGHT_PAREN 0xb7
+
+#define MSNEK4K_ID_VENDOR  0x045e
+#define MSNEK4K_ID_PRODUCT 0x00db
+
+static struct usb_device_id nek4k_id_table[] = {
+   {
+   USB_DEVICE(MSNEK4K_ID_VENDOR, MSNEK4K_ID_PRODUCT)
+   },
+   {}
+};
+
+MODULE_DEVICE_TABLE(usb, nek4k_id_table);
+
+static char driver_name[] = Microsoft Natural Ergonomic Keyboard 4000;
+
+struct usage_block consumer_usage_block[] = {
+   USAGE_BLOCK(USAGE_ZOOM_IN, 0, EV_KEY, KEY_F13, 0),
+   USAGE_BLOCK(USAGE_ZOOM_OUT, 0, EV_KEY, KEY_F14, 0),
+   USAGE_BLOCK(USAGE_HOME, 0, EV_KEY, KEY_HOMEPAGE, 0),
+   USAGE_BLOCK(USAGE_SEARCH, 0, EV_KEY, KEY_SEARCH, 0),
+   USAGE_BLOCK(USAGE_EMAIL, 0, EV_KEY, KEY_EMAIL, 0),
+   USAGE_BLOCK(USAGE_FAVORITES, 0, EV_KEY, KEY_FAVORITES, 0),
+   USAGE_BLOCK(USAGE_MUTE, 0, EV_KEY, KEY_MUTE, 0),
+   USAGE_BLOCK(USAGE_VOLUME_DOWN, 0, EV_KEY, KEY_VOLUMEDOWN, 0),
+   USAGE_BLOCK(USAGE_VOLUME_UP, 0, EV_KEY, KEY_VOLUMEUP, 0),
+   USAGE_BLOCK(USAGE_PLAY_PAUSE, 0, EV_KEY, KEY_PLAYPAUSE, 0),
+   USAGE_BLOCK(USAGE_CALCULATOR, 0, EV_KEY, KEY_CALC, 0),
+   USAGE_BLOCK(USAGE_BACK, 0, EV_KEY, KEY_BACK, 0),
+   USAGE_BLOCK(USAGE_FORWARD, 0, EV_KEY, KEY_FORWARD, 0),
+   USAGE_BLOCK(USAGE_HELP, 0, EV_KEY, KEY_HELP, 0),
+   USAGE_BLOCK(USAGE_UNDO, 0, EV_KEY, KEY_UNDO, 0),
+   USAGE_BLOCK(USAGE_REDO, 0, EV_KEY, KEY_REDO, 0),
+   USAGE_BLOCK(USAGE_NEW, 0, EV_KEY, KEY_NEW, 0),
+   USAGE_BLOCK(USAGE_OPEN, 0, EV_KEY, KEY_OPEN, 0),
+   USAGE_BLOCK(USAGE_CLOSE, 0, EV_KEY, KEY_CLOSE, 0),
+   USAGE_BLOCK(USAGE_REPLY, 0, EV_KEY, KEY_REPLY, 0),
+   USAGE_BLOCK(USAGE_FWD, 0, EV_KEY, KEY_FORWARDMAIL, 0),
+   USAGE_BLOCK(USAGE_SEND, 0, EV_KEY, KEY_SEND, 0),
+   USAGE_BLOCK(USAGE_SPELL, 0, EV_KEY, KEY_F15, 0),
+   USAGE_BLOCK(USAGE_SAVE, 0, EV_KEY, KEY_SAVE, 0),
+   USAGE_BLOCK(USAGE_PRINT, 0, EV_KEY, KEY_PRINT, 0),
+   USAGE_BLOCK_NULL
+};
+
+struct usage_block msvendor_usage_block[] = {
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_1, EV_KEY, KEY_FN_F1, 0),
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_2, EV_KEY, KEY_FN_F2, 0),
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_3, EV_KEY, KEY_FN_F3, 0),
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_4, EV_KEY, KEY_FN_F4, 0),
+   USAGE_BLOCK(USAGE_CUSTOM, USAGE_CUSTOM_5, EV_KEY, KEY_FN_F5, 0),
+   USAGE_BLOCK_NULL
+};
+
+struct usage_block keyboard_usage_block[] = {
+   USAGE_BLOCK(USAGE_KEYPAD_EQUAL, 0, EV_KEY, KEY_KPEQUAL, 0),
+   USAGE_BLOCK(USAGE_KEYPAD_LEFT_PAREN, 0, EV_KEY, KEY_KPLEFTPAREN, 0),
+   USAGE_BLOCK

Re: [linux-usb-devel] [PATCH] usb: The HID Simple Driver Interface 0.3.1 (core)

2006-08-16 Thread liyu

Well, Where I can get some guide for how use #ifdef/#if ?

Also, I found I can not send mail to linux-kernel@vger.kernel.org now,
the reject reply like this:

Connected to 209.132.176.167 but sender was rejected.
Remote host said: 553 5.7.1 Hello [210.76.114.181], for your MAIL FROM address 
[EMAIL PROTECTED] policy analysis reported: Your address is not liked source 
for email


Is it looked my mail as spam mail? Who should I send to for help me
resolving this problem?


Alexey Dobriyan wrote:
 On Wed, Aug 16, 2006 at 10:09:07AM +0800, liyu wrote:
   
 --- linux-2.6.17.7/drivers/usb/input.orig/hid-core.c
 +++ linux-2.6.17.7/drivers/usb/input/hid-core.c
 @@ -33,6 +34,9 @@
  #include linux/usb.h

  #include hid.h
 +#ifdef CONFIG_HID_SIMPLE
 +#include hid-simple.h
 +#endif
 

   


-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] usb: Betop BTP-2118 joystick force-feedback driver

2006-08-16 Thread liyu
Alexey Dobriyan wrote:
 On Wed, Aug 16, 2006 at 10:09:12AM +0800, liyu wrote:
   
 --- linux-2.6.17.7/drivers/usb/input.orig/btp2118.c
 +++ linux-2.6.17.7/drivers/usb/input/btp2118.c
 +static struct usage_block btp_ff_usage_block[] = {
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_GAIN, 0),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_RUMBLE, 0),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_CONSTANT, 0),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_SPRING, 0),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_FRICTION, 0),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_DAMPER, 0),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_INERTIA, 0),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF, FF_RAMP, 0),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF_STATUS, 0, FF_STATUS_STOPPED),
 +USAGE_BLOCK(USAGE_BTP_FF, 0, EV_FF_STATUS, 0, FF_STATUS_PLAYING),
 +USAGE_BLOCK_NULL
 

 Arrh, now I see why those define. 

I am sorry, the documentation for this interface will come soon.

 FYI, they fall into obfuscation
 category. Usual and readable style is:

   {
   .foo= bar,
   .baz= quux,
   }, {
   .foo1   = bar1,
   .baz= quux1,
   },
   {}
 You don't need 0 and NULL initializations, compiler will do it for you.

 Exceptions exist, but just by reading snippet above I can't say wth
 USAGE_BLOCK is.

   
:) I think use these macro can make code more clean, however it seem
your viewpoint is opposite with mine.

The reason of I choose this I had an impact on macros USB_DEVICE like,
thus I can not sure if this simulate
 is suitable. I would like listen more words about this.

 +
 +static struct hidinput_simple_driver btp_driver = {
 +__SIMPLE_DRIVER_INIT
 

 Impossible to understand without grep. Please, expand in place and nuke
 it altogether.

   
My original idea here is information hidden. but it seem have a bit of ugly.

This macro just is

#define __SIMPLE_DRIVER_INIT \
.owner = THIS_MODULE,

I think there must be some better means. I am thinking







-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH] usb: HID Simple Driver Interface 0.3.1 (Kconfig and Makefile) 20060817

2006-08-17 Thread liyu

For simple, I merge the changes with two drivers. you can use two drivers as 
example.

It also can apply on 2.6.17.6 and 2.6.17.8 at least. 

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/Kconfig 
linux-2.6.17.7/drivers/usb/input/Kconfig
--- linux-2.6.17.7/drivers/usb/input.orig/Kconfig   2006-07-25 
11:36:01.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/Kconfig2006-08-08 08:48:58.0 
+0800
@@ -326,3 +326,31 @@ config USB_APPLETOUCH
 
  To compile this driver as a module, choose M here: the
  module will be called appletouch.
+
+config HID_SIMPLE
+   bool HID simple driver interface
+   depends on USB_HIDINPUT
+   help
+ This simple interface let the writing HID driver more easier. 
Moreover,
+ this allow you write force-feedback driver without touch HID input 
+ implementation code. Also, it can be used as input filter.
+
+config HID_SIMPLE_MSNEK4K
+   tristate Microsoft Natural Ergonomic Keyboard 4000 Driver
+   depends on HID_SIMPLE
+   help
+ Microsoft Natural Ergonomic Keyboard 4000 extend keys support. These
+ may not work without change user space configration, e.g, XKB conf-
+ iguration in X.
+
+config HID_SIMPLE_FF
+   bool HID simple driver interface force feedback support
+   depends on HID_SIMPLE  !HID_FF
+   help
+ This feature can not be compatible with Force feedback support 
(HID_FF).
+
+config HID_SIMPLE_FF_BTP2118
+   tristate Betop 2118 joystick force feedback support
+   depends on HID_SIMPLE_FF
+   help
+ This can enable Betop 2118 joystick force feedback feature.
diff -Naurp linux-2.6.17.7/drivers/usb/input.orig/Makefile 
linux-2.6.17.7/drivers/usb/input/Makefile
--- linux-2.6.17.7/drivers/usb/input.orig/Makefile  2006-07-25 
11:36:01.0 +0800
+++ linux-2.6.17.7/drivers/usb/input/Makefile   2006-08-17 11:20:00.0 
+0800
@@ -25,6 +25,9 @@ endif
 ifeq ($(CONFIG_HID_FF),y)
usbhid-objs += hid-ff.o
 endif
+ifeq ($(CONFIG_HID_SIMPLE),y)
+   usbhid-objs += hid-simple.o
+endif
 
 obj-$(CONFIG_USB_AIPTEK)   += aiptek.o
 obj-$(CONFIG_USB_ATI_REMOTE)   += ati_remote.o
@@ -44,6 +47,8 @@ obj-$(CONFIG_USB_ACECAD)  += acecad.o
 obj-$(CONFIG_USB_YEALINK)  += yealink.o
 obj-$(CONFIG_USB_XPAD) += xpad.o
 obj-$(CONFIG_USB_APPLETOUCH)   += appletouch.o
+obj-$(CONFIG_HID_SIMPLE_MSNEK4K)   += usbnek4k.o
+obj-$(CONFIG_HID_SIMPLE_FF_BTP2118)+= btp2118.o
 
 ifeq ($(CONFIG_USB_DEBUG),y)
 EXTRA_CFLAGS += -DDEBUG




-
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnkkid=120709bid=263057dat=121642___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


[linux-usb-devel] [PATCH] doc: HID Simple Driver Interface 0.3.1

2006-08-17 Thread liyu
--- linux-2.6.17.7/Documentation/input/simple-hid.txt.noexist   
1970-01-01 08:00:00.0 +0800
+++ linux-2.6.17.7/Documentation/input/simple-hid.txt2006-08-17
20:24:36.0 +0800
@@ -0,0 +1,236 @@
+==
+HID device simple driver interface
+==
+
+
+Version
+
+
+This is the version 0.3.1
+
+--
+Overview
+--
+
+Under current HID device driver development means, We need write
+one new interrupt handler for each new HID device to report event to
+input subsystem. However, although the most of they can not merge into
+mainstream kernel tree, they have only some extended keys, e.g. many
+remote controllers. I think it seem break a fly on the wheel, which
+write one new interrupt handler for this reason.
+
+My basic idea is reuse the interrupt handler in hid-core.c. so writing
+driver for new simple HID device will be more easier, quickly, and do not
+need touch hid core.
+
+In essence, this interface just is some hooks in HID input core.
+
+   The hid-simple.h include this API. Before you use this interface,
you must
+include hid.h first.
+
+
+What's you will get from this interface.
+
+   
+Use me, you can:
+   
+1. Write the driver of USB input device without write code take
care of
+   details of setup and clear usage.
+2. A driver use this interface can be as a HID device input filter.
+3. Write USB force-feed driver without touch hid-input core.
however, this
+   feature is confilct with HID_FF.
+
+This interface can not support the more drivers handle one device
at same time
+yet. I can not sure if we really need this feature.
+
+
+The driver use this interface
+
+   
+So far, there are two drivers:
+1. MS Natural Ergonomic Keyboard 4000 driver. (usbnek4k.c)
+2. Betop BTP-2118 joystick force-feed driver. (btp2118.c)
+
+-
+Requires
+-
+
+Before use this interface, you must turn on these kernel configuration
+items:
+   
+CONFIG_HID_SIMPLE :  HID simple driver interface
+CONFIG_HID_SIMPLE_FF : HID simple driver interface force feedback
support
+   
+Note: You can see the latter only if you turn off CONFIG_HID_FF and
turn
+on CONFIG_HID_SIMPLE.
+
+--
+Register and unregister
+--
+
+1. Register a simple driver.
+
+int hidinput_register_simple_driver(struct hidinput_simple_driver
*simple)
+
+Like any driver register function, it register your driver to kernel,
+when the chance that match device come, your driver can probe it. At
least, you
+must fill the member of parameter simple : name.
+It return 0 mean register successfully. elsewise mean there have some
+failures in register process.   
+So far, this function only can return 0 and -EINVAL.
+   
+2. Unregister a simple driver.
+
+void hidinput_unregister_simple_driver(struct
hidinput_simple_driver *simple)
+
+Like any driver register function, it clean your driver from
kernel, and
+in this process, your driver will disconnect any device which it
matched. However,
+it do not free your memory of driver structure, that's your task.
+
+--
+Usage
+--
+
+Each simple driver have one data structure hidinput_simple_driver:
+   
+struct hidinput_simple_driver {
+/*
+ *  The members for implement only are ignored here,
+ *  please do not depend on them
+ */
+/* public */
+struct module *owner;
+char *name;
+int (*connect)(struct hid_device *, struct hid_input *);   
+void (*disconnect)(struct hid_device *, struct hid_input *);   
+void (*setup_usage)(struct hid_field *,   struct hid_usage *);   
+void (*clear_usage)(struct hid_field *,   struct hid_usage *);
+int (*pre_event)(const struct hid_device *, const struct hid_field *,
+const struct hid_usage *, const __s32,
+const struct pt_regs *regs);
+int (*post_event)(const struct hid_device *, const struct hid_field *,
+const struct hid_usage *, const __s32,
+const struct pt_regs *regs);
+   
+int (*open)(struct input_dev *dev);
+void (*close)(struct input_dev *dev);
+int (*upload_effect)(struct input_dev *dev, struct ff_effect
*effect);
+int (*erase_effect)(struct input_dev *dev, int effect_id);
+int (*flush)(struct input_dev *dev, struct file *file);
+int (*ff_event)(struct input_dev *dev, int type, int code, int
value);
+
+void *private;
+struct usb_device_id *id_table;
+struct usage_page_block *usage_page_table;
+};
+
+The data member description:
+
+struct module *owner;
+
+In 

[linux-usb-devel] [PATCH] usb: HID Simple Driver Interface for kernel-2.6.18-rc4 v0.3.1

2006-08-19 Thread liyu


There are some users ask for this patch can be applied on 2.6.18.x. This is 
they want.

In fact, this patch for 2.6.17.7, also can be applied on 2.6.17.6, 2.6.17.8, 
2.6.17.9 without any warning and error.
Moreover, it can be used for 2.6.18-rc4, but patch program will tell us some 
warning information.

Another patches:

[PATCH] usb: Betop BTP-2118 joystick force-feedback driver 20060817
[PATCH] usb: HID Simple Driver Interface 0.3.1 (Kconfig and Makefile) 20060817
[PATCH] usb: Microsoft Natural Ergonomic Keyboard 4000 Driver 0.3.1

They all can be patched on 2.6.18-rc4 fine without any change. Of course, you 
should use patch with -p1 option, not -p0.

Signed-off-by: Liyu [EMAIL PROTECTED]

diff -Naurp linux-2.6.18-rc4/drivers/usb/input.orig/hid-core.c 
linux-2.6.18-rc4/drivers/usb/input/hid-core.c
--- linux-2.6.18-rc4/drivers/usb/input.orig/hid-core.c  2006-08-19 
15:53:28.0 +0800
+++ linux-2.6.18-rc4/drivers/usb/input/hid-core.c   2006-08-19 
15:49:24.0 +0800
@@ -26,6 +26,7 @@
 #include asm/byteorder.h
 #include linux/input.h
 #include linux/wait.h
+#include linux/mutex.h
 
 #undef DEBUG
 #undef DEBUG_DATA
@@ -33,6 +34,7 @@
 #include linux/usb.h
 
 #include hid.h
+#include hid-simple.h
 #include linux/hiddev.h
 
 /*
@@ -46,6 +48,15 @@
 
 static char *hid_types[] = {Device, Pointer, Mouse, Device, Joystick,
Gamepad, Keyboard, Keypad, Multi-Axis 
Controller};
+
+/*
+ * The global data structure for simple device driver interface.
+ */
+static DEFINE_MUTEX(matched_devices_lock);
+static DEFINE_MUTEX(simple_drivers_lock);
+static struct list_head matched_devices_list;
+static struct list_head simple_drivers_list;
+
 /*
  * Module parameters.
  */
@@ -785,8 +796,18 @@ static __inline__ int search(__s32 *arra
 static void hid_process_event(struct hid_device *hid, struct hid_field *field, 
struct hid_usage *usage, __s32 value, int interrupt, struct pt_regs *regs)
 {
hid_dump_input(usage, value);
-   if (hid-claimed  HID_CLAIMED_INPUT)
+   if (hid-claimed  HID_CLAIMED_INPUT) {
+   /* event filter here */
+   if (hid-simple) {
+   if (hid-simple-pre_event 
+   !hid-simple-pre_event(hid, field, usage, 
+   value, regs))
+   return;
+   }
hidinput_hid_event(hid, field, usage, value, regs);
+   if (hid-simple  hid-simple-post_event)
+   hid-simple-post_event(hid, field, usage, value, regs);
+   }
if (hid-claimed  HID_CLAIMED_HIDDEV  interrupt)
hiddev_hid_event(hid, field, usage, value, regs);
 }
@@ -832,7 +853,6 @@ static void hid_input_field(struct hid_d
 field-usage[field-value[n] - min].hid
 search(value, field-value[n], count))
hid_process_event(hid, field, 
field-usage[field-value[n] - min], 0, interrupt, regs);
-
if (value[n] = min  value[n] = max
 field-usage[value[n] - min].hid
 search(field-value, value[n], count))
@@ -1988,8 +2008,33 @@ static void hid_disconnect(struct usb_in
del_timer_sync(hid-io_retry);
flush_scheduled_work();
 
-   if (hid-claimed  HID_CLAIMED_INPUT)
+   if (hid-claimed  HID_CLAIMED_INPUT) {
+   struct list_head *node;
+   struct matched_device *matched;
+
+   matched = NULL;
+   mutex_lock(matched_devices_lock);
+   list_for_each(node, matched_devices_list) {
+   matched = list_entry(node, struct matched_device, node);
+   if (matched-intf == intf) {
+   list_del(matched-node);
+   break;
+   }
+   matched = NULL;
+   }
+   mutex_unlock(matched_devices_lock);
+   /* disconnect simple device driver if need */
+   if (matched  hid-simple) {
+   hidinput_simple_driver_disconnect(hid);
+   module_put(hid-simple-owner);
+   hidinput_simple_driver_pop(hid, matched);
+   }
+   if (matched) {
+   matched-intf = NULL;
+   kfree(matched);
+   }
hidinput_disconnect(hid);
+   }
if (hid-claimed  HID_CLAIMED_HIDDEV)
hiddev_disconnect(hid);
 
@@ -2002,6 +2047,141 @@ static void hid_disconnect(struct usb_in
hid_free_device(hid);
 }
 
+#ifdef CONFIG_HID_SIMPLE
+static int hidinput_simple_driver_bind_one(struct hidinput_simple_driver 
*simple,
+   struct hid_device *hid,
+   struct matched_device *matched

Re: [linux-usb-devel] [PATCH] usb/hid: The HID Simple Driver Interface 0.3.2 (core)

2006-10-08 Thread Liyu
Dmitry Torokhov wrote:
 Yes, I'd consider it a bug. Tearing down and re-creating input device
 generates proper hotplug notifications and userspace needs to respect
 them as capabilities may change even if ids stay the same. For example
 playing with atkbd's scroll attribute will regenerate an input device
 with[out] scroll capabilities but its input_id structure will stay the
 same. 
   
So many people said I have some wrongs here ;) it should be truth.

I found our focus is howto or when send notification to userspace.
Intuitional, to reload such device is rather ugly means, it should have
one hotplug message for this case,
and userspace handle it. If only look from design, I will agree with my
argument, however, if also look from compatibility, I think I must agree
your arguments.

At last, you win! :D
   
I am going to reload.
   

PS: I found a behavior of usb subsystem, I can not sure whether it is
normal.
After I remove usbhid.ko, the uhci_hcd will reset device repeatly.
   

usbcore: registered new driver usbhid
/usr/src/redhat/BUILD/linux-2.6.18/drivers/usb/input/hid-core.c:
v2.6:USB HID core driver
usb 5-2: reset low speed USB device using uhci_hcd and address 3
usb 5-2: reset low speed USB device using uhci_hcd and address 3
usb 5-2: reset low speed USB device using uhci_hcd and address 3
usb 5-2: reset low speed USB device using uhci_hcd and address 3
usb 5-2: reset low speed USB device using uhci_hcd and address 3

Goodluck.

-Liyu

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] usb/hid: The HID Simple Driver Interface 0.3.2 (core)

2006-10-08 Thread Liyu
Dmitry Torokhov wrote:
 Yes, I'd consider it a bug. Tearing down and re-creating input device
 generates proper hotplug notifications and userspace needs to respect
 them as capabilities may change even if ids stay the same. For example
 playing with atkbd's scroll attribute will regenerate an input device
 with[out] scroll capabilities but its input_id structure will stay the
 same. 
   
So many people said I have some wrongs here ;) it should be truth.

I found our focus is howto or when send notification to userspace.
Intuitional, to reload such device is rather ugly means, it should have
one hotplug message for this case,
and userspace handle it. If only look from design, I will agree with my
argument, however, if also look from compatibility, I think I must agree
your arguments.

At last, you win! :D
   
I am going to reload.
   

PS: I found a behavior of usb subsystem, I can not sure whether it is
normal.
After I remove usbhid.ko, the uhci_hcd will reset device repeatly.
   

usbcore: registered new driver usbhid
/usr/src/redhat/BUILD/linux-2.6.18/drivers/usb/input/hid-core.c:
v2.6:USB HID core driver
usb 5-2: reset low speed USB device using uhci_hcd and address 3
usb 5-2: reset low speed USB device using uhci_hcd and address 3
usb 5-2: reset low speed USB device using uhci_hcd and address 3
usb 5-2: reset low speed USB device using uhci_hcd and address 3
usb 5-2: reset low speed USB device using uhci_hcd and address 3

Goodluck.

-Liyu

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] usb/hid: The HID Simple Driver Interface 0.3.2 (core)

2006-10-08 Thread Liyu
Anssi Hannula wrote:
 One possibility is to do that with symbol_request() and friends. That
 would not be pretty though, imho.

 DVB subsystem uses that currently to load frontend modules dynamically,
 see dvb_attach() and dvb_frontend_detach() in
 drivers/media/dvb/dvb-core/dvbdev.h and
 drivers/media/dvb/dvb-core/dvb_frontend.c.

   
This means also can load module dynamically. In apparently, I think it
have two weaknesses:
   
1. It require module have one exported symbol at least.
2. We must handle life cycle of module by myself.

Is it right?

Goodluck

-Liyu

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] usb/hid: The HID Simple Driver Interface 0.3.2 (core)

2006-10-10 Thread Liyu
Hi.

In hid-input, It seem we only call input_allocate_device(), but not
call input_free_device() at anywhere. Is there a memory leak here? Even,
I can not found this invoke in drivers/usb/hid*.c.

Moreover, I found many usb input device driver do not call
input_free_device() at all, except when it failed to init itself.
   
Are these purposely?

-Liyu



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] usb/hid: The HID Simple Driver Interface 0.3.2 (core)

2006-10-10 Thread Liyu
Hi.

In hid-input, It seem we only call input_allocate_device(), but not
call input_free_device() at anywhere. Is there a memory leak here? Even,
I can not found this invoke in drivers/usb/hid*.c.

Moreover, I found many usb input device driver do not call
input_free_device() at all, except when it failed to init itself.
   
Are these purposely?

-Liyu




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] usb/hid: The HID Simple Driver Interface 0.3.2 (core)

2006-10-10 Thread Liyu
Liyu wrote:
 Hi.

 In hid-input, It seem we only call input_allocate_device(), but not
 call input_free_device() at anywhere. Is there a memory leak here? Even,
 I can not found this invoke in drivers/usb/hid*.c.



I see. it is freed by input_class.release() method. So mysterious.

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] usb/hid: The HID Simple Driver Interface 0.4.0 documentation

2006-10-12 Thread Liyu
Signed-off-by: Liyu [EMAIL PROTECTED]

--- linux-2.6.18/Documentation/input/no-such.txt 1970-01-01
08:00:00.0 +0800
+++ linux-2.6.18/Documentation/input/simple-hid.txt 2006-10-12
09:34:42.0 +0800
@@ -0,0 +1,251 @@
+==
+HID device simple driver interface
+==
+
+
+Note
+
+
+ If you just begin to study from writing input device driver, please
see the
+input-programming.txt, I am afraid this is not you want, do not confuse
with the
+simple in this name.
+
+
+Version
+
+
+ This is the version 0.4.0
+
+--
+Overview
+--
+
+ Under standard HID device driver development means, we need to write
+one interrupt handler for each new HID device to report event to
+input subsystem. However, although the most of they can not merge into
+mainstream kernel tree, they have only some extended keys, e.g. many
+remote controllers. I think it seem break a fly on the wheel, which
+write one new interrupt handler for this reason.
+
+ The basic idea is reuse the interrupt handler in hid-core.c. so writing
+driver for new simple HID device will be more easier, quickly, and do not
+need touch hid core.
+
+ In essence, this interface just is some hooks in HID core.
+
+ The hid-simple.h include this API. But, defore use this interface, you
must
+include hid.h first.
+
+
+What's you will get from this interface.
+
+
+ Use me, you can:
+
+ 1. Write the driver of USB input device without write code take care of
+ details of setup and clear usage.
+ 2. A driver use this interface can be as a HID device input filter.
+ 3. Write USB force-feed driver without touch hid-input core. however, this
+ feature is confilct with HID_FF.
+
+ This interface can not support the more drivers handle one device at
same time
+yet. I can not sure if we really need this feature.
+
+
+The driver use this interface
+
+
+ So far, there are two drivers:
+ 1. MS Natural Ergonomic Keyboard 4000 driver. (usbnek4k.c)
+ 2. Betop BTP-2118 joystick force-feed driver. (btp2118.c)
+
+-
+Requires
+-
+
+ Before use this interface, you must turn on these kernel configuration
+items:
+
+ CONFIG_HID_SIMPLE : HID simple driver interface
+ CONFIG_HID_SIMPLE_FF : HID simple driver interface force feedback support
+
+ Note: You can see the latter only if you turn off CONFIG_HID_FF and turn
+on CONFIG_HID_SIMPLE.
+
+--
+Register and unregister
+--
+
+1. Register a simple driver.
+
+ int hidinput_register_simple_driver(struct hidinput_simple_driver *simple)
+
+ Like any driver register function, it register your driver to kernel,
+when the chance that match device come, your driver can probe it. At
least, you
+must fill the member of parameter simple : name.
+ Return 0 mean register successfully. elsewise mean there have some
+failures in register process.
+ So far, this function only can return 0 and -EINVAL.
+ When you driver matched one device, it will reregister it into input
+subsystem (see the function hidinput_reconnect_core(), if you want).
+
+2. Unregister a simple driver.
+
+ void hidinput_unregister_simple_driver(struct hidinput_simple_driver
*simple)
+
+ Like any driver register function, it clean your driver from kernel, and
+in this process, your driver will disconnect any device which it
matched. However,
+it do not free your memory of driver structure, that's your task.
+ This may reregister the device into input subsystem (see the function
+hidinput_reconnect_core(), if you want).
+
+--
+Usage
+--
+
+ Each simple driver have one data structure hidinput_simple_driver:
+
+struct hidinput_simple_driver {
+ /*
+ * The members for implement only are ignored here,
+ * please do not depend on them
+ */
+ /* public */
+ struct module *owner;
+ char *name;
+ int (*connect)(struct hid_device *, struct hid_input *);
+ void (*disconnect)(struct hid_device *, struct hid_input *);
+ void (*setup_usage)(struct hid_field *, struct hid_usage *);
+ void (*clear_usage)(struct hid_field *, struct hid_usage *);
+ int (*pre_event)(const struct hid_device *, const struct hid_field *,
+ const struct hid_usage *, const __s32,
+ const struct pt_regs *regs);
+ int (*post_event)(const struct hid_device *, const struct hid_field *,
+ const struct hid_usage *, const __s32,
+ const struct pt_regs *regs);
+
+ int (*open)(struct input_dev *dev);
+ void (*close)(struct input_dev *dev);
+ int (*upload_effect)(struct input_dev *dev, struct ff_effect *effect);
+ int (*erase_effect)(struct input_dev *dev, int effect_id);
+ int (*flush)(struct input_dev *dev, struct file *file);
+ int (*ff_event)(struct input_dev *dev, int type, int

Re: [linux-usb-devel] [PATCH] usb/hid:Microsoft Natural Ergonomic Keyboard 4000 Driver 0.5.0

2007-03-05 Thread Liyu
Robert Marquardt wrote:
 Li Yu wrote:
 +#define USAGE_ZOOM_IN0x22d

 I have a 100K file of probably all HID usages available.
 It started its life as a conversion to Pascal of hidusage.h but is now
 10 times bigger than that file. I can easily convert this back to C.
 Is there any interest in the file? Is it completely legal to do so?

Thanks.

It is great resource, and I guess its legality is decided by the license
of source file.

-Li Yu

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel


Re: [linux-usb-devel] [PATCH] usb/hid:Microsoft Natural Ergonomic Keyboard 4000 Driver 0.5.0

2007-03-05 Thread Liyu

I think the source file should be the original data source (MS file),
The Pascal file is one derivation of from, it still may be under the MS
license.

That is my guess, I am not familiar with the legal very well.


Robert Marquardt wrote:
 Liyu wrote:

 It is great resource, and I guess its legality is decided by the license
 of source file.

 The question is What is the source file?. My Pascal conversion or
 the MS original. The Pascal conversion is only using the names from
 Microsoft so the file is compatible but not a copy.
 I will put the conversion back to C under the GPL of course.

 If it is legal i want the file in the kernel sources to encourage all
 developers (kernel or user) to use symolic usage names instead of hex
 cvalues.



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT  business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.phpp=sourceforgeCID=DEVDEV
___
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel