Module: marvel 8787
Kernel: 2.6.35
My module is shared by WiFi and Bluetooth. There is nothing to say about the Bluetooth porting part. Just load the Ko file.
For use, there is a problem in power management. Because the power supply of my Wi-Fi module is controlled, that is
During sleep, the module will be powered off, which will lead to a Bluetooth driver, which will be reloaded every time it is awakened.
Register the created rfkill0 folder and change it to rfkill1, rfkill2, rfkill2 .......
This will cause the device file to not be found on the android upper layer. Another problem is that the android upper layer needs
One status flag indicates file read/write. Only the root user can have the write permission. The Bluetooth service process on the android Layer
It is a Bluetooth user and thus cannot be accessed.
Solution:
File Path: kernel_imx/NET/rfkill/CORE. c
1. Change s_iwusr in the rfkill_dev_attrs structure to s_iwugo.
Static struct device_attribute rfkill_dev_attrs [] = {
_ ATTR (name, s_irugo, rfkill_name_show, null ),
_ ATTR (type, s_irugo, rfkill_type_show, null ),
_ ATTR (index, s_irugo, rfkill_idx_show, null ),
_ ATTR (persistent, s_irugo, rfkill_persistent_show, null ),
_ ATTR (State, s_irugo |S_iwugo/* s_iwusr */,Rfkill_state_show, rfkill_state_store)
_ ATTR (claim, s_irugo | s_iwusr, rfkill_claim_show, rfkill_claim_store ),
_ ATTR (soft, s_irugo | s_iwusr, rfkill_soft_show, rfkill_soft_store ),
_ ATTR (hard, s_irugo, rfkill_hard_show, null ),
_ Attr_null
};
2. Add rfkill_register to the rfkill_no = 0 function. The position is as follows:
Int _ must_check rfkill_register (struct rfkill * rfkill)
{
Static unsigned long rfkill_no;
Struct device * Dev = & rfkill-> dev;
Int error;
Bug_on (! Rfkill );
Mutex_lock (& rfkill_global_mutex );
If (rfkill-> registered ){
Error =-ealready;
Goto unlock;
}
Rfkill_no = 0; // force the file name to be created to rfkill0
Rfkill-> idx = rfkill_no;
Dev_set_name (Dev, "rfkill % lu", rfkill_no );
..................
}
For file name changes in Part 2, you can use the hardware abstraction layer Bluetooth. C.