Re: [RFC ebeam PATCH v3 2/2] input: misc: New USB eBeam input driver.

2012-08-07 Thread Yann Cantin
Le 07/08/2012 03:43, Dmitry Torokhov a écrit :
> On Tue, Aug 07, 2012 at 02:56:40AM +0200, Yann Cantin wrote:
>> Hi,
>>
>> Le 06/08/2012 23:43, Greg KH a écrit :
>>> On Mon, Aug 06, 2012 at 11:21:44PM +0200, Yann Cantin wrote:

 Signed-off-by: Yann Cantin 
 ---
  drivers/input/misc/ebeam.c |  764 
 
  1 file changed, 764 insertions(+)
  create mode 100644 drivers/input/misc/ebeam.c
>>>
>>> What adds this file to the build?
>>  
>> Sorry, i don't get it : what do you mean ?
> 
> Greg meant that you forgot to include Makefile and Kconfig changes with
> this patch.
 
My bad. Looked twice and yet miss that...
Will be in v4. For info :

---
diff --git a/drivers/input/misc/Kconfig b/drivers/input/misc/Kconfig
index 7c0f1ec..1e575e4 100644
--- a/drivers/input/misc/Kconfig
+++ b/drivers/input/misc/Kconfig
@@ -83,6 +83,22 @@ config INPUT_BMA150
  To compile this driver as a module, choose M here: the
  module will be called bma150.
 
+config INPUT_EBEAM_USB
+   tristate "USB eBeam driver"
+   depends on USB_ARCH_HAS_HCD
+   select USB
+   help
+ Say Y here if you have a USB eBeam pointing device and want to
+ use it without any proprietary user space tools.
+
+ Have a look at  for
+ a usage description and the required user-space tools.
+
+ Currently, only the Classic Projection model is supported.
+
+ To compile this driver as a module, choose M here: the
+ module will be called ebeam.
+
 config INPUT_PCSPKR
tristate "PC Speaker support"
depends on PCSPKR_PLATFORM
diff --git a/drivers/input/misc/Makefile b/drivers/input/misc/Makefile
index 83fe6f5..2aa9813 100644
--- a/drivers/input/misc/Makefile
+++ b/drivers/input/misc/Makefile
@@ -24,6 +24,7 @@ obj-$(CONFIG_INPUT_CMA3000_I2C)   += 
cma3000_d0x_i2c.o
 obj-$(CONFIG_INPUT_COBALT_BTNS)+= cobalt_btns.o
 obj-$(CONFIG_INPUT_DA9052_ONKEY)   += da9052_onkey.o
 obj-$(CONFIG_INPUT_DM355EVM)   += dm355evm_keys.o
+obj-$(CONFIG_INPUT_EBEAM_USB)  += ebeam.o
 obj-$(CONFIG_INPUT_GP2A)   += gp2ap002a00f.o
 obj-$(CONFIG_INPUT_GPIO_TILT_POLLED)   += gpio_tilt_polled.o
 obj-$(CONFIG_HP_SDC_RTC)   += hp_sdc_rtc.o

-- 
Yann Cantin
A4FEB47F
--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC ebeam PATCH v3 2/2] input: misc: New USB eBeam input driver.

2012-08-06 Thread Dmitry Torokhov
On Tue, Aug 07, 2012 at 02:56:40AM +0200, Yann Cantin wrote:
> Hi,
> 
> Le 06/08/2012 23:43, Greg KH a écrit :
> > On Mon, Aug 06, 2012 at 11:21:44PM +0200, Yann Cantin wrote:
> >>
> >> Signed-off-by: Yann Cantin 
> >> ---
> >>  drivers/input/misc/ebeam.c |  764 
> >> 
> >>  1 file changed, 764 insertions(+)
> >>  create mode 100644 drivers/input/misc/ebeam.c
> > 
> > What adds this file to the build?
>  
> Sorry, i don't get it : what do you mean ?

Greg meant that you forgot to include Makefile and Kconfig changes with
this patch.

-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC ebeam PATCH v3 2/2] input: misc: New USB eBeam input driver.

2012-08-06 Thread Yann Cantin
Hi,

Le 06/08/2012 23:43, Greg KH a écrit :
> On Mon, Aug 06, 2012 at 11:21:44PM +0200, Yann Cantin wrote:
>>
>> Signed-off-by: Yann Cantin 
>> ---
>>  drivers/input/misc/ebeam.c |  764 
>> 
>>  1 file changed, 764 insertions(+)
>>  create mode 100644 drivers/input/misc/ebeam.c
> 
> What adds this file to the build?
 
Sorry, i don't get it : what do you mean ?

> greg k-h

-- 
Yann Cantin
A4FEB47F
--
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC ebeam PATCH v3 2/2] input: misc: New USB eBeam input driver.

2012-08-06 Thread Greg KH
On Mon, Aug 06, 2012 at 11:21:44PM +0200, Yann Cantin wrote:
> 
> Signed-off-by: Yann Cantin 
> ---
>  drivers/input/misc/ebeam.c |  764 
> 
>  1 file changed, 764 insertions(+)
>  create mode 100644 drivers/input/misc/ebeam.c

What adds this file to the build?

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC ebeam PATCH v3 2/2] input: misc: New USB eBeam input driver.

2012-08-06 Thread Yann Cantin

Signed-off-by: Yann Cantin 
---
 drivers/input/misc/ebeam.c |  764 
 1 file changed, 764 insertions(+)
 create mode 100644 drivers/input/misc/ebeam.c

diff --git a/drivers/input/misc/ebeam.c b/drivers/input/misc/ebeam.c
new file mode 100644
index 000..54e2cd6
--- /dev/null
+++ b/drivers/input/misc/ebeam.c
@@ -0,0 +1,764 @@
+/**
+ *
+ * eBeam driver
+ *
+ * Copyright (C) 2012 Yann Cantin (yann.can...@laposte.net)
+ *
+ * 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.
+ *
+ *  based on
+ *
+ * usbtouchscreen.c by Daniel Ritz 
+ * aiptek.c (sysfs/settings) by Chris Atenasio 
+ *  Bryan W. Headley 
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define DRIVER_AUTHOR  "Yann Cantin "
+#define DRIVER_DESC"USB eBeam Driver"
+
+/* Common values for eBeam devices */
+#define REPT_SIZE  8   /* packet size*/
+#define MIN_RAW_X  0   /* raw coordinates ranges */
+#define MAX_RAW_X  0x
+#define MIN_RAW_Y  0
+#define MAX_RAW_Y  0x
+
+
+#define USB_VENDOR_ID_EFI 0x2650   /* Electronics For Imaging, Inc   */
+#define USB_DEVICE_ID_EFI_CLASSIC  0x1311   /* Classic projection "La banane" 
*/
+
+#define EBEAM_BTN_TIP  0x1  /* tip*/
+#define EBEAM_BTN_LIT  0x2  /* little */
+#define EBEAM_BTN_BIG  0x4  /* big*/
+
+/* ebeam settings */
+struct ebeam_settings {
+   int min_x;  /* computed coordinates ranges for the input layer */
+   int max_x;
+   int min_y;
+   int max_y;
+
+   /* H matrix */
+   s64 h1;
+   s64 h2;
+   s64 h3;
+   s64 h4;
+   s64 h5;
+   s64 h6;
+   s64 h7;
+   s64 h8;
+   s64 h9;
+};
+
+/* ebeam device */
+struct ebeam_device {
+   unsigned char*data;
+   dma_addr_t   data_dma;
+   unsigned char*buffer;
+   int  buf_len;
+   struct urb   *irq;
+   struct usb_interface *interface;
+   struct input_dev *input;
+   char name[128];
+   char phys[64];
+   void *priv;
+
+   struct ebeam_settingscursetting;/* device's current settings */
+   struct ebeam_settingsnewsetting;/* ... and new ones  */
+
+   bool calibrated;/* false : send raw  */
+   /* true  : send computed */
+
+   u16  raw_x, raw_y;  /* raw coordinates   */
+   int  x, y;  /* computed coordinates  */
+   int  btn_map;   /* internal buttons map  */
+};
+
+/* device types */
+enum {
+   DEVTYPE_CLASSIC,
+};
+
+static const struct usb_device_id ebeam_devices[] = {
+   {USB_DEVICE(USB_VENDOR_ID_EFI, USB_DEVICE_ID_EFI_CLASSIC),
+   .driver_info = DEVTYPE_CLASSIC},
+   {}
+};
+
+static void ebeam_init_settings(struct ebeam_device *ebeam)
+{
+   ebeam->calibrated = false;
+
+   /* Init (x,y) min/max to raw ones */
+   ebeam->cursetting.min_x = ebeam->newsetting.min_x = MIN_RAW_X;
+   ebeam->cursetting.max_x = ebeam->newsetting.max_x = MAX_RAW_X;
+   ebeam->cursetting.min_y = ebeam->newsetting.min_y = MIN_RAW_Y;
+   ebeam->cursetting.max_y = ebeam->newsetting.max_y = MAX_RAW_Y;
+
+   /* Safe values for the H matrix (Identity) */
+   ebeam->cursetting.h1 = ebeam->newsetting.h1 = 1;
+   ebeam->cursetting.h2 = ebeam->newsetting.h2 = 0;
+   ebeam->cursetting.h3 = ebeam->newsetting.h3 = 0;
+
+   ebeam->cursetting.h4 = ebeam->newsetting.h4 = 0;
+   ebeam->cursetting.h5 = ebeam->newsetting.h5 = 1;
+   ebeam->cursetting.h6 = ebeam->newsetting.h6 = 0;
+
+   ebeam->cursetting.h7 = ebeam->newsetting.h7 = 0;
+   ebeam->cursetting.h8 = ebeam->newsetting.h8 = 0;
+   ebeam->cursetting.h9 = ebeam->newsetting.h9 = 1;
+}
+
+static void ebeam_setup_input(struct ebeam_device *ebeam,
+ struct input_dev *input_dev)
+{
+   unsigned long flags;
+
+   /* Take event lock while modifying parameters */
+   spin_lock_irqsave(&input_dev->event_lock, flags);
+
+   /* Properties */
+   set_bit(INPUT_PROP_DIRECT,  input_dev->propbit);
+
+   /* Events generated */
+   set_bit(EV_KEY, input_dev->evbit);
+   set_bit(EV_ABS, input_dev->evbit);
+
+   /* Keys */
+   set_bit(BTN_LEFT,   in