hello to you all.
I need to now how we can write a simple c code which will run when ever we plug in the usb drive in the port. Simply how to load our program at boot time.
Thanks
>>a simple c code which will run when ever we plug in the usb drive
:icon_lol: :icon_lol: :icon_lol: :icon_lol: :icon_lol: :icon_lol: :icon_lol: :icon_lol: :icon_lol:
Tell me what will be the appraoch. I think i had to change the boot sector pogram.
Perhaps start by saying which OS you're using.
Then perhaps a search.
http://clusty.com/search?query=USB+insert+notification+event&sourceid=Mozilla-search
Basically, the OS generates the initial event, and then you hook into that in some way to do what you want to do.
windows xp sp2!!!
might have to write a windows device driver. you can download the windows DDK from Microsoft web site -- just search for it.
when we plug in usb drive, the first thing that os does is that it checks bootsector. In boot sector which is 512 bytes long has 2 parts. one is boot paramenters(tells the organozation of the disk) and the second one is bootstrap program which actually runs. What if anyone can tell how write such bootsrap program that will load my hello world program in the memory and execute it.
Well if you're using windows, and it appears as a drive, then why not autorun?
http://en.wikipedia.org/wiki/Autorun
Just create an autorun.inf file describing what you want to happen when the drive is plugged in.
autorun command
open=my.exe
does not work for Usb flash drives
why???
Read this, especially FAQ http://www.linux-usb.org. You can run your program after the device is plugged in, using the hotplug script.
what about writing to boot sector of pen drive
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.