From owner-freebsd-bluetooth@FreeBSD.ORG Wed Oct 8 16:25:31 2008 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 43B1B1065686 for ; Wed, 8 Oct 2008 16:25:31 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: from nf-out-0910.google.com (nf-out-0910.google.com [64.233.182.187]) by mx1.freebsd.org (Postfix) with ESMTP id B14D58FC18 for ; Wed, 8 Oct 2008 16:25:30 +0000 (UTC) (envelope-from maksim.yevmenkin@gmail.com) Received: by nf-out-0910.google.com with SMTP id h3so250724nfh.33 for ; Wed, 08 Oct 2008 09:25:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to :subject:cc:in-reply-to:mime-version:content-type :content-transfer-encoding:content-disposition:references; bh=FqDgQW5rXoyOm5wzrNpyLJ6vXgnfd8Yr6gYb0ZxXrIA=; b=fiOy3ASakVAzQytclDOn0JoGd7Kz2GySGJI/shmOfzcgj2Fv455W1ztCmhrAxKBbCC pC67h5QxkXxpvDDGYieVhr1V7jLZ7VRmeagyJM1+zCs1J0+/2QobannyxPGjB9icHlf1 dNIZfEZmtSxGZabjoWZtAxipwask9UfzNvDE0= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version :content-type:content-transfer-encoding:content-disposition :references; b=wRve5vTj2g0ByxfjfGKEALQZmI0GysPSFuLTjCnA6ZTwYyxJyJOt2szoV/J86og6x8 Q5Rw4eEEZBAwuRsN1UZOerwxvudfBBvsnA8hRyWTyiBqMlft8DfS8oRfNfkB7Pv1LFO7 2mvjrDh6GfEBbrW3tJyKAy+ADCK7cq4T4ipGo= Received: by 10.86.82.6 with SMTP id f6mr3688404fgb.78.1223483124181; Wed, 08 Oct 2008 09:25:24 -0700 (PDT) Received: by 10.86.28.20 with HTTP; Wed, 8 Oct 2008 09:25:24 -0700 (PDT) Message-ID: Date: Wed, 8 Oct 2008 09:25:24 -0700 From: "Maksim Yevmenkin" To: vova@fbsd.ru In-Reply-To: <1223478034.1864.65.camel@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <3a386af20809261420j535680e8pf44453dbf6f84b20@mail.gmail.com> <1223034512.1842.111.camel@localhost> <1223106788.4832.25.camel@localhost> <1223478034.1864.65.camel@localhost> Cc: freebsd-bluetooth@freebsd.org Subject: Re: Bluetooth audio (once again) X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Oct 2008 16:25:31 -0000 On 10/8/08, Vladimir Grebenschikov wrote: > On Tue, 2008-10-07 at 09:13 -0700, Maksim Yevmenkin wrote: > > > > > > ok.be warned, you will need to write some code for that. its > > > > relatively simple. basically open an rfcomm socket and then open a sco > > > > socket. i can provide examples if you want me to. > > > > > > Please, send me an example if you have. > > > > attached > > > Thank you, I've played a bit with it. > > So far I was able to establish connection to channel 1 or 2 of my > headset (Headset and advanced audio). > > Both connections (rfcomm and sco) are opened, headset sends zeros > through sco connection and does some AT-chat on rfcomm. that sounds about right :) and that is where i left it off for now due to lack of time :( > Looks like I need to implement chat to make headset to work. do not really need to. once sco connection is open, audio should be flowing in both directions. you could try to talk to the headset after opening sco connection and dump all the sco data into the file. the data are basically raw samples in 8khz a/u-law encoding 8bit or linear encoding 16bit (depends on voice settings). you should be able to play those back using sox from ports or something like this. i can dig up my notes and find the recipe if you want me to. rfcomm channel is strictly for control. for example, you can make headset ring by sending "RING" command to it. also headset will send at+ckpd=200 every time button is pressed. there also might be a at+vgm or at+vgs commands to report/set microphone/speaker gain, etc. i suggest reading "headset profile" specification document. if you can not find one on the net, let me know. > Then I dig a bit into bluez sources, and found two things - first, looks > like we will need to use/re-implement big part of bluez/audio > sub-directory to get full-functional audio to work under freebsd. whoa! hold on just a second :) lets not jump the gun here. first lets fix existing code. need to make sure that sco works reliably at least up to the socket layer. the first goal would be to, say, have a tool that can receive/send audio from/to headset. say have a mp3 sent to headset over sco (re-encoding can be done by outside tool like sox) > Second, I've found that bluez uses almost same structures and calls to > interact with kernel. yes, its all very similar. it was intended this way :) > Probably it worth to try port bluez (or part of bluez related to sound) > to freebsd instead of re-writing whole beast ? What do you think ? two things 1) like i said we need to fix existing code first, so lets focus on low hanging fruit here 2) license issues. bluez is gnu, which could be a problem. we could take a look at what netbsd does. > I spend only about half an our to make whole bluez to compile under > freebsd (except network bridging and alsa). but not even tried to start > it, though. ok. thanks for your work! thanks, max