From: 陈智 Date: Wed, 30 Mar 2011 08:40:59 +0000 (+0800) Subject: BT: add an selection of reading bd_addr from ID block or WIFI MAC+1 X-Git-Tag: firefly_0821_release~10593 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e525ca90f80664fa90101cd6b1bfc8cc7af76c10;p=firefly-linux-kernel-4.4.55.git BT: add an selection of reading bd_addr from ID block or WIFI MAC+1 --- diff --git a/drivers/bluetooth/Kconfig b/drivers/bluetooth/Kconfig index 92234c562e9f..c328aa12a71e 100755 --- a/drivers/bluetooth/Kconfig +++ b/drivers/bluetooth/Kconfig @@ -206,6 +206,16 @@ config BT_HCIBCM4325 Say Y here to compile support for HCI BCM4325 devices into the kernel or say M to compile it as module (bcm4325). +if BT_HCIBCM432x +choice + prompt "BD_ADDR read from" +config IDBLOCK + bool "NAND ID block" +config WIFI_MAC + bool "WIFI MAC+1" +endchoice +endif + endmenu diff --git a/drivers/bluetooth/vflash.c b/drivers/bluetooth/vflash.c index 5987d9212a52..746c2f0b4940 100755 --- a/drivers/bluetooth/vflash.c +++ b/drivers/bluetooth/vflash.c @@ -31,6 +31,7 @@ static struct miscdevice vflash_miscdev; #define READ_BDADDR_FROM_FLASH 0x01 extern char GetSNSectorInfo(char * pbuf); +extern unsigned char wlan_mac_addr[6]; static int vflash_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) @@ -47,6 +48,35 @@ static int vflash_ioctl(struct inode *inode, struct file *file, { case READ_BDADDR_FROM_FLASH: { +#if CONFIG_WIFI_MAC + unsigned char bd_addr[6] = {0}; + int i; + + printk("vflash: wlan_mac_addr:%X:%X:%X:%x:%X:%x\n", wlan_mac_addr[0], + wlan_mac_addr[1], + wlan_mac_addr[2], + wlan_mac_addr[3], + wlan_mac_addr[4], + wlan_mac_addr[5] ); + for (i=1; i<6; i++) { + bd_addr[i] = wlan_mac_addr[5-i]; + } + + bd_addr[0] = wlan_mac_addr[5]+1; + + printk("vflash: bd_addr:%X:%X:%X:%x:%X:%x\n", bd_addr[5], + bd_addr[4], + bd_addr[3], + bd_addr[2], + bd_addr[1], + bd_addr[0] ); + + + if(copy_to_user(argp, bd_addr, 6)) { + printk("ERROR: copy_to_user---%s\n", __FUNCTION__); + return -EFAULT; + } +#else char *tempBuf = (char *)kmalloc(512, GFP_KERNEL); char bd_addr[6] = {0}; int i; @@ -68,6 +98,7 @@ static int vflash_ioctl(struct inode *inode, struct file *file, } kfree(tempBuf); +#endif } break; default: