tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: btuart and SOCKET Bluetooth CF



On Tue, 16 Feb 2010, KIYOHARA Takashi wrote:

 /* sc_state */
-#define BTUART_RECV_PKT_TYPE   0       /* packet type */
+enum state {
+       BTUART_RECV_PKT_TYPE,           /* packet type */

please don't make this unrelated change. I don't like it because sc_state
should really become "enum state" rather than int but then you need to add
forward declarations..

(btw, no comma is permitted on final enum values)

--- btattach.c  6 Dec 2009 12:55:46 -0000       1.5
+++ btattach.c  16 Feb 2010 03:28:53 -0000
@@ -54,13 +54,6 @@

 const struct devtype types[] = {
     {
-       .name = "bcsp",
-       .line = "bcsp",
-       .descr = "Generic BlueCore Serial Protocol",
-       .cflag = CRTSCTS,
-       .speed = B57600,
-    },
-    {
        .name = "bcm2035",
        .line = "btuart",
        .descr = "Broadcom BCM2035",
@@ -68,6 +61,13 @@
        .speed = B115200,
     },
     {
+       .name = "bcsp",
+       .line = "bcsp",
+       .descr = "Generic BlueCore Serial Protocol",
+       .cflag = CRTSCTS,
+       .speed = B57600,
+    },
+    {
        .name = "bgb2xx",
        .line = "btuart",
        .descr = "Philips BGB2xx module",
@@ -83,7 +83,7 @@
     {
        .name = "csr",
        .line = "btuart",
-       .descr = "CSR Casira serial adaptor",
+       .descr = "Cambridge Silicon Radio based modules (not BCSP)",
        .init = &init_csr,
        .cflag = CRTSCTS,
        .speed = B57600,

This is unrelated, and I did it just now..

+static int
+btuart_dtl_probe(dev_t dev)
+{
+#if NCOM > 0
+       struct pcmcia_softc *pcmcia;
+       struct pcmcia_card *card;
+       device_t com;
+       extern struct cdevsw com_cdevsw;
+       struct {
+               uint32_t vendor;
+               uint32_t product;
+       } dtltbl[] = {
+               { PCMCIA_VENDOR_SOCKET, 0x009f },
+       };
+       int i;
+
+       if (major(dev) != cdevsw_lookup_major(&com_cdevsw))
+               return 0;
+
+       com = device_find_by_driver_unit("com", minor(dev));
+       if (device_is_a(device_parent(com), "pcmcia")) {
+               pcmcia = device_private(device_parent(com));
+               card = &pcmcia->card;
+
+               for (i = 0; i < __arraycount(dtltbl); i++)
+                       if (card->manufacturer == dtltbl[i].vendor &&
+                           card->product == dtltbl[i].product)
+                               return 1;
+       }
+#endif
+       return 0;
+}

I really dislike this function, it depends on internals of com driver [btw
COMUNIT(x) would be (minor(x) & COMUNIT_MASK)] and pcmcia and using this
method prevents a soft emulator and/or needs kernel modifications to
handle any new device.

I still think using .l_name = "btdtl" is the best method to select DTL
protocol..

iain




Home | Main Index | Thread Index | Old Index