Hi Anil,
If I open a device file (say a printer device) who determines the
correct driver and sends the call? How subsequent calls get processed
etc. Yes I know the init function will be called while the driver is
loaded (while running insmod driver.ko). How a open or write call
comes to the driver from user space? Who keeps track of the driver's
internal data (*dev) and sends that while calling methods in the
driver? I am more interested in things like that.
Thanks,
Prasanna Kumar
On Sun, May 27, 2012 at 7:37 AM, Anil Nair <[email protected]> wrote:
> Hi Prasanna,
>
> On Fri, May 25, 2012 at 8:13 PM, prasannatsmkumar
> <[email protected]> wrote:
>> Thanks for your recommendation but I have went through the USB 2.0
>> specification and also had a chance to glance Linux USB Stack Design
>> Book. I am interested in software side - how things are going in
>> Linux. Upon connecting a mass storage device or USB keyboard is
>> connected how things works - the flow and the stack. Including the
>> user space tools that gets involved.
>
> Try compiling the linux kernel CONFIG_USB_DEBUG enabled. You can learn
> a lot by observing the kernel log, to view kernel log type dmesg. Try
> using usbmon Documentation can be found in
> Documentation/usb/usbmon.txt, i hope you have tried that.
> ? ? ? ? ? Typically a driver starts from the probe function checks if
> the device is listed in its table "usb_device_id", try working from
> the probe function. A good way to start is the usb-skeleton.c present
> in linux kernel source "drivers/usb/usb-skeleton.c".
> ? ? ? ? ? ?Also working of a kernel module differ the life cycle of
> the kernel module start from _init function when it is called or
> inserted to kernel using "insmod" of "modprobe".
> ? ? ? ? ? ?And make sure you use reply-to-all when in the mailing
> list. :). ?So, that others can help you too.
>
>
>
> --
> Regards,
> Anil Nair
Hi Prasanna,
On Sun, May 27, 2012 at 10:19 AM, prasannatsmkumar
<[email protected]> wrote:
> If I open a device file (say a printer device) who determines the
> correct driver and sends the call? How subsequent calls get processed
> etc. Yes I know the init function will be called while the driver is
> loaded (while running insmod driver.ko). How a open or write call
> comes to the driver from user space? Who keeps track of the driver's
> internal data (*dev) and sends that while calling methods in the
> driver? I am more interested in things like that.
Drivers work in kernel address space. The implementation of the USB in
userspace is through the library libusb, i guess you have visited its
thread in mailing list. You will require a serious reading before
jumping into coding.
Sorry if you have done the required reading. :).
--
Regards,
Anil Nair
On Sat, Jun 9, 2012 at 11:57 PM, Anil Nair <[email protected]> wrote:
> Hi Prasanna,
>
> On Sun, May 27, 2012 at 10:19 AM, prasannatsmkumar
> <[email protected]> wrote:
>
>> If I open a device file (say a printer device) who determines the
>> correct driver and sends the call? How subsequent calls get processed
>> etc. Yes I know the init function will be called while the driver is
>> loaded (while running insmod driver.ko). How a open or write call
>> comes to the driver from user space? Who keeps track of the driver's
>> internal data (*dev) and sends that while calling methods in the
>> driver? I am more interested in things like that.
>
> Drivers work in kernel address space. The implementation of the USB in
> userspace is through the library libusb, i guess you have visited its
> thread in mailing list. You will require a serious reading before
> jumping into coding.
> Sorry if you have done the required reading. :).
>
> --
> Regards,
> Anil Nair
Anil,
I have understood the code flow now. Actually I was not speaking about
user space drivers but about user space applications opening the
device and communicating with it.
Hi Prasanna,
On Sun, Jun 10, 2012 at 10:23 AM, prasannatsmkumar
<[email protected]> wrote:
> I have understood the code flow now. Actually I was not speaking about
> user space drivers but about user space applications opening the
> device and communicating with it.
Ok. Thats good, i thought you were asking about user space drivers.
--
Regards,
Anil Nair