Re: [newbie] Disconnecting of USB-device is not detected on ARM 7 using uClinux

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Alan Stern wrote:
On Sun, 10 Jan 2010, Rene wrote:

Hello to all,

I hope everything goes OK, this is the first time I post to a mailing list. After having been tinkering for a long time by now (weeks, though the problem described here was not the only; it is however the only one that I can't seem to solve), including a lot of searching on the web, I decided to ask You for Your help. I am very new to Linux (have been using it for some time on my desktop, at the moment Xubuntu 9.04, but I mean new to the internals and using it for embedded purposes) so I may sound a bit stupid, please forgive me, I do my best.

What I am trying to accomplish is detecting when a USB-stick is inserted or removed on an Embedded Artists LPC2468 board. I am using uClinux distro 081020 along with kernel 2.6.21. The reason I am using these two specifically is that there are patches on the EA website that can be applied to them which add stuff that is specific to this board and the controller on it. I can build a kernel that works well apart from one thing, removing the usb-stick is not being detected. When I insert it, the stick is detected and attached as a scsi drive to /dev/sda1, the messages are the same as on my desktop computer and I can mount and use it on the embedded board, no problems. However, when I pull out the stick from my desktop computer, I get a message saying I just did this, contrary to what happens on the embedded system. Also the led "link OK", connected to GPIO pin 0.13, does not go out. The OHCI is connected to IRQ22. I have inserted a kprint in the function "asmlinkage void asm_do_IRQ(unsigned int irq, struct pt_regs *regs" in source file /arch/arm/kernel/irq.c. This tells me that when I insert the stick, an int 22 is indeed being generated. But not on removal. When I re-insert the stick or another one, the int is being generated again.

I also put a kprint in /drivers/usb/host/ohci-hcd.c in the function static irqreturn-t ohci_irq (struct usb_hcd *hcd), that also gives a notification on the insertion but not on the removal. I put several printk's in the functions in /drivers/usb/core/notify.c but I don't get any of them. If I have done something that doesn't make sense, that's because I just wanted to solve it and thought this would help.

Once it has happened that I noticed after a long time that the console from the board said that a stick had been removed. Only once.

I have been reading a lot about USB and OHCI but at the moment I really am stuck. A lot of things one finds on the web are of a higher level, meaning that people have hotplug problems or so. I can't find anything that enlightens me anymore, I do have some C programming experience but Linux kernel code is not exactly the easiest C code there is and I have no experience coding at kernel level. I am however very willing to learn but now I have come to a point where I definitely could use some suggestions. Should I have forgotten to include info that is important for You (or when I have done this out of ignorance), please don't hesitate to ask.

Every suggestion will be highly appreciated, thank You in advance!

This is probably caused by a hardware problem (like, maybe the on-board
OHCI controller doesn't work right).

Still, you can get more information if you build a kernel with
CONFIG_USB_DEBUG and CONFIG_DEBUG_FS enabled.  Under such a kernel you
should mount a debugfs filesystem, for example under /sys/kernel/debug. Then after unplugging the USB stick, go to the "ohci" subdirectory of
the debugfs filesystem and see what's in the "registers" file.

Hi Alan,

First of all, thanks a lot for your reply!

This debugfs is very interesting. I had not heard of it before but it can be very usefull. I had already CONFIG_USB_DEBUG enabled, but yesterday I have built a kernel with debugfs enabled as well. Unfortunately no OHCI showed up, I had it mounted in /sys/kernel/debug. After doing some grep'ing in the sources, it turned out that the OHCI files don't include debugfs (hardly any driver does in this version). usbmon did however and I built a kernel with that enabled as well, that worked, it showed up in the directory. But it didn't give me more information than the verbose usb messages.

For now I have decided to accept this as "not working" for the time being. I have spent several weeks on this subject already, learnt a lot about Linux but this is still too far above me. First I am going to spend time on other courses that I have neglected and then I am going to gather some more structured basic knowledge about the kernel, drivers and usb and then I am going to sink my teeth into it again. Yesterday I noticed I was becoming too frustrated (and last night I hardly closed an eye, all the newly gathered - not very structured - knowledge from the last weeks started riding rollercoaster in my head) and running out of time for my other courses and in fact, this bug is not that important, even my teacher has told me to accept that it is not working and let it rest (but that is something I cannot easily justify towards myself)( :-) and :-( at the same time ;-)).

Thanks again, when I have got more knowledge and feel a bit more relaxed about it (I just HAD to get it going, couldn't stand admitting defeat, but I just have to for the time being, this is not the way to solve it) I'll probably come back to this list (and in any case I'll send you a pm if I solve it). I would still highly appreciate it if you could tell me what the basic trigger of the disconnection is; Is it something electrical or is it at a higher level, that OHCI and usb-device can't "hear" each other anymore? (I know, I have to do a lot of reading, but I am very curious about this one.)

Yours sincerely,
Rene
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux