Android 2.3 Bluetooth port problems

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.