4 #include <linux/module.h>
9 static struct class *bt_class;
14 static inline char *link_typetostr(
int type)
34 return sprintf(buf,
"%s\n", link_typetostr(conn->
type));
49 return sprintf(buf,
"0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
56 #define LINK_ATTR(_name, _mode, _show, _store) \
57 struct device_attribute link_attr_##_name = __ATTR(_name, _mode, _show, _store)
63 static struct attribute *bt_link_attrs[] = {
65 &link_attr_address.attr,
66 &link_attr_features.attr,
71 .attrs = bt_link_attrs,
79 static void bt_link_release(
struct device *dev)
87 .groups = bt_link_groups,
88 .release = bt_link_release,
96 static int __match_tty(
struct device *dev,
void *
data)
98 return !
strncmp(dev_name(dev),
"rfcomm", 6);
107 conn->
dev.type = &bt_link;
108 conn->
dev.class = bt_class;
109 conn->
dev.parent = &hdev->
dev;
123 BT_ERR(
"Failed to register connection device");
134 if (!device_is_registered(&conn->
dev))
153 static inline char *host_bustostr(
int bus)
175 static inline char *host_typetostr(
int type)
191 return sprintf(buf,
"%s\n", host_bustostr(hdev->
bus));
211 name[HCI_MAX_NAME_LENGTH] =
'\0';
212 return sprintf(buf,
"%s\n", name);
235 return sprintf(buf,
"0x%02x%02x%02x%02x%02x%02x%02x%02x\n",
272 const char *buf,
size_t count)
282 if (val != 0 && (val < 500 || val > 3600000))
299 const char *buf,
size_t count)
326 const char *buf,
size_t count)
355 show_idle_timeout, store_idle_timeout);
357 show_sniff_max_interval, store_sniff_max_interval);
359 show_sniff_min_interval, store_sniff_min_interval);
361 static struct attribute *bt_host_attrs[] = {
365 &dev_attr_class.attr,
366 &dev_attr_address.attr,
367 &dev_attr_features.attr,
368 &dev_attr_manufacturer.attr,
369 &dev_attr_hci_version.attr,
370 &dev_attr_hci_revision.attr,
371 &dev_attr_idle_timeout.attr,
372 &dev_attr_sniff_max_interval.attr,
373 &dev_attr_sniff_min_interval.attr,
378 .attrs = bt_host_attrs,
386 static void bt_host_release(
struct device *dev)
395 .groups = bt_host_groups,
396 .release = bt_host_release,
399 static int inquiry_cache_show(
struct seq_file *
f,
void *
p)
409 seq_printf(f,
"%s %d %d %d 0x%.2x%.2x%.2x 0x%.4x %d %d %u\n",
429 .open = inquiry_cache_open,
435 static int blacklist_show(
struct seq_file *f,
void *p)
452 return single_open(file, blacklist_show, inode->i_private);
456 .open = blacklist_open,
467 memcpy(&data0, &uuid[0], 4);
468 memcpy(&data1, &uuid[4], 2);
469 memcpy(&data2, &uuid[6], 2);
470 memcpy(&data3, &uuid[8], 2);
471 memcpy(&data4, &uuid[10], 4);
472 memcpy(&data5, &uuid[14], 2);
474 seq_printf(f,
"%.8x-%.4x-%.4x-%.4x-%.8x%.4x\n",
479 static int uuids_show(
struct seq_file *f,
void *p)
487 print_bt_uuid(f, uuid->uuid);
496 return single_open(file, uuids_show, inode->i_private);
506 static int auto_accept_delay_set(
void *data,
u64 val)
519 static int auto_accept_delay_get(
void *data,
u64 *val)
533 auto_accept_delay_set,
"%llu\n");
539 dev->
type = &bt_host;
540 dev->
class = bt_class;
567 hdev, &inquiry_cache_fops);
570 hdev, &blacklist_fops);
575 &auto_accept_delay_fops);
593 if (IS_ERR(bt_class))
594 return PTR_ERR(bt_class);