I am running the SPI code on the panda board and I want to know which function in the code is responsible for detecting the device when it's hot plugged.
Can somebody with the background of embedded systems, Linux device drivers and/or spi please answer my question?
This is the line in your code that does the magic:
Process:
1. Driver for each device exposes its information using the API
MODULE_DEVICE_TABLE
. Each device has a uniquevendor Id
anddevice Id
.2. At compilation time, the build process extracts this information out of the driver and builds a table.
3. When the device is plugged in, the
kernel
checks thisdevice table
to see if anydriver
is available for the particularVendor/Device Id
. If yes then it loads that driver and initializes the device.Read following articles for more info: