LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-27-2010, 07:31 AM   #1
Sebteams69
LQ Newbie
 
Registered: Oct 2010
Posts: 2

Rep: Reputation: 0
Linux usb gadget HID driver problem


Hi everybody

I use the linux 2.6.35.4 kernel on an embedded board. The problem is that I want to use the usb gadget HID to connect my board on the PC as a HID device. I compile the kernel with all needed options. The g_hid driver is compile as module. When I do a modprobe g_hid an error is return with no such device.
Can someone help me?
Can someone tell me how the /dev/hidgx is created and which is the major and minor number. I have search in the device.txt file and on Internet but I don't find anything. This driver has been developped in the 2.6.35 kernel version and I don't know if someone use it?

Best regards,
Sebastien
 
Old 10-27-2010, 11:28 AM   #2
Sebteams69
LQ Newbie
 
Registered: Oct 2010
Posts: 2

Original Poster
Rep: Reputation: 0
Solved

The problem is that I didn't understand the documentation about gadget HID. To solve the problem, you just need to add the two structures in your platform support like the example and add a call to platform_register_device with the device structure as parameter. And then the driver is able to be loaded and is working fine.

Regards,
Sebastien

Last edited by Sebteams69; 10-28-2010 at 07:54 AM.
 
Old 09-13-2011, 06:37 AM   #3
aManFromOuterSpace
LQ Newbie
 
Registered: Sep 2011
Posts: 1

Rep: Reputation: Disabled
Question

Quote:
Originally Posted by Sebteams69 View Post
The problem is that I didn't understand the documentation about gadget HID. To solve the problem, you just need to add the two structures in your platform support like the example and add a call to platform_register_device with the device structure as parameter. And then the driver is able to be loaded and is working fine.

Regards,
Sebastien
Hate to revive a dead post, but you couldn't point me to the source files that needed modified as well as what the platform_register_device call looks like.

Thanks

aMan
 
Old 03-20-2012, 01:09 PM   #4
myke.predko
LQ Newbie
 
Registered: Jan 2012
Posts: 2

Rep: Reputation: Disabled
Question Anybody with HID Device Tutorials and Code?

Like the Man from Outer Space, I don't want to revive a dead post, but if Sebteams69 or anybody else could post some information about implementing a HID device from the Embedded Linux System, I would appreciate it.

Thanx!

myke

Last edited by myke.predko; 03-20-2012 at 01:10 PM. Reason: Typo
 
Old 05-12-2012, 10:23 AM   #5
ma1
LQ Newbie
 
Registered: May 2012
Posts: 12

Rep: Reputation: Disabled
Problem Solved.

step1: go to the link below.
http://www.mjmwired.net/kernel/Docum...gadget_hid.txt

step2: copy the following two structures from the above link and paste into hid.c
hidg_func_descriptor
platform_device

step3: compile the hid module

step4: load the module

That's it.
 
Old 06-12-2012, 12:13 PM   #6
gattusunil
LQ Newbie
 
Registered: Jun 2012
Posts: 2

Rep: Reputation: Disabled
I tried your suggestion and still ended up with the same issue. Can you give some more details on how to fix this issue?
 
Old 06-12-2012, 01:00 PM   #7
ma1
LQ Newbie
 
Registered: May 2012
Posts: 12

Rep: Reputation: Disabled
Quote:
Originally Posted by gattusunil View Post
I tried your suggestion and still ended up with the same issue. Can you give some more details on how to fix this issue?
Hi

In your hidg_init function in the module, call the following

Code:
int status;
status = platform_device_register(&my_hid);
if (status < 0)
{
	platform_driver_unregister(&my_hid);
	return status;
}
where my_hid is a pointer to platform_device struct.

Also call the following function in your hidg_cleanup function

platform_device_unregister(&my_hid);

Hope this will help.

 
1 members found this post helpful.
Old 06-12-2012, 02:24 PM   #8
gattusunil
LQ Newbie
 
Registered: Jun 2012
Posts: 2

Rep: Reputation: Disabled
Thanks for your quicker response. Now, I get the following error. Any ideas?

root@freescale ~$ modprobe g_hid.ko
------------[ cut here ]------------
WARNING: at drivers/base/driver.c:262 driver_unregister+0x30/0x78()
Unexpected driver unregister!
Modules linked in: g_hid(+)
Backtrace:
[<c00344a8>] (dump_backtrace+0x0/0x114) from [<c03ce738>] (dump_stack+0x18/0x1c)
r7:00000009 r6:00000106 r5:c024c5c8 r4:c75a7ee0
[<c03ce720>] (dump_stack+0x0/0x1c) from [<c004c69c>] (warn_slowpath_common+0x54/0x6c)
[<c004c648>] (warn_slowpath_common+0x0/0x6c) from [<c004c758>] (warn_slowpath_fmt+0x38/0x40)
r9:c75a6000 r8:c0030ba8 r7:000072ec r6:00000000 r5:00000000
r4:bf002d08
[<c004c720>] (warn_slowpath_fmt+0x0/0x40) from [<c024c5c8>] (driver_unregister+0x30/0x78)
r3:00000000 r2:c04a8c88
[<c024c598>] (driver_unregister+0x0/0x78) from [<c024d71c>] (platform_driver_unregister+0x14/0x18)
r7:000072ec r6:00000000 r5:00000000 r4:ffffffed
[<c024d708>] (platform_driver_unregister+0x0/0x18) from [<bf00668c>] (hidg_init+0x48/0x64 [g_hid])
[<bf006644>] (hidg_init+0x0/0x64 [g_hid]) from [<c00303bc>] (do_one_initcall+0x64/0x1cc)
r5:00000000 r4:bf006644
[<c0030358>] (do_one_initcall+0x0/0x1cc) from [<c007c14c>] (sys_init_module+0x9c/0x1b8)
r9:c75a6000 r8:c0030ba8 r7:000072ec r6:0009b0b8 r5:00000000
r4:bf002ef0
[<c007c0b0>] (sys_init_module+0x0/0x1b8) from [<c0030a00>] (ret_fast_syscall+0x0/0x2c)
r7:00000080 r6:0009b008 r5:00000000 r4:000072ec
---[ end trace 0cb0ee3e56914919 ]---
modprobe: failed to load module g_hid.ko (/lib/modules/2.6.35.3-571-gcca29a0/kernel/drivers/usb/gadget/g_hid.ko): No such device
root@freescale ~$
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] USB driver from HID to TTY jacquesdirac Linux - Hardware 2 09-22-2010 09:48 AM
usb gadget printer driver application grsandeep85 Programming 1 08-18-2010 01:24 AM
Problems with USB Gadget driver when host is windows VGM Linux - Newbie 2 07-07-2010 11:45 PM
USB HID mouse driver on 2.6 kernel macarthy Linux - Newbie 2 04-25-2010 05:27 AM
help on driver for USB HID device(finger print) in Linux malikamirshehzad Programming 1 02-18-2006 01:48 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:33 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration