Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 29 Aug 2019 05:34:28 +0000 (UTC)
From:      "mms.vanbreukelingen@gmail.com" <mms.vanbreukelingen@gmail.com>
To:        "imp@bsdimp.com" <imp@bsdimp.com>
Cc:        Maksim Yevmenkin <maksim.yevmenkin@gmail.com>,  Konstantin Belousov <kostikbel@gmail.com>,  Hans Petter Selasky <hps@selasky.org>,  "freebsd-current@freebsd.org" <freebsd-current@freebsd.org>
Subject:   Re: Kernel-Crash when working with ubt0
Message-ID:  <101056958.134799.1567056868032@mail.yahoo.com>
In-Reply-To: <CANCZdfodjn_Aenp=3hK_tUpH-8mTD5CQCTp%2B-%2BeMqpCv2q_kjg@mail.gmail.com>
References:  <1115053193.64543.1567031661382.ref@mail.yahoo.com> <1115053193.64543.1567031661382@mail.yahoo.com> <CANCZdfr%2B21-L8C61ThW2CQi8bjVGcvBPxxDCNoXyZXN0Bv44pA@mail.gmail.com> <CAM94aeoPUTMpqBZWrpe3hvqJ7OnHENA0co=tOMPiZkckF8Mk5A@mail.gmail.com> <CANCZdfodjn_Aenp=3hK_tUpH-8mTD5CQCTp%2B-%2BeMqpCv2q_kjg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 29 Aug 2019 at 6:04, Warner Losh

<imp@bsdimp.com> wrote:  =20

On Wed, Aug 28, 2019, 8:57 PM Miranda Maria Sophie Van den Breukelingen <mm=
s.vanbreukelingen@gmail.com> wrote:



On Thu, 29 Aug 2019 at 03:48, Warner Losh <imp@bsdimp.com> wrote:



On Wed, Aug 28, 2019, 4:34 PM mms.vanbreukelingen@gmail.com <mms.vanbreukel=
ingen@gmail.com> wrote:

@Maksim, I first did a "git apply -R bt.diff" and then
root@freeBSD13:/usr/src # git apply --stat --check --ignore-whitespace ng_b=
tsocket_hci_raw.c.diff.txt
error: patch failed: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw=
.c:1156
error: head/sys/netgraph/bluetooth/socket/ng_btsocket_hci_raw.c: patch does=
 not apply

patch -p1 worked for me to apply it.
And it worked just fine for everything once I rebooted. The patch looked fi=
ne to my eye.
Warner=C2=A0


Rebuilding with MTX_SPIN=3Dy (withouth patch)...On Wed, 28 Aug 2019 at 19:1=
0, Maksim Yevmenkin <maksim.yevmenkin@gmail.com> wrote:

> > > Hmm... interesting....
> > >
> > > I only took a brief look at it. I suppose I can ensure user space add=
ress is wired and then copyout() can be called with mutex held
> >
> > >No, you cannot do this, at least without making the kernel to panic.
> > User might unmap the wired mapping at any time still.
>
> Kostik,
>
> i was thinking along the lines of vslock/vsunlock and copyout_nofault.
> basically similar to the sysctl code. do you think this would not
> work?

actually, i dont think i need to hold lock over copyout. attached is
my version of the patch (untested)

thank
max=C2=A0





oh, didn't patch it with the -p1 option, maybe this is why. I rebuild the k=
ernel and removed the WITNESS option,=C2=A0option=C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0MTX_SPIN=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# is an illtusion for not locking =
yourself out
and it does work. When using the built-in-adapter you not just have to rebo=
ot but to turn it off for at least 10 secs., and then reboot into freeBSD a=
gain. Here's what I'm having right now:
/etc/rc.d/bluetooth start ubt0
/etc/rc.d/bluetooth: ERROR: Unable to setup Bluetooth stack for device ubt0
root@freeBSD13:/usr/home/miranda # /etc/rc.d/bluetooth start ubt0
root@freeBSD13:/usr/home/miranda #=20

=C2=A0So, you got to tell it at least twice because of dmesg often calling:=
ng_hci_process_command_timeout: ubt0hci - unable to complete HCI command OG=
F=3D0x3, OCF=3D0x3. Timeout

The ubt0 is the Asus stack, I can't setup the internal ubt1 anymore at all.=
 Maybe I'm gonna patch with the -p1 flag tomorrow.=C2=A0
