LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 04-19-2015, 01:13 AM   #1
niroop
LQ Newbie
 
Registered: Oct 2011
Posts: 4

Rep: Reputation: Disabled
Unhappy [gadget driver] HOST turns unresponsive to gadget driver


I'm writing a multi-function composite gadget driver gadget driver similar to drivers/usb/gadget/ncm.c and multi.c using composite framework, with f_ncm.c (existing) and one vendor specific function file with an interface and endpoint descriptors.

When the module is loaded in the device and connected to desktop running Ubuntu[HOST], to verify the descriptors, the desktop turns unresponsive, but the device looks fine. The only way to come out is to power off and restart the host.

When I analyzed the logs using protocol analyzer it shows some timeout error as follows & then host just hangs.

Timeout error for getting string descriptor

2D 06 90 --> (and ep 0 & address 6)
C3 80 06 04 03 09 04 FF 00 97 BD --> (string)
D2 --> (ACK)
unfortunately I couldn't get more info because of the above issue.

could someone give some pointers to how can I find out where the problem is?

I also tried loading the module "g_ncm.ko" and executed "lsusb" on the host side. The lsusb (or cat /sys/kernel/debug/usb/devices) takes some time to respond [ 5 to10 secs ]. Is this expected/normal behavior? I've seen a similar module, which I think uses f_ncm.c and one more function which loads & runs almost instantly. Is there a way to optimize ?
 
Old 04-19-2015, 03:29 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware, Slarm64 & Android
Posts: 16,261

Rep: Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322Reputation: 2322
5-10 seconds is long in the scheme of things, but there could be delay issues somewhere we are unaware of. Depending on the length of interrupts, and the number of them, and network backlog, there could be delays, but I would earmark that as suspicious. I saw Z80 systems with 128 levels of interrupt that had to be trashed in research; they were interrupted so much they never got to execute the main code :-/.

The next step can be tiresome and take you time. So accept that some routine(s) you think are ok are actually screwing you up. Look at your code again. Try any software debugging techniques.

Lastly, get a C --> Assembler --> machine code listing of your programme, and a logic analyser. You can hire the logic Analyser. Trigger on an address or data word at the beginning of your suspicious section. You get up what the computer does. So you can see which instruction it performs next. If everything looks OK, move on, etc. Suddenly you will se an unexplainable jump or word appear. Figure that out and you have solved it. Be prepared to lose a week at it, though. You could lose most of a week doing this.
 
1 members found this post helpful.
Old 04-19-2015, 04:36 AM   #3
niroop
LQ Newbie
 
Registered: Oct 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
@business_kid
Thanks for the warning and input

I'm pretty sure that the problem is not with the hardware, because there is one similar module which runs on the same hardware & with `lsusb` command I can read those descriptors which are actually the same as in https://github.com/boundarydevices/l...t/f_ncm.c#L146, the module name suggests that is is using "ncm" and also it works without any problem. I'm trying to find a hack to get it working as expected.

Anyway, I'll give it a try.

-Thanks

Last edited by niroop; 04-19-2015 at 04:39 AM. Reason: added line no. to url
 
Old 04-20-2015, 01:30 AM   #4
niroop
LQ Newbie
 
Registered: Oct 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
looks like someone had similar issue http://e2e.ti.com/support/arm/sitara...320035/1118205

Last edited by niroop; 04-20-2015 at 01:32 AM.
 
Old 04-22-2015, 08:30 AM   #5
niroop
LQ Newbie
 
Registered: Oct 2011
Posts: 4

Original Poster
Rep: Reputation: Disabled
Question

shortening the string by removing " (NCM)" here https://github.com/boundarydevices/l...t/f_ncm.c#L342 solved the problem ! Don't know the reason yet.
 
  


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
About USB Gadget serial driver sdefayette Linux - General 1 08-12-2012 11:41 AM
Sending data from the gadget driver to the host kewl Programming 0 07-19-2010 01:43 AM
Problems with USB Gadget driver when host is windows VGM Linux - Newbie 2 07-07-2010 11:45 PM
MTP gadget driver Robert_A Programming 7 01-14-2010 02:51 PM
Problem with Serial Gadget driver simic Linux - Kernel 0 12-12-2007 04:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 03:46 AM.

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