USB Raw HID

2016-02-02 Thread Suresh Gupta
I want to write end to end raw HID interface for some specific user defined 
data communication on USB. Can anyone help me or point me
 
1. What all changes I need in device/host driver.
2. How it interact with application at device side.
3. How it interact with Host side application.
 
Any clue and pointers helps.
 
Thanks
SuresH


--
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: USB Raw HID

2016-02-02 Thread Suresh Gupta


> -Original Message-
> From: Greg KH [mailto:gre...@linuxfoundation.org]
> Sent: Tuesday, February 02, 2016 10:19 PM
> To: Suresh Gupta <suresh.gu...@nxp.com>; suresh gupta
> <sureshgupta...@gmail.com>
> Cc: linux-usb@vger.kernel.org
> Subject: Re: USB Raw HID
> 
> On Tue, Feb 02, 2016 at 08:28:51AM +, Suresh Gupta wrote:
> > I want to write end to end raw HID interface for some specific user
> > defined data communication on USB. Can anyone help me or point me
> >
> > 1. What all changes I need in device/host driver.
> > 2. How it interact with application at device side.
> > 3. How it interact with Host side application.
> 
> What did you try that did not work for you?  The hidraw interface should
> allow you to do this from userspace with no kernel changes at all.

Thanks Greg for reply,

Actually I want to communicate some my defined data packets between HOST and 
GADGET on HID.
For that I use /dev/rawhid* interface and I am able to get some packets here. 

So my question here is, do we have any driver and application on gadget side 
which can be used to send/receive my defined packets to and from host.
Or I need to write my own driver which will define report_desc and some my own 
application which will read and write from /dev/hidg*.  

Also what will be the maximum packet size in HID for super speed USB.( 8 bytes 
for low-speed devices and 64 bytes for high-speed devices)
One more query, is HID would work in super speed. I do not find this 
information in HID docs.  

Thanks
SuresH

> 
> good luck,
> 
> 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


USB RAW HID

2016-02-01 Thread suresh gupta
I want to write a end to end raw HID interface for some specific user
defined data communication on USB. Can any one help me or point me

1. What all changes I need in device/host driver.
2. How it interact with application at device side.
3. How it interact with Host side application.

Any clue and pointers helps.

Thanks
--
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


[PATCH] USB : Gadget : fsl: Fix the fault issue on rmmod

2014-04-02 Thread Suresh Gupta
completion in udc_controller-done should be assign with proper
value before complete called. The complete called in fsl_udc_release
which intern called from usb_del_gadget_udc, so moving assignment
before calling usb_del_gadget_udc

Signed-off-by: Suresh Gupta suresh.gu...@freescale.com
---
 drivers/usb/gadget/fsl_udc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index 5a0f89c..e55d04f 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2537,8 +2537,8 @@ static int __exit fsl_udc_remove(struct platform_device 
*pdev)
if (!udc_controller)
return -ENODEV;
 
-   usb_del_gadget_udc(udc_controller-gadget);
udc_controller-done = done;
+   usb_del_gadget_udc(udc_controller-gadget);
 
fsl_udc_clk_release();
 
-- 
1.8.4.1


--
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


[PATCH v2] usb: gadget: fsl: Set dma_ops for FSL USB Gadget Device

2014-03-20 Thread Suresh Gupta
From: Suresh Gupta b42...@freescale.com

DMA mapping functions are moved to common place in udc_core.c
which expect the DMA operation of gadget device

Signed-off-by: Suresh Gupta b42...@freescale.com
---
Changes from previous version:
* Added description

 drivers/usb/gadget/fsl_udc_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index d68aa77..35cb972 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2456,6 +2456,7 @@ static int __init fsl_udc_probe(struct platform_device 
*pdev)
/* Setup gadget.dev and register with kernel */
dev_set_name(udc_controller-gadget.dev, gadget);
udc_controller-gadget.dev.of_node = pdev-dev.of_node;
+   set_dma_ops(udc_controller-gadget.dev, pdev-dev.archdata.dma_ops);
 
if (!IS_ERR_OR_NULL(udc_controller-transceiver))
udc_controller-gadget.is_otg = 1;
-- 
1.8.4.1


--
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


[PATCH v2] USB: Gadget: fsl driver pullup fix

2014-03-20 Thread Suresh Gupta
This fix the fsl usb gadget driver in a way that the usb device
will be only pulled up on requests only when vbus is powered

Signed-off-by: Suresh Gupta suresh.gu...@freescale.com
---
Changes from previous version:
* Removed re-factored code, Will send another patch for re-factoring
  duplicated code
* Changed Description 

 drivers/usb/gadget/fsl_udc_core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index 35cb972..49d66779 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -1219,6 +1219,10 @@ static int fsl_pullup(struct usb_gadget *gadget, int 
is_on)
struct fsl_udc *udc;
 
