2 * This file is part of hci_h4p bluetooth driver
4 * Copyright (C) 2005, 2006 Nokia Corporation.
6 * Contact: Ville Tervo <ville.tervo@nokia.com>
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * version 2 as published by the Free Software Foundation.
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
24 #include <linux/kernel.h>
25 #include <linux/init.h>
26 #include <linux/device.h>
27 #include <linux/platform_device.h>
33 static ssize_t hci_h4p_store_bdaddr(struct device *dev, struct device_attribute *attr,
34 const char *buf, size_t count)
36 struct hci_h4p_info *info = (struct hci_h4p_info*)dev_get_drvdata(dev);
37 unsigned int bdaddr[6];
40 ret = sscanf(buf, "%2x:%2x:%2x:%2x:%2x:%2x\n",
41 &bdaddr[0], &bdaddr[1], &bdaddr[2],
42 &bdaddr[3], &bdaddr[4], &bdaddr[5]);
48 for (i = 0; i < 6; i++)
49 info->bdaddr[i] = bdaddr[i] & 0xff;
54 static ssize_t hci_h4p_show_bdaddr(struct device *dev, struct device_attribute *attr,
57 struct hci_h4p_info *info = (struct hci_h4p_info*)dev_get_drvdata(dev);
59 return sprintf(buf, "%.2x:%.2x:%.2x:%.2x:%.2x:%.2x\n",
68 static DEVICE_ATTR(bdaddr, S_IRUGO | S_IWUSR, hci_h4p_show_bdaddr, hci_h4p_store_bdaddr);
69 int hci_h4p_sysfs_create_files(struct device *dev)
71 return device_create_file(dev, &dev_attr_bdaddr);