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. Alan Stern -- 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