udc = container_of(gadget, struct fsl_udc, gadget);
+
+   if(!udc-vbus_active)
+   return -EOPNOTSUPP;
+
udc-softconnect = (is_on != 0);
if (can_pullup(udc))
fsl_writel((fsl_readl(dr_regs-usbcmd) | USB_CMD_RUN_STOP),
-- 
1.8.4.1


--
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


[PATCH v3] USB: Gadget: fsl driver pullup fix

2014-03-20 Thread Suresh Gupta
This fix the fsl usb gadget driver in a way that the usb device
will be only pulled up on requests only when vbus is powered

Signed-off-by: Suresh Gupta suresh.gu...@freescale.com
---
Changes from previous version:
* fixed checkpatch error

 drivers/usb/gadget/fsl_udc_core.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index 35cb972..5a0f89c 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -1219,6 +1219,10 @@ static int fsl_pullup(struct usb_gadget *gadget, int 
is_on)
struct fsl_udc *udc;
 
udc = container_of(gadget, struct fsl_udc, gadget);
+
+   if (!udc-vbus_active)
+   return -EOPNOTSUPP;
+
udc-softconnect = (is_on != 0);
if (can_pullup(udc))
fsl_writel((fsl_readl(dr_regs-usbcmd) | USB_CMD_RUN_STOP),
-- 
1.8.4.1


--
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


[PATCH] USB: Gadget: fsl driver pullup fix

2014-03-13 Thread Suresh Gupta
Attached is a small fix for the fsl usb gadget driver. This fix the
driver in a way that the usb device will be only pulled up on requests
like other usb gadget drivers do.
This is necessary, because the device information is not always
available until an application is up and running which provides this
datas.

Signed-off-by: Stefani Seibold stef...@seibold.net
Signed-off-by: Suresh Gupta suresh.gu...@freescale.com
---
 drivers/usb/gadget/fsl_udc_core.c | 38 +-
 1 file changed, 21 insertions(+), 17 deletions(-)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index 35cb972..9a93727 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -153,6 +153,21 @@ static inline void fsl_set_accessors(struct 
fsl_usb2_platform_data *pdata) {}
 /
  * Internal Used Function
 /
+static int can_pullup(struct fsl_udc *udc)
+{
+   return udc-driver  udc-softconnect  udc-vbus_active;
+}
+
+static void set_pullup(struct fsl_udc *udc)
+{
+   if (can_pullup(udc))
+   fsl_writel((fsl_readl(dr_regs-usbcmd) | USB_CMD_RUN_STOP),
+   dr_regs-usbcmd);
+   else
+   fsl_writel((fsl_readl(dr_regs-usbcmd)  ~USB_CMD_RUN_STOP),
+   dr_regs-usbcmd);
+}
+
 /*-
  * done() - retire a request; caller blocked irqs
  * @status : request status to be set, only works when
@@ -283,6 +298,8 @@ static int dr_controller_setup(struct fsl_udc *udc)
tmp = ~USB_CMD_RUN_STOP;
fsl_writel(tmp, dr_regs-usbcmd);
 
+   set_pullup(udc);
+
tmp = fsl_readl(dr_regs-usbcmd);
tmp |= USB_CMD_CTRL_RESET;
fsl_writel(tmp, dr_regs-usbcmd);
@@ -1168,11 +1185,6 @@ static int fsl_wakeup(struct usb_gadget *gadget)
return 0;
 }
 
-static int can_pullup(struct fsl_udc *udc)
-{
-   return udc-driver  udc-softconnect  udc-vbus_active;
-}
-
 /* Notify controller that VBUS is powered, Called by whatever
detects VBUS sessions */
 static int fsl_vbus_session(struct usb_gadget *gadget, int is_active)
@@ -1184,12 +1196,7 @@ static int fsl_vbus_session(struct usb_gadget *gadget, 
int is_active)
spin_lock_irqsave(udc-lock, flags);
VDBG(VBUS %s, is_active ? on : off);
udc-vbus_active = (is_active != 0);
-   if (can_pullup(udc))
-   fsl_writel((fsl_readl(dr_regs-usbcmd) | USB_CMD_RUN_STOP),
-   dr_regs-usbcmd);
-   else
-   fsl_writel((fsl_readl(dr_regs-usbcmd)  ~USB_CMD_RUN_STOP),
-   dr_regs-usbcmd);
+   set_pullup(udc);
spin_unlock_irqrestore(udc-lock, flags);
return 0;
 }
@@ -1220,12 +1227,7 @@ static int fsl_pullup(struct usb_gadget *gadget, int 
is_on)
 
udc = container_of(gadget, struct fsl_udc, gadget);
udc-softconnect = (is_on != 0);
-   if (can_pullup(udc))
-   fsl_writel((fsl_readl(dr_regs-usbcmd) | USB_CMD_RUN_STOP),
-   dr_regs-usbcmd);
-   else
-   fsl_writel((fsl_readl(dr_regs-usbcmd)  ~USB_CMD_RUN_STOP),
-   dr_regs-usbcmd);
+   set_pullup(udc);
 
return 0;
 }
