1/*
2 * client.c
3 *
4 * Copyright (c) 2004 Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
--- 12 unchanged lines hidden (view full) ---
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: client.c,v 1.6 2004/02/26 21:57:55 max Exp $
29 * $FreeBSD: head/usr.sbin/bluetooth/bthidd/client.c 128080 2004-04-10 00:18:00Z emax $
30 */
31
32#include <sys/queue.h>
33#include <assert.h>
34#include <bluetooth.h>
35#include <errno.h>
36#include <fcntl.h>
37#include <stdio.h>
--- 188 unchanged lines hidden (view full) ---
226 l2addr.l2cap_psm = 0;
227
228 if (bind(s, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0) {
229 close(s);
230 return (-1);
231 }
232
233 memcpy(&l2addr.l2cap_bdaddr, bdaddr, sizeof(l2addr.l2cap_bdaddr));
234 l2addr.l2cap_psm = psm;
235
236 if (connect(s, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0 &&
237 errno != EINPROGRESS) {
238 close(s);
239 return (-1);
240 }
241
242 return (s);
243}
244
2 * client.c
3 *
4 * Copyright (c) 2004 Maksim Yevmenkin <m_evmenkin@yahoo.com>
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions
--- 12 unchanged lines hidden (view full) ---
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 *
28 * $Id: client.c,v 1.6 2004/02/26 21:57:55 max Exp $
29 * $FreeBSD: head/usr.sbin/bluetooth/bthidd/client.c 128080 2004-04-10 00:18:00Z emax $
30 */
31
32#include <sys/queue.h>
33#include <assert.h>
34#include <bluetooth.h>
35#include <errno.h>
36#include <fcntl.h>
37#include <stdio.h>
--- 188 unchanged lines hidden (view full) ---
226 l2addr.l2cap_psm = 0;
227
228 if (bind(s, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0) {
229 close(s);
230 return (-1);
231 }
232
233 memcpy(&l2addr.l2cap_bdaddr, bdaddr, sizeof(l2addr.l2cap_bdaddr));
234 l2addr.l2cap_psm = psm;
235
236 if (connect(s, (struct sockaddr *) &l2addr, sizeof(l2addr)) < 0 &&
237 errno != EINPROGRESS) {
238 close(s);
239 return (-1);
240 }
241
242 return (s);
243}
244