@warner Is there a way to patch a running kernel and just reboot or is it a=
lways in a new buildkernel environment? I did "patch=C2=A0 =C2=A0bt.diff";=
=C2=A0
@maksim; special way to patch correctly?
bluetooth-config scan
Scanning for new Bluetooth devices (Attempt 1 of 5) ... done.
Found 1 new bluetooth device (now scanning for names):
[ 1] c0:7a:a5:00:c7:11 =C2=A0"Ubittek MagicBox" (Ubittek_MagicBox)
Select device to pair with [1, or 0 to rescan]: 1

Warning: An entry for device c0:7a:a5:00:c7:11 is already present in /etc/b=
luetooth/hcsecd.conf.
To modify pairing information, edit this file and run
 =C2=A0service hcsecd restart
Continue? [yes]: yes

Entry in /etc/bluetooth/hcsecd.conf:device {
 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0bdaddr =C2=A0c0:7a:a5:00:c7:11;
 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0name =C2=A0=C2=A0=C2=A0"Ubittek =
MagicBox";
 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0key =C2=A0=C2=A0=C2=A0=C2=A0noke=
y;
 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0pin =C2=A0=C2=A0=C2=A0=C2=A0nopi=
n;
}

l2ping:l2ping -a c0:7a:a5:00:c7:11
16 bytes from Ubittek_MagicBox seq_no=3D0 time=3D2611.842 ms result=3D0 =C2=
=A0
16 bytes from Ubittek_MagicBox seq_no=3D1 time=3D6.274 ms result=3D0 =C2=A0
16 bytes from Ubittek_MagicBox seq_no=3D2 time=3D6.862 ms result=3D0=C2=A0
[not 0 bytes??]

but, and this is the status for now:l2control -a c0:7a:a5:00:c7:11 read_cha=
nnel_list
l2control: Could not bind socket, bdaddr=3Dc0:7a:a5:00:c7:11: Network is do=
wn

I think it is paired correctly but doesn't know how to connect; in linux wi=
th bluethothctl I get normally "device paired" ---- self-connection-trial -=
--- "device connected" and 5 secs later "device disconnected". It has to do=
 a salvating "bip" at the box and then it's connected.=C2=A0
kldstat:Id Refs Address =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Size Name
 1 =C2=A0=C2=A087 0xffffffff80200000 =C2=A02288f58 kernel
 2 =C2=A0=C2=A0=C2=A01 0xffffffff824ad000 =C2=A0=C2=A0=C2=A0=C2=A03170 spla=
sh_bmp.ko
 3 =C2=A0=C2=A0=C2=A01 0xffffffff824b1000 =C2=A0=C2=A0=C2=A0=C2=A0a468 ng_u=
bt.ko
 4 =C2=A0=C2=A0=C2=A03 0xffffffff824bc000 =C2=A0=C2=A0=C2=A012d10 ng_hci.ko
 5 =C2=A0=C2=A0=C2=A04 0xffffffff824cf000 =C2=A0=C2=A0=C2=A0=C2=A02dc0 ng_b=
luetooth.ko
 6 =C2=A0=C2=A0=C2=A07 0xffffffff824d2000 =C2=A0=C2=A0=C2=A018d50 netgraph.=
ko
 7 =C2=A0=C2=A0=C2=A01 0xffffffff824eb000 =C2=A0=C2=A0=C2=A018c28 ng_l2cap.=
ko
 8 =C2=A0=C2=A0=C2=A01 0xffffffff82504000 =C2=A0=C2=A0=C2=A068840 if_em_upd=
ated.ko
 9 =C2=A0=C2=A0=C2=A01 0xffffffff8256d000 =C2=A0=C2=A0=C2=A096fa0 linux64.k=
o=C2=A010 =C2=A0=C2=A0=C2=A03 0xffffffff82604000 =C2=A0=C2=A0=C2=A0=C2=A0b7=
60 linux_common.ko
11 =C2=A0=C2=A0=C2=A01 0xffffffff82610000 =C2=A0=C2=A0=C2=A0b4bf0 linux.ko
12 =C2=A0=C2=A0=C2=A01 0xffffffff826c5000 =C2=A0=C2=A0=C2=A0=C2=A02a78 ubtb=
cmfw.ko
13 =C2=A0=C2=A0=C2=A01 0xffffffff82d18000 =C2=A0=C2=A0=C2=A07b040 i915kms.k=
o
14 =C2=A0=C2=A0=C2=A01 0xffffffff82d94000 =C2=A0=C2=A0=C2=A03d9e8 drm2.ko
15 =C2=A0=C2=A0=C2=A04 0xffffffff82dd2000 =C2=A0=C2=A0=C2=A0=C2=A01f40 iicb=
us.ko
16 =C2=A0=C2=A0=C2=A01 0xffffffff82dd4000 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0f70=
 iic.ko
