From owner-freebsd-bluetooth@FreeBSD.ORG Sun Mar 22 18:23:45 2015 Return-Path: Delivered-To: freebsd-bluetooth@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 0863D75F for ; Sun, 22 Mar 2015 18:23:45 +0000 (UTC) Received: from mail-wg0-x22f.google.com (mail-wg0-x22f.google.com [IPv6:2a00:1450:400c:c00::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 78826D4 for ; Sun, 22 Mar 2015 18:23:44 +0000 (UTC) Received: by wgra20 with SMTP id a20so129327341wgr.3 for ; Sun, 22 Mar 2015 11:23:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=4aTjBBKXjbxWt8JfWpquiCpUyq5R7AXBk5/ia7gX/JY=; b=AEsN7NyPTlOIJSMtxtX8vjkb18TIhQDo2GP805XYky8uxwy2hUNuiapoZFRupxqVWy iOlBuNkHn1YWwmpWHI+HeujYJ/xCIvquASYC8pc4ibrvYhlg8i3JvchEpSNiPfJelgC7 syltp+iospqOXAK3bcZek2PFN07WjD9mbAvGeAVKh2z0LGs5LQtBS7Iw6zE66Btlk4Jn DiT/6RiQeV2JUbqYS7Z+JTYg7BGble3C52ppxsZIS8ncdYyuzzXJwNEPkcmclrvafD4e Y+aRWps0FtQ3YrsaVzxzB4gRQvmRFeBOJ/cMF4tOJE4604jEPonSwcpyUkCSs9K/95/7 S8XA== MIME-Version: 1.0 X-Received: by 10.195.12.35 with SMTP id en3mr172294326wjd.129.1427048622790; Sun, 22 Mar 2015 11:23:42 -0700 (PDT) Received: by 10.27.91.75 with HTTP; Sun, 22 Mar 2015 11:23:42 -0700 (PDT) In-Reply-To: References: <0AD7A2F7-37BE-4F6A-9FD6-F6C81B2CAF36@gmail.com> Date: Sun, 22 Mar 2015 11:23:42 -0700 Message-ID: Subject: Re: register HID with SDP error From: Waitman Gobble To: Maksim Yevmenkin Content-Type: text/plain; charset=UTF-8 Cc: "freebsd-bluetooth@freebsd.org" , Iain Hibbert X-BeenThere: freebsd-bluetooth@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Using Bluetooth in FreeBSD environments List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 22 Mar 2015 18:23:45 -0000 > > Max, > > I solved the problem, I got rid of the 'release key' structure and > change vkeyb->key[0] to 0, then send that as a key release. Its > working now. > > I believe I just need to handle client disconnects, and re-connects, > and I think it will be all good. > > Thanks for your help. > > -- > Waitman Gobble > Los Altos California USA > 510-830-7975 Here's an updated version in case someone needs this sort of thing. daemonized process, uses SIGHUP to disconnect clients and added upper/lower characters and some special characters. Optionally set key stroke delay. https://github.com/waitman/hid_sppd This version only allows a single client connection and single FIFO at one time. Maybe in the future, handle multiple FIFO buffers and clients. But at the moment I don't believe I have a need for that functionality. I needed a way to add BT HID functionality to my inexpensive long-range RFID reader/writer device, because apparently people want to have RFID EPC codes auto-type (into their software applications?). You may specify PID File, FIFO buffer file and keystroke delay (or use the defaults). Keystroke delay is specified in milliseconds. # hid_sppd -P /var/run/boo.pid -F /tmp/fifotmp -d 50 Some examples of sending characters to client: # echo "222223333344444A" >> /tmp/fifotmp or if you need special characters like "\n" and "\t" # printf "22;222\t33 33\t44.444AabcdE\nEEeeeX " >> /tmp/fifotmp (Note that if you use 'printf' then add an extra trailing space.) so, any program should be able to write to the FIFO buffer. To disconnect clients: # pkill -HUP -F /var/run/boo.pid It's possible bad things may happen if you try to send like a Gigabyte of data to the FIFO buffer. It's a thought, but I haven't stress-tested it like that. I'm fairly new to Bluetooth so I don't yet fully understand how everything works together but it seems like a good future project (and possibly GSOC for a student) would be to implement BLE/GATT, and other protocols in this age of 'wearable devices'? -- Waitman Gobble Los Altos California USA 510-830-7975