@@ -2286,6 +2288,8 @@ static int __init struct_udc_setup(struct fsl_udc *udc,
udc-usb_state = USB_STATE_POWERED;
udc-ep0_dir = 0;
udc-remote_wakeup = 0; /* default to 0 on reset */
+   udc-vbus_active = 1;
+   udc-softconnect = 1;
 
return 0;
 }
-- 
1.8.4.1


--
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


[PATCH] USB : Gadget: fsl: add information message

2014-03-13 Thread Suresh Gupta
Message helps to understand that the Freescale Gadget driver
is up without any error.

Signed-off-by: Suresh Gupta suresh.gu...@freescale.com
---
 drivers/usb/gadget/fsl_udc_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index 9a93727..455d0ab 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2503,6 +2503,7 @@ static int __init fsl_udc_probe(struct platform_device 
*pdev)
goto err_del_udc;
 
create_proc_file();
+   pr_info(%s (%s)\n, driver_desc, DRIVER_VERSION);
return 0;
 
 err_del_udc:
-- 
1.8.4.1


--
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


[PATCH] usb: gadget: fsl: Add FSL USB Gadget entry in platform device id

2014-03-13 Thread Suresh Gupta
From: Suresh Gupta b42...@freescale.com

Add FSL USB Gadget entry in platform device id table

Signed-off-by: Suresh Gupta b42...@freescale.com
---
 drivers/usb/gadget/fsl_udc_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index b7dea4e..35b20e6 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2654,6 +2654,8 @@ static const struct platform_device_id fsl_udc_devtype[] 
= {
}, {
.name = imx-udc-mx51,
}, {
+   .name = fsl-usb2-udc,
+   }, {
/* sentinel */
}
 };
-- 
1.7.11.7


--
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


[PATCH] usb: gadget: fsl: Set dma_ops for FSL USB Gadget Device

2014-03-13 Thread Suresh Gupta
From: Suresh Gupta b42...@freescale.com

Signed-off-by: Suresh Gupta b42...@freescale.com
---
 drivers/usb/gadget/fsl_udc_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index 35b20e6..2a43d9d 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2456,6 +2456,7 @@ static int __init fsl_udc_probe(struct platform_device 
*pdev)
/* Setup gadget.dev and register with kernel */
dev_set_name(udc_controller-gadget.dev, gadget);
udc_controller-gadget.dev.of_node = pdev-dev.of_node;
+   set_dma_ops(udc_controller-gadget.dev, pdev-dev.archdata.dma_ops);
 
if (!IS_ERR_OR_NULL(udc_controller-transceiver))
udc_controller-gadget.is_otg = 1;
-- 
1.7.11.7


--
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


[PATCH] fsl/usb: Add FSL USB Gadget entry in platform device id

2013-11-18 Thread Suresh Gupta
Add FSL USB Gadget entry in platform device id table

Signed-off-by: Suresh Gupta suresh.gu...@freescale.com
---
 drivers/usb/gadget/fsl_udc_core.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index 36ac7cf..0b0a871 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2654,6 +2654,8 @@ static const struct platform_device_id fsl_udc_devtype[] 
= {
}, {
.name = imx-udc-mx51,
}, {
+   .name = fsl-usb2-udc,
+   }, {
/* sentinel */
}
 };
-- 
1.7.11.7



--
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


[PATCH] fsl/usb: Set dma_ops for FSL USB Gadget Device

2013-11-18 Thread Suresh Gupta
Signed-off-by: Suresh Gupta suresh.gu...@freescale.com
---
 drivers/usb/gadget/fsl_udc_core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/fsl_udc_core.c 
b/drivers/usb/gadget/fsl_udc_core.c
index 0b0a871..0217c46 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -2456,6 +2456,7 @@ static int __init fsl_udc_probe(struct platform_device 
*pdev)
/* Setup gadget.dev and register with kernel */
dev_set_name(udc_controller-gadget.dev, gadget);
udc_controller-gadget.dev.of_node = pdev-dev.of_node;
+   set_dma_ops(udc_controller-gadget.dev, pdev-dev.archdata.dma_ops);
 
if (!IS_ERR_OR_NULL(udc_controller-transceiver))
udc_controller-gadget.is_otg = 1;
-- 
1.7.11.7



--
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