1.蓝牙适配
This commit is contained in:
		
							parent
							
								
									6b10066e59
								
							
						
					
					
						commit
						e8a1816bfc
					
				| 
						 | 
				
			
			@ -67,6 +67,7 @@ SINT32 sf_in_update(void);
 | 
			
		|||
 | 
			
		||||
void sf_set_card_statu(UINT32 val);
 | 
			
		||||
UINT32 sf_get_card_statu(void);
 | 
			
		||||
BOOL sf_system_check_bt_ko(void);
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
#if __cplusplus
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -629,11 +629,29 @@ BOOL sf_load_ko(void)
 | 
			
		|||
	return ret2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOL sf_system_check_bt_ko(void)
 | 
			
		||||
{
 | 
			
		||||
    char command[26] = "lsmod | grep rtk_btusb";
 | 
			
		||||
    FILE *fp = popen(command, "r");
 | 
			
		||||
    char result[256];
 | 
			
		||||
    fgets(result, sizeof(result), fp);
 | 
			
		||||
    pclose(fp);
 | 
			
		||||
    if (result[0] == '\0') {
 | 
			
		||||
        MLOGI("rtk_btusb module is not loaded.\n");
 | 
			
		||||
        return FALSE;
 | 
			
		||||
    } else {
 | 
			
		||||
        MLOGI("rtk_btusb module is loaded.\n");
 | 
			
		||||
        return TRUE;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BOOL sf_load_bt_ko(void)
 | 
			
		||||
{
 | 
			
		||||
    BOOL ret2 = TRUE;
 | 
			
		||||
    int ret = 0;
 | 
			
		||||
    ret = system("modprobe hci_uart");
 | 
			
		||||
    MLOGI("start.\n");
 | 
			
		||||
 | 
			
		||||
    ret = system("modprobe rtk_btusb");
 | 
			
		||||
    if(0 != ret)
 | 
			
		||||
    {
 | 
			
		||||
        ret2 = FALSE;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,7 @@
 | 
			
		|||
#include <sys/socket.h>
 | 
			
		||||
#include <net/if.h>
 | 
			
		||||
#include "sf_blue_app.h"
 | 
			
		||||
#include "sf_device.h"
 | 
			
		||||
 | 
			
		||||
extern int hciconfig_start_advertising(const char *ssid);
 | 
			
		||||
extern int hciconfig_close_device(void);
 | 
			
		||||
| 
						 | 
				
			
			@ -131,14 +132,26 @@ static void *sf_bluetooth_piscan_task(void *arg)
 | 
			
		|||
    //system("export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/misc:/customer/rocus/lib");
 | 
			
		||||
    //system("adduser messagebus");
 | 
			
		||||
 | 
			
		||||
    system("rtk_hciattach -n -s 115200 ttyS1 rtk_h5 &");
 | 
			
		||||
    // system("rtk_hciattach -n -s 115200 ttyS1 rtk_h5 &");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // for (i = 0; i < 40; i++) {
 | 
			
		||||
    //     if (access("/tmp/blue_setup_complete", F_OK) == 0) {
 | 
			
		||||
    //         printf("blue setup complete\r\n");
 | 
			
		||||
    //         remove("/tmp/blue_setup_complete");
 | 
			
		||||
 | 
			
		||||
    //         break;
 | 
			
		||||
    //     } else {
 | 
			
		||||
    //         usleep(500 * 1000);
 | 
			
		||||
    //         if(39 == i)
 | 
			
		||||
    //         {
 | 
			
		||||
    //             MLOGE("blue setup fall!!\n");
 | 
			
		||||
    //             return NULL;
 | 
			
		||||
    //         }
 | 
			
		||||
    //     }
 | 
			
		||||
    // }
 | 
			
		||||
    for (i = 0; i < 40; i++) {
 | 
			
		||||
        if (access("/tmp/blue_setup_complete", F_OK) == 0) {
 | 
			
		||||
            printf("blue setup complete\r\n");
 | 
			
		||||
            remove("/tmp/blue_setup_complete");
 | 
			
		||||
 | 
			
		||||
        if (sf_system_check_bt_ko() == TRUE) {
 | 
			
		||||
            break;
 | 
			
		||||
        } else {
 | 
			
		||||
            usleep(500 * 1000);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user