17 =C2=A0=C2=A0=C2=A01 0xffffffff82dd5000 =C2=A0=C2=A0=C2=A0=C2=A01570 iicb=
b.ko
18 =C2=A0=C2=A0=C2=A01 0xffffffff82dd7000 =C2=A0=C2=A0=C2=A015720 if_iwm.ko
19 =C2=A0=C2=A0=C2=A01 0xffffffff82ded000 =C2=A0=C2=A0=C2=A0e045f iwm3160fw=
.ko
20 =C2=A0=C2=A0=C2=A01 0xffffffff82ece000 =C2=A0=C2=A0=C2=A0=C2=A01840 uhid=
.ko
21 =C2=A0=C2=A0=C2=A01 0xffffffff82ed0000 =C2=A0=C2=A0=C2=A0=C2=A02928 ums.=
ko
22 =C2=A0=C2=A0=C2=A01 0xffffffff82ed3000 =C2=A0=C2=A0=C2=A019690 ng_btsock=
et.ko
23 =C2=A0=C2=A0=C2=A01 0xffffffff82eed000 =C2=A0=C2=A0=C2=A0=C2=A020f0 ng_s=
ocket.ko
24 =C2=A0=C2=A0=C2=A01 0xffffffff82ef0000 =C2=A0=C2=A0=C2=A0=C2=A04570 auto=
fs.ko
25 =C2=A0=C2=A0=C2=A01 0xffffffff82ef5000 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0acf=
 mac_ntpd.ko
26 =C2=A0=C2=A0=C2=A01 0xffffffff82ef6000 =C2=A0=C2=A0=C2=A019738 ext2fs.ko
27 =C2=A0=C2=A0=C2=A01 0xffffffff82f10000 =C2=A0=C2=A0=C2=A0=C2=A03a8c geom=
_linux_lvm.ko

13 and 14 is new here with llvm-devel!
hccontrol -n ubt0hci read_connection_list =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0
Remote BD_ADDR =C2=A0=C2=A0=C2=A0Handle Type Mode Role Encrypt Pending Queu=
e State
Ubittek_MagicBox =C2=A0=C2=A0=C2=A0=C2=A0=C2=A012 =C2=A0ACL =C2=A0=C2=A0=C2=
=A00 MAST =C2=A0=C2=A0=C2=A0NONE =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A00 =C2=
=A0=C2=A0=C2=A0=C2=A00 OPEN

btsockstat=C2=A0=C2=A0
Active L2CAP sockets
PCB =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0Recv-Q Send-Q Local address/PSM =C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0Foreign address =C2=A0=C2=A0CID =C2=A0=C2=A0Stat=
e
fffff8000331db00 =C2=A0=C2=A0=C2=A0=C2=A0=C2=A00 =C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A00 * =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0=C2=A0=C2=A0=C2=A0=C2=A0/1 =C2=A0=C2=A0=C2=A0=C2=A0* =C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A00 =C2=A0=C2=A0=C2=A0=C2=A0LISTEN

So it's now a problem with the L2CAP and there's no A2DP-fix anymore for BS=
D, AFAIK. Suggestions?


https://wiki.freebsd.org/SteveWills/BTSpeaker

Might be interesting. I've not tried this yet, so I don't know if it is too=
 old, but it references bluetooth-config, which is fairly new...
My goals are more modest: I just want to get the keyboard I have working, w=
ith the modified keypad I have... :)
Warner

Miranda
THX for the Tipp with bluetooth-config,=C2=A0 gotta try.=C2=A0 When I do pa=
tch -p1 bt.diff there's an everlasting thinking without output no matter if=
 done in /usr/src or /usr/src/head...=C2=A0
When you do a pkg search bluetooth you'd probably desiluded.=C2=A0

I have some BT-keyboard,=C2=A0 too,=C2=A0 switching between usb-stack and u=
bs-stack with Combo,=C2=A0 but not even working with Linux,=C2=A0 well,=C2=
=A0 let's see what's happening,=C2=A0 when I attach and a Q13 Bluetooth in-=
ear-headphone,=C2=A0 just for trying out the stack and maybe,=C2=A0 maybe o=
ne day we all get rid of those cabels. Salad?=C2=A0
Miranda
 =20



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?101056958.134799.1567056868032>