From owner-freebsd-usb@FreeBSD.ORG Sun Jun 26 04:12:58 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F325C1065670 for ; Sun, 26 Jun 2011 04:12:58 +0000 (UTC) (envelope-from jamesbrandongooch@gmail.com) Received: from mail-wy0-f182.google.com (mail-wy0-f182.google.com [74.125.82.182]) by mx1.freebsd.org (Postfix) with ESMTP id 85E338FC18 for ; Sun, 26 Jun 2011 04:12:58 +0000 (UTC) Received: by wyg24 with SMTP id 24so1117427wyg.13 for ; Sat, 25 Jun 2011 21:12:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=GQBM0cZQPVcoplGWggVU2DmA7v304jhjJi03Ovm4WSM=; b=i3H0SGMlOGLA+fZwAmCyTBQnrXm4iwdsNnyqPcGSdDHM2+qLk4HiTDeNWDeIVYwze2 51QQzJ18T++aiGRmfZx+xyWGEM4RwO0Md/RspfdMVqZ3NV9WI3SUpHJQ1BJJLBpOeQkr V3erybi91gUG2e1Q5FzsGZrs9SqmgrqdN7rOU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=RyWOIr5nBtqBBuFJU4Zv1HwmoVXQaWI7cC5KU8NklxOzOzmjPj237NSeHPkPB+zLpf SWagWRA+hvupxepdDM3wy0nWa/NOZk0cNei30GL53BLn3+9G1vMOhyBVSMFCdy7P/id/ YZH9QcLecAj5cZTr7ryqThXpIvqMeL6I7WzBI= MIME-Version: 1.0 Received: by 10.216.63.143 with SMTP id a15mr1001139wed.65.1309059995184; Sat, 25 Jun 2011 20:46:35 -0700 (PDT) Received: by 10.216.65.203 with HTTP; Sat, 25 Jun 2011 20:46:35 -0700 (PDT) In-Reply-To: References: Date: Sat, 25 Jun 2011 22:46:35 -0500 Message-ID: From: Brandon Gooch To: Maksim Yevmenkin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "freebsd-bluetooth@freebsd.org" , freebsd-usb@freebsd.org Subject: Re: Broadcom BCM2046B1 in HCI mode? X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Jun 2011 04:12:59 -0000 On Wed, Jun 22, 2011 at 11:17 AM, Maksim Yevmenkin wrote: > On Tuesday, June 21, 2011, Brandon Gooch wr= ote: >> I have one of these in my notebook: >> >> uhub4: on usbus0 >> >> This is a bluetooth device in HID mode, but I'd like to switch it to >> HCI mode. I found the following in rc.conf(5): >> >> =A0=A0 =A0 ubthidhci_enable >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 (bool) If set to ``YES'', change the = USB Bluetooth controller >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 from HID mode to HCI mode. =A0You als= o need to specify the >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 location of USB Bluetooth controller = with the >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 ubthidhci_busnum and ubthidhci_addr v= ariables. >> >> =A0=A0 =A0 ubthidhci_busnum >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Bus number where the USB Bluetooth co= ntroller is located. >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Check the output of usbconfig(8) on y= our system to find this >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 information. >> >> =A0=A0 =A0 ubthidhci_addr >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 Bus address of the USB Bluetooth cont= roller. =A0Check the out- >> =A0=A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 put of usbconfig(8) on your system to= find this information. >> >> So I added the appropriate directives to /etc/rc.conf, to no avail: >> >> ubthidhci_enable=3D"YES" >> ubthidhci_busnum=3D"0" >> ubthidhci_addr=3D"5" >> >> This basically calls usbconfig(8) at system start-up in the following wa= y: >> >> /usr/sbin/usbconfig -u 0 -a 5 do_request 0x40 0 0 0 0 > /dev/null 2>&1 >> >> Running this command manually, I see this output: >> >> REQUEST =3D >> >> ...which I've read as potentially being OK, as the operation still may >> have successfully completed -- it hasn't :( >> >> So, has anyone had any luck using this rc.conf(5) directive, or does >> anyone on this list have a modified usbconfig(8) command that may help >> me coax HCI from this device? > > > Switching device between hid and hci modes is s something that is > device / manufacturer specific. It could be that this particular > device need different request or something like that. I would suggest > to look at linux tool called hid2hci. It has support for different > devices from different manufacturers. > > Thanks, > Max > That was an excellent suggestion, so I went and checked it out. In fact, I verified that it indeed does the trick in a couple of recent Linux distros. So can someone help me decipher the byte sequence I need to provide to usbconfig(8)? The hid2hci utility has this function defined for dealing with the device in question: http://git.kernel.org/?p=3Dbluetooth/bluez.git;a=3Dblob;f=3Dtools/hid2hci.c= ;h=3D45a3a3db8b29411ee193e480f5ce8a82a40103d1;hb=3D7822123d08b176ef8b3e8aae= cbc3c8ff25a33483#l122 static int usb_switch_dell(struct usb_dev_handle *dev, enum mode mode) ... char report[] =3D { 0x7f, 0x00, 0x00, 0x00 }; ... report[1] =3D 0x13; .... err =3D usb_control_msg(dev, USB_ENDPOINT_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, USB_REQ_SET_CONFIGURATION, 0x7f | (0x03 << 8), 0, report, sizeof(report), 5000); ... And according to: http://lxr.linux.no/#linux+v2.6.39/include/linux/usb.h#L1400 usb_control_msg() is prototyped: extern int usb_control_msg(struct usb_device *dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void *data, __u16 size, int timeout); ...and I'd like to know what this means in terms of the following (from src/usr.sbin/usbconfig/usbconfig.c): libusb20_dev_request_sync(pdev, &opt->setup, opt->buffer, &actlen, 5000 /* 5 seconds */ , 0)) which is prototyped as: libusb20_dev_request_sync(struct libusb20_device *pdev, struct LIBUSB20_CONTROL_SETUP_DECODED *setup, void *data, uint16_t *pactlen, uint32_t timeout, uint8_t flags); I'm looking for something like the following: # usbconfig -u 0 -a 5 do_request 0x37f 0x13 0 0 0 However, this isn't correct I know, but I could use some help sorting it out -- any takers? -Brandon (Bad form: I'm cross-posting)