[gadget driver] HOST turns unresponsive to gadget driver
Linux - Embedded & Single-board computerThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
[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 ?
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.
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 05:39 AM.
Reason: added line no. to url
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.