[no subject]

2017-10-14 Thread prabhu kalyan
unsubscripted
--
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: g_hid loading unloading crash

2017-09-11 Thread prabhu kalyan
sorry in my last mail i sent the wrong linux kernel version
here it is.

Linux imx6ulevk 4.1.15-2.1.0+g30278ab #31 SMP PREEMPT Mon Sep 11
11:31:00 IST 2017 armv7l GNU/Linux

On Mon, Sep 11, 2017 at 7:47 PM, prabhu kalyan <kalyanxpra...@gmail.com> wrote:
> the file
>
> On Mon, Sep 11, 2017 at 7:46 PM, prabhu kalyan <kalyanxpra...@gmail.com> 
> wrote:
>> Dear Fabio,
>>
>> My main objective is to switch between HID, VCP, Mass storage mode.
>> But as the g_hid.ko crashes i am not able to switch mode.
>>
>> I am using nxp kernel Linux cpu49-ub 4.4.0-31-generic
>> #50~14.04.1-Ubuntu SMP Wed Jul 13 01:06:37 UTC 2016 i686 i686 i686
>> GNU/Linux
>>
>> Can you please check if it happens to you on your architecture and
>> also check that the g_hid.c file i have attached is there anything
>> wrong.
>>
>> one more question. can it be possible to combine serial and HID
>> through libcomposit then how?
>>
>> Regards Prabhu
>>
>> On Mon, Sep 11, 2017 at 7:36 PM, Fabio Estevam <feste...@gmail.com> wrote:
>>> On Mon, Sep 11, 2017 at 10:32 AM, PRABHU <prabhu.r...@encore-research.co> 
>>> wrote:
>>>> Dear all,
>>>> I was trying to do a stress test on module insertion and removal. 1st time
>>>> modprobe g_hid and rmmod g_hid works. second time when doing insmod g_hid
>>>> crashes the core.
>>>>
>>>> crash trace
>>>> 
>>>>
>>>> root@imx6ulevk:~# modprobe ci_hdrc ci_hdrc.0: Device No Response
>>>> g_hid
>>>> Unable to handle kernel paging request at virtual address 7f09b664
>>>> pgd = 88a78000
>>>> [7f09b664] *pgd=88576811, *pte=, *ppte=
>>>> Internal error: Oops: 807 [#1] PREEMPT SMP ARM
>>>> Modules linked in: g_hid(+) usb_f_hid libcomposite configfs ci_hdrc_imx
>>>> usbmisc_imx ci_hdrc evbug uio_pdrv_genirq uio [last unloaded: g_hid]
>>>> CPU: 0 PID: 679 Comm: modprobe Not tainted 4.1.15-2.1.0+g30278ab #31
>>>
>>> Looks like you are using a vendor kernel.
>>>
>>> Could you try this on a mainline 4.13.1 kernel instead?
>>> --
>>> 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
--
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: g_hid loading unloading crash

2017-09-11 Thread prabhu kalyan
the file

On Mon, Sep 11, 2017 at 7:46 PM, prabhu kalyan <kalyanxpra...@gmail.com> wrote:
> Dear Fabio,
>
> My main objective is to switch between HID, VCP, Mass storage mode.
> But as the g_hid.ko crashes i am not able to switch mode.
>
> I am using nxp kernel Linux cpu49-ub 4.4.0-31-generic
> #50~14.04.1-Ubuntu SMP Wed Jul 13 01:06:37 UTC 2016 i686 i686 i686
> GNU/Linux
>
> Can you please check if it happens to you on your architecture and
> also check that the g_hid.c file i have attached is there anything
> wrong.
>
> one more question. can it be possible to combine serial and HID
> through libcomposit then how?
>
> Regards Prabhu
>
> On Mon, Sep 11, 2017 at 7:36 PM, Fabio Estevam <feste...@gmail.com> wrote:
>> On Mon, Sep 11, 2017 at 10:32 AM, PRABHU <prabhu.r...@encore-research.co> 
>> wrote:
>>> Dear all,
>>> I was trying to do a stress test on module insertion and removal. 1st time
>>> modprobe g_hid and rmmod g_hid works. second time when doing insmod g_hid
>>> crashes the core.
>>>
>>> crash trace
>>> 
>>>
>>> root@imx6ulevk:~# modprobe ci_hdrc ci_hdrc.0: Device No Response
>>> g_hid
>>> Unable to handle kernel paging request at virtual address 7f09b664
>>> pgd = 88a78000
>>> [7f09b664] *pgd=88576811, *pte=, *ppte=
>>> Internal error: Oops: 807 [#1] PREEMPT SMP ARM
>>> Modules linked in: g_hid(+) usb_f_hid libcomposite configfs ci_hdrc_imx
>>> usbmisc_imx ci_hdrc evbug uio_pdrv_genirq uio [last unloaded: g_hid]
>>> CPU: 0 PID: 679 Comm: modprobe Not tainted 4.1.15-2.1.0+g30278ab #31
>>
>> Looks like you are using a vendor kernel.
>>
>> Could you try this on a mainline 4.13.1 kernel instead?
>> --
>> 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
/*
 * hid.c -- HID Composite driver
 *
 * Based on multi.c
 *
 * Copyright (C) 2010 Fabien Chouteau <fabien.chout...@barco.com>
 *
 * 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 
#include 
#include 
#include 
#include 
#include 

#include "gadget_chips.h"
#define DRIVER_DESC		"HID Gadget"
#define DRIVER_VERSION		"2010/03/16"

#include "u_hid.h"

/*-*/

#define HIDG_VENDOR_NUM		0x0483
#define HIDG_PRODUCT_NUM	0xA1F8

/*-*/

struct hidg_func_node {
	struct list_head node;
	struct usb_function_instance *fi;
	struct usb_function *f;
	struct hidg_func_descriptor *func;
};

static LIST_HEAD(hidg_func_list);

/*-*/
USB_GADGET_COMPOSITE_OPTIONS();

static struct usb_device_descriptor device_desc = {
	.bLength =		sizeof device_desc,
	.bDescriptorType =	1,

	.bcdUSB =		cpu_to_le16(0x0200),

	/* .bDeviceClass =		USB_CLASS_COMM, */
	/* .bDeviceSubClass =	0, */
	/* .bDeviceProtocol =	0, */
	.bDeviceClass =		3,
	.bDeviceSubClass =	0,
	.bDeviceProtocol =	0,
	.bMaxPacketSize0 =	64,

	/* Vendor and product id can be overridden by module parameters.  */
	.idVendor =		cpu_to_le16(HIDG_VENDOR_NUM),
	.idProduct =		cpu_to_le16(HIDG_PRODUCT_NUM),
	.bcdDevice = 0x0300,
	.iManufacturer = 1,
	.iProduct = 2,
	.iSerialNumber = 3,

	.bNumConfigurations =	1,
};

//static const struct usb_descriptor_header *otg_desc[2];

static struct usb_otg_descriptor otg_descriptor = {
	.bLength =		sizeof otg_descriptor,
	.bDescriptorType =	USB_DT_OTG,

	/* REVISIT SRP-only hardware is possible, although
	 * it would not be called "OTG" ...
	 */
	.bmAttributes =		USB_OTG_SRP | USB_OTG_HNP,
};

static const struct usb_descriptor_header *otg_desc[] = {
	(struct usb_descriptor_header *) _descriptor,
	NULL,
};

/* string IDs are assigned dynamically */
static struct usb_string strings_dev[] = {
	[USB_GADGET_MANUFACTURER_IDX].s = "",
	[USB_GADGET_PRODUCT_IDX].s = DRIVER_DESC,
	[USB_GADGET_SERIAL_IDX].s = "",
	{  } /* end of list */
};

static struct usb_gadget_strings stringtab_dev = {
	.language	= 0x0409,	/* en-us */
	.strings	= strings_dev,
};

static struct usb_gadget_strings *dev_strings[] = {
	_dev,
	NULL,
};



/** Configurations **/

static int do_config(struct usb_configuration *c)
{
	struct hidg_func_node *e, *n;
	int status = 0;

	printk(" \n do config \n"

Re: g_hid loading unloading crash

2017-09-11 Thread prabhu kalyan
Dear Fabio,

My main objective is to switch between HID, VCP, Mass storage mode.
But as the g_hid.ko crashes i am not able to switch mode.

I am using nxp kernel Linux cpu49-ub 4.4.0-31-generic
#50~14.04.1-Ubuntu SMP Wed Jul 13 01:06:37 UTC 2016 i686 i686 i686
GNU/Linux

Can you please check if it happens to you on your architecture and
also check that the g_hid.c file i have attached is there anything
wrong.

one more question. can it be possible to combine serial and HID
through libcomposit then how?

Regards Prabhu

On Mon, Sep 11, 2017 at 7:36 PM, Fabio Estevam  wrote:
> On Mon, Sep 11, 2017 at 10:32 AM, PRABHU  
> wrote:
>> Dear all,
>> I was trying to do a stress test on module insertion and removal. 1st time
>> modprobe g_hid and rmmod g_hid works. second time when doing insmod g_hid
>> crashes the core.
>>
>> crash trace
>> 
>>
>> root@imx6ulevk:~# modprobe ci_hdrc ci_hdrc.0: Device No Response
>> g_hid
>> Unable to handle kernel paging request at virtual address 7f09b664
>> pgd = 88a78000
>> [7f09b664] *pgd=88576811, *pte=, *ppte=
>> Internal error: Oops: 807 [#1] PREEMPT SMP ARM
>> Modules linked in: g_hid(+) usb_f_hid libcomposite configfs ci_hdrc_imx
>> usbmisc_imx ci_hdrc evbug uio_pdrv_genirq uio [last unloaded: g_hid]
>> CPU: 0 PID: 679 Comm: modprobe Not tainted 4.1.15-2.1.0+g30278ab #31
>
> Looks like you are using a vendor kernel.
>
> Could you try this on a mainline 4.13.1 kernel instead?
> --
> 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
--
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


g_hid loading unloading crash

2017-09-11 Thread prabhu kalyan
Dear all,
I was trying to do a stress test on module insertion and removal. 1st
time modprobe g_hid and rmmod g_hid works. second time when doing
insmod g_hid crashes the core.

crash trace


root@imx6ulevk:~# modprobe ci_hdrc ci_hdrc.0: Device No Response
g_hid
Unable to handle kernel paging request at virtual address 7f09b664
pgd = 88a78000
[7f09b664] *pgd=88576811, *pte=, *ppte=
Internal error: Oops: 807 [#1] PREEMPT SMP ARM
Modules linked in: g_hid(+) usb_f_hid libcomposite configfs
ci_hdrc_imx usbmisc_imx ci_hdrc evbug uio_pdrv_genirq uio [last
unloaded: g_hid]
CPU: 0 PID: 679 Comm: modprobe Not tainted 4.1.15-2.1.0+g30278ab #31
Hardware name: Freescale i.MX6 Ultralite (Device Tree)
task: 88434980 ti: 88ac2000 task.ti: 88ac2000
PC is at kobject_add_internal+0x78/0x2f0
LR is at preempt_count_add+0x98/0x134
pc : [<802b5a88>]lr : [<80053f44>]psr: 60010013
sp : 88ac3d98  ip :   fp : 0124
r10: 77b2bedc  r9 : 0001  r8 : 
r7 : 80bb2ed0  r6 :   r5 : 80bb2ed0  r4 : 7f0a7660
r3 : 7f0a7664  r2 : 8801fbc0  r1 : 7f09b664  r0 : 
Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
Control: 10c53c7d  Table: 88a7806a  DAC: 0015
Process modprobe (pid: 679, stack limit = 0x88ac2210)
Stack: (0x88ac3d98 to 0x88ac4000)
3d80:   0124 88ac3e08
3da0: 0007 80b84240 7f0a7660 7f0a7660 80bb2ed0   802b5d48
3dc0: 88595180 88ac3ddc 7f0a7660 7f0a7658 80bb2ec8 80388154  
3de0: 80b89720 7f0a7648 88595180 7f0a7658  7f0a7648 88595180 7f0a7658
3e00:  0001 77b2bedc 8038c03c 80b89720 80b89720 88595180 7f0aa000
3e20:  7f0aa00c 80b89720 80009718 8bc6bfa0 800e856c 0003 88a7dfc0
3e40: 8040003e 0001 0008 800b6200 0003 8040003e 8bc60a60 8bc6bfa0
3e60: 80b866bc 80b84230 88001f00 80b866bc 0124 800e9d44 7f0a7958 0001
3e80: 7f0a7958 0001 88595280 7f0a7958 884d4140 807f228c 7f0a7958 884d4140
3ea0: 88ac3f58 0001 884d4148 8009690c 7f0a7964 7fff 8009394c 
3ec0:  7f0a79a0  7f0a7aa0 a0b88bf8 7f0a7964  807ffa5c
3ee0: a0b86000 2c48 007a  0b32   
3f00:        
3f20:     0018  0003 00027cc0
3f40: 017b 8000f604 88ac2000  01d98dd0 80096d70 a0b86000 2c48
3f60: a0b88720 a0b885d0 a0b87c20 0acc 0e0c   
3f80: 001f 0020 0016 001a 0011   000393a8
3fa0:  8000f480  000393a8 0003 00027cc0  01d98db0
3fc0:  000393a8  017b 01d98e30  000393a8 01d98dd0
3fe0: 7ed0d9f0 7ed0d9e0 0001f2a4 76e5db60 60070010 0003 0010 0628
[<802b5a88>] (kobject_add_internal) from [<802b5d48>] (kobject_add+0x48/0x94)
[<802b5d48>] (kobject_add) from [<80388154>] (device_add+0xd8/0x56c)
[<80388154>] (device_add) from [<8038c03c>] (platform_device_add+0x110/0x220)
[<8038c03c>] (platform_device_add) from [<7f0aa00c>]
(hidg_init+0xc/0x7c [g_hid])
[<7f0aa00c>] (hidg_init [g_hid]) from [<80009718>] (do_one_initcall+0x8c/0x1d4)
[<80009718>] (do_one_initcall) from [<807f228c>] (do_init_module+0x5c/0x1a8)
[<807f228c>] (do_init_module) from [<8009690c>] (load_module+0x1ba8/0x1e50)
[<8009690c>] (load_module) from [<80096d70>] (SyS_finit_module+0x80/0x90)
[<80096d70>] (SyS_finit_module) from [<8000f480>] (ret_fast_syscall+0x0/0x3c)
Code: e5921004 e5823004 e5842004 e5841008 (e5813000)
---[ end trace 4155b283fc24e686 ]---
note: modprobe[679] exited with preempt_count 1
Segmentation fault

kindly help
/*
 * hid.c -- HID Composite driver
 *
 * Based on multi.c
 *
 * Copyright (C) 2010 Fabien Chouteau 
 *
 * 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 
#include 
#include 
#include 
#include 
#include 

#include "gadget_chips.h"
#define DRIVER_DESC		"HID Gadget"
#define DRIVER_VERSION		"2010/03/16"

#include "u_hid.h"

/*-*/

#define HIDG_VENDOR_NUM		0x0483
#define HIDG_PRODUCT_NUM	0xA1F8

/*-*/

struct hidg_func_node {
	struct list_head node;
	struct usb_function_instance *fi;
	struct usb_function *f;
	struct hidg_func_descriptor *func;
};

static LIST_HEAD(hidg_func_list);

/*-*/
USB_GADGET_COMPOSITE_OPTIONS();

static struct usb_device_descriptor device_desc = {
	.bLength =		sizeof device_desc,
	.bDescriptorType =	1,

	.bcdUSB =		cpu_to_le16(0x0200),

	/* .bDeviceClass =