[Bluetooth] Add HCIUARTGETDEVICE support for HCI line discipline
authorMarcel Holtmann <marcel@holtmann.org>
Wed, 9 May 2007 07:15:35 +0000 (09:15 +0200)
committerDavid S. Miller <davem@sunset.davemloft.net>
Fri, 11 May 2007 06:45:04 +0000 (23:45 -0700)
Adding HCIUARTGETDEVICE makes it possible to get the HCI device number
that is attached to a given serial device. This is required during the
initialization process of some Bluetooth chips.

Signed-off-by: Ohad Ben-Cohen <ohad@bencohen.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
drivers/bluetooth/hci_ldisc.c
drivers/bluetooth/hci_uart.h

index 0f4203b499af65771ccb63bac79cae5ec2ad4f80..75c15085f81f9a68735ad384705981d1a6407386 100644 (file)
@@ -479,6 +479,11 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file * file,
                        return hu->proto->id;
                return -EUNATCH;
 
+       case HCIUARTGETDEVICE:
+               if (test_bit(HCI_UART_PROTO_SET, &hu->flags))
+                       return hu->hdev->id;
+               return -EUNATCH;
+
        default:
                err = n_tty_ioctl(tty, file, cmd, arg);
                break;
index b250e6789dee68abd323392daa6a831337e20989..1097ce72393f2813bc82d140df1cca0495124b30 100644 (file)
@@ -28,8 +28,9 @@
 #endif
 
 /* Ioctls */
-#define HCIUARTSETPROTO        _IOW('U', 200, int)
-#define HCIUARTGETPROTO        _IOR('U', 201, int)
+#define HCIUARTSETPROTO                _IOW('U', 200, int)
+#define HCIUARTGETPROTO                _IOR('U', 201, int)
+#define HCIUARTGETDEVICE       _IOR('U', 202, int)
 
 /* UART protocols */
 #define HCI_UART_MAX_PROTO     4