[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-usb-devel
Subject:    [linux-usb-devel] [patch] Prevent hid-core claiming Apple Bluetooth device on new G4 powerbooks
From:       Andrew de Quincey <adq_dvb () lidskialf ! net>
Date:       2005-08-04 22:16:12
Message-ID: 200508042316.12223.adq_dvb () lidskialf ! net
[Download RAW message or body]

Hi, one maconlinux session with the excellent linux kernel usbmon support 
later, and I have my G4 powerbook's bluetooth adapter working.

To recap: My new G4 powerbook has a bluetooth device that boots up in what 
apppears to be a compatability mode - it looks exactly like an HID 
keyboard/mouse device. 

A special command sequence is sent to switch it into full bluetooth mode. When 
this occurs the original HID device vanishes, and a new (bluetooth HID) USB 
device appears on the bus with a different product ID.

The original thread is here: 
http://sourceforge.net/mailarchive/message.php?msg_id=12532263

The attached patch adds the device to the hid-core quirks so that hid-core 
ignores it.

Also attached is my userspace program to switch the device.. I think this 
should be in the kernel somewhere, but I'm not sure where. The bluetooth USB 
HID driver sounds most suitable - does anyone have any suggestions?

Signed-off-by: Andrew de Quincey <adq_dvb@lidskialf.net>

["apple-bt-ignore.patch" (text/x-diff)]

--- linux-2.6.13-rc4/drivers/usb/input/hid-core.c	2005-08-04 22:57:13.000000000 +0100
+++ linux-2.6.13-rc4-pcmciafix/drivers/usb/input/hid-core.c	2005-08-04 22:52:55.000000000 +0100
@@ -1441,6 +1441,8 @@
 #define USB_DEVICE_ID_NETWORKANALYSER	0x2020
 #define USB_DEVICE_ID_POWERCONTROL	0x2030
 
+#define USB_VENDOR_ID_APPLE		0x05ac
+#define USB_DEVICE_ID_APPLE_BLUETOOTH  	0x1000
 
 /*
  * Alphabetically sorted blacklist by quirk type.
@@ -1459,6 +1461,7 @@
 	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_22, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_23, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE },
+	{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_BLUETOOTH, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW40, HID_QUIRK_IGNORE },
 	{ USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW24, HID_QUIRK_IGNORE },

["btinit.c" (text/x-csrc)]

#include <usb.h>
#include <stdio.h>


int main(int argc, char *argv[]) {
  struct usb_bus *busses;
  struct usb_bus *bus;
  char tmp[256];


  usb_init();
  usb_find_busses();
  usb_find_devices();

  busses = usb_get_busses();

  for(bus = busses; bus; bus = bus->next) {
    struct usb_device *dev;

    for(dev = bus->devices; dev; dev = dev->next) {
      if ((dev->descriptor.idVendor == 0x5ac) && (dev->descriptor.idProduct == 0x1000)) {
        usb_dev_handle *devhandle;

        if (devhandle = usb_open(dev)) {
          usb_control_msg(devhandle, 0x40, 0x00, 0, 0, tmp, 0, 0);
          usb_control_msg(devhandle, 0x40, 0x00, 0, 0, tmp, 0, 0);
          usb_control_msg(devhandle, 0x40, 0x00, 0, 0, tmp, 0, 0);
          usb_control_msg(devhandle, 0x40, 0x00, 0, 0, tmp, 0, 0);
          usb_control_msg(devhandle, 0x40, 0x00, 0, 0, tmp, 0, 0);
          usb_control_msg(devhandle, 0x40, 0x00, 0, 0, tmp, 0, 0);

          usb_close(devhandle);
        }
      }
    }
  }
}

-------------------------------------------------------
SF.Net email is Sponsored by the Better Software Conference & EXPO
September 19-22, 2005 * San Francisco, CA * Development Lifecycle Practices
Agile & Plan-Driven Development * Managing Projects & Teams * Testing & QA
Security * Process Improvement & Measurement * http://www.sqe.com/bsce5sf
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic