Re: How to make USB to work dynamically

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

 



On Thu, Jun 25, 2009 at 12:46:46PM +0530, Arjun Joshi wrote:
> Hi Greg,
> 
> I am trying to make USB work dynamically on an OMAP board which has a 
> USB OTG controller. The board has a mini-AB receptacle.
> 
> My target is that whenever I insert a mini-B cable the gadget related 
> kernel modules must be loaded automatically so that my board works as 
> mass storage device. When i insert a mini-A cable the host mode related 
> kernel modules must be loaded so that my board works as host.
> 
> I have compiled usbcore, HostController drivers(for both host and gadget 
> mode --- host.ko and gadget.ko) and mass storage support(for HC in host 
> mode) and file backed storage gadget(for HC in device mode)
> as modules.
> 
> What i am currently doing is that I am plugging a mini-A cable, 
> inserting usbcore,host.ko and usb-storage.ko and I am able to detect a 
> mobile phone as a mass storage device.
> 
> Then I rmmod all the modules, unplug the mini-A cable, insert the mini-B 
> cable, modprobe the  usbcore, gadget.ko and g_file_storage.ko which 
> enables my device to be detected as a mass storage device on my PC.
> 
> Now the tricky part is that I want to do all the loading/unloading of 
> respective modules dynamically (without any human intervention - maybe 
> through a script) as soon as I insert the cable(either one) or remove 
> the cable.
> 
> My Queries:
> 
> 1. How do I detect which cable is inserted? Is there a way to find out?

That's a hardware-dependant thing, your controller will provide this
functionality for you.

> 2. Is it possible to do this? If yes, any guidance will greatly help.

Use udev as the other responders said.

good luck,

greg k-h

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux