* Help
@ 2009-09-18 11:19 Lorenzo Brito Morales
2009-09-18 13:18 ` Help Iain Hibbert
0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Brito Morales @ 2009-09-18 11:19 UTC (permalink / raw)
To: linux-bluetooth
Hi, im a beggineer in bluez and also in programming stuff, i have read
a coupble of things about bluez and programming, what i want to do is
a progran that send files to the phone is near by,,im trying to get
work these code, its compile, and conect to the phone , but in the
phone ask for a number security, ahta later i have to type in the
computer...... how can i send a file whitout asking a number? just
asking in the phone about aceptting the file
#include <stdio.h>
#include <unistd.h>
#include <sys/socket.h>
#include <bluetooth/bluetooth.h>
#include <bluetooth/rfcomm.h>
int main(int argc, char **argv)
{
struct sockaddr_rc addr = { 0 };
int s, status;
char dest[18] = "00:23:F1:CC:BF:10";
// allocate a socket
s = socket(AF_BLUETOOTH, SOCK_STREAM, BTPROTO_RFCOMM);
// set the connection parameters (who to connect to)
addr.rc_family = AF_BLUETOOTH;
addr.rc_channel = 1;
str2ba( dest, &addr.rc_bdaddr );
// connect to server
status = connect(s, (struct sockaddr *)&addr, sizeof(addr));
// send a message
if( 0 == status ) {
status = send(s, "hello!", 6, 0);
}
if( status < 0 ) perror("uh oh");
close(s);
return 0;
}
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Help
2009-09-18 11:19 Help Lorenzo Brito Morales
@ 2009-09-18 13:18 ` Iain Hibbert
0 siblings, 0 replies; 3+ messages in thread
From: Iain Hibbert @ 2009-09-18 13:18 UTC (permalink / raw)
To: Lorenzo Brito Morales; +Cc: linux-bluetooth
On Fri, 18 Sep 2009, Lorenzo Brito Morales wrote:
> Hi, im a beggineer in bluez and also in programming stuff, i have read
> a coupble of things about bluez and programming, what i want to do is
> a progran that send files to the phone is near by,,im trying to get
> work these code, its compile, and conect to the phone , but in the
> phone ask for a number security, ahta later i have to type in the
> computer...... how can i send a file whitout asking a number? just
> asking in the phone about aceptting the file
Well, in this case the phone requires authentication to connect to the
service on RFCOMM channel #1 so you are out of luck unless you can provide
the same PIN at both ends (or other pairing)
You need to investiage "OBEX Object Push". Sometimes you can send a text
file without authentication, but the person who owns the phone will
usually be required to authorise the connection (ie a message will appear,
asking if they wish to receive the file and they will need to approve)
It is a long way to do it yourself, look for "obexd" at www.bluez.org
iain
^ permalink raw reply [flat|nested] 3+ messages in thread
* help
@ 2022-06-03 23:04 Thomas Green
0 siblings, 0 replies; 3+ messages in thread
From: Thomas Green @ 2022-06-03 23:04 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
A couple of weeks ago, I posted this question, and haven't heard anything back. Is there someone out there that can help me?
Hi.... I have problem when removing a device from use. I have two identical devices connected to my host. For each of them I disconnect the device, then remove it. Sometimes it works just fine, and sometimes it seems something doesn't finish, and a timeout error is returned. When it doesn't finish, I can't do anything any more. A scan doesn't do anything, and if I try to turn off the scan I get an InProgress error. Here is a log produced by running
bluetoothd -experimanal -debug -n
bluetoothd[3432]: ../bluez-5.50/src/device.c:btd_device_set_temporary() temporary 1
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0bead0: device C4:33:13:80:17:20 profile gap-profile state changed: connected -> disconnecting (0)
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0bead0: device C4:33:13:80:17:20 profile gap-profile state changed: disconnecting -> disconnected (0)
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:dev_disconnected() Device C4:33:13:80:17:20 disconnected, reason 2
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:adapter_remove_connection()
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:adapter_remove_connection() Removing temporary device /org/bluez/hci0/dev_C4_33_13_80_17_20
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_remove() Removing device /org/bluez/hci0/dev_C4_33_13_80_17_20
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0bead0: device C4:33:13:80:17:20 profile gap-profile state changed: disconnected -> unavailable (0)
bluetoothd[3432]: ../bluez-5.50/profiles/gap/gas.c:gap_remove() GAP profile remove (C4:33:13:80:17:20)
bluetoothd[3432]: ../bluez-5.50/src/service.c:btd_service_unref() 0x55fffe0bead0: ref=0
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0b4dc0: device C4:33:13:80:17:20 profile :1.70/ntouch/app/6e400001-b5a3-f393-e0a9-e50e24dcca9e state changed: connecting -> disconnected (-103)
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_profile_connected() :1.70/ntouch/app/6e400001-b5a3-f393-e0a9-e50e24dcca9e Software caused connection abort (103)
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0b4dc0: device C4:33:13:80:17:20 profile :1.70/ntouch/app/6e400001-b5a3-f393-e0a9-e50e24dcca9e state changed: disconnected -> unavailable (0)
bluetoothd[3432]: ../bluez-5.50/src/gatt-database.c:profile_device_remove() :1.70/ntouch/app/6e400001-b5a3-f393-e0a9-e50e24dcca9e removed
bluetoothd[3432]: ../bluez-5.50/src/service.c:btd_service_unref() 0x55fffe0b4dc0: ref=0
bluetoothd[3432]: ../bluez-5.50/src/device.c:btd_device_unref() Freeing device /org/bluez/hci0/dev_C4_33_13_80_17_20
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_service() Removing GATT service: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000a
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_service() Removing GATT service: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000b
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000b/char000c
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_descriptor() Removing GATT descriptor: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000b/char000c/desc000e
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_service() Removing GATT service: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000f
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000f/char0010
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000f/char0012
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:notify_client_unref() owner :1.70
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:notify_client_free() owner :1.70
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_descriptor() Removing GATT descriptor: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000f/char0012/desc0014
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000f/char0015
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:notify_client_unref() owner :1.70
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:notify_client_free() owner :1.70
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_descriptor() Removing GATT descriptor: /org/bluez/hci0/dev_C4_33_13_80_17_20/service000f/char0015/desc0017
bluetoothd[3432]: ../bluez-5.50/attrib/gattrib.c:g_attrib_unref() 0x55fffe0c3bf0: g_attrib_unref=0
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_free() 0x55fffe0b99d0
bluetoothd[3432]: ../bluez-5.50/plugins/policy.c:disconnect_cb() reason 2
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:bonding_attempt_complete() hci0 bdaddr C4:33:13:80:17:20 type 2 status 0xe
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:resume_discovery()
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:connected_callback() hci0 device C4:33:13:80:17:20 connected eir_len 23
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_create() dst C4:33:13:80:17:20
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_new() address C4:33:13:80:17:20
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_new() Creating device /org/bluez/hci0/dev_C4_33_13_80_17_20
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:dev_disconnected() Device C4:33:13:80:17:20 disconnected, reason 2
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:adapter_remove_connection()
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:adapter_remove_connection() Removing temporary device /org/bluez/hci0/dev_C4_33_13_80_17_20
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_remove() Removing device /org/bluez/hci0/dev_C4_33_13_80_17_20
bluetoothd[3432]: ../bluez-5.50/src/device.c:btd_device_unref() Freeing device /org/bluez/hci0/dev_C4_33_13_80_17_20
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_free() 0x55fffe0d5640
bluetoothd[3432]: ../bluez-5.50/plugins/policy.c:disconnect_cb() reason 2
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:bonding_attempt_complete() hci0 bdaddr C4:33:13:80:17:20 type 2 status 0xe
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:resume_discovery()
bluetoothd[3432]: ../bluez-5.50/src/device.c:btd_device_set_temporary() temporary 1
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0bcbe0: device C4:53:23:00:38:10 profile gap-profile state changed: connected -> disconnecting (0)
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0bcbe0: device C4:53:23:00:38:10 profile gap-profile state changed: disconnecting -> disconnected (0)
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:dev_disconnected() Device C4:53:23:00:38:10 disconnected, reason 2
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:adapter_remove_connection()
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:adapter_remove_connection() Removing temporary device /org/bluez/hci0/dev_C4_53_23_00_38_10
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_remove() Removing device /org/bluez/hci0/dev_C4_53_23_00_38_10
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0bcbe0: device C4:53:23:00:38:10 profile gap-profile state changed: disconnected -> unavailable (0)
bluetoothd[3432]: ../bluez-5.50/profiles/gap/gas.c:gap_remove() GAP profile remove (C4:53:23:00:38:10)
bluetoothd[3432]: ../bluez-5.50/src/service.c:btd_service_unref() 0x55fffe0bcbe0: ref=0
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0b3770: device C4:53:23:00:38:10 profile :1.70/ntouch/app/6e400001-b5a3-f393-e0a9-e50e24dcca9e state changed: connecting -> disconnected (-103)
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_profile_connected() :1.70/ntouch/app/6e400001-b5a3-f393-e0a9-e50e24dcca9e Software caused connection abort (103)
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0b3770: device C4:53:23:00:38:10 profile :1.70/ntouch/app/6e400001-b5a3-f393-e0a9-e50e24dcca9e state changed: disconnected -> unavailable (0)
bluetoothd[3432]: ../bluez-5.50/src/gatt-database.c:profile_device_remove() :1.70/ntouch/app/6e400001-b5a3-f393-e0a9-e50e24dcca9e removed
bluetoothd[3432]: ../bluez-5.50/src/service.c:btd_service_unref() 0x55fffe0b3770: ref=0
bluetoothd[3432]: ../bluez-5.50/src/device.c:btd_device_unref() Freeing device /org/bluez/hci0/dev_C4_53_23_00_38_10
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_service() Removing GATT service: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000a
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_service() Removing GATT service: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000b
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000b/char000c
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_descriptor() Removing GATT descriptor: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000b/char000c/desc000e
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_service() Removing GATT service: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000f
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000f/char0010
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000f/char0012
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:notify_client_unref() owner :1.70
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:notify_client_free() owner :1.70
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_descriptor() Removing GATT descriptor: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000f/char0012/desc0014
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_characteristic() Removing GATT characteristic: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000f/char0015
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:notify_client_unref() owner :1.70
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:notify_client_free() owner :1.70
bluetoothd[3432]: ../bluez-5.50/src/gatt-client.c:unregister_descriptor() Removing GATT descriptor: /org/bluez/hci0/dev_C4_53_23_00_38_10/service000f/char0015/desc0017
bluetoothd[3432]: ../bluez-5.50/attrib/gattrib.c:g_attrib_unref() 0x55fffe0ab990: g_attrib_unref=0
bluetoothd[3432]: ../bluez-5.50/src/device.c:device_free() 0x55fffe0bc500
bluetoothd[3432]: ../bluez-5.50/plugins/policy.c:disconnect_cb() reason 2
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:bonding_attempt_complete() hci0 bdaddr C4:53:23:00:38:10 type 2 status 0xe
bluetoothd[3432]: ../bluez-5.50/src/adapter.c:resume_discovery()
bluetoothd[3432]: ../bluez-5.50/src/device.c:btd_device_set_temporary() temporary 1
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0b9880: device C4:53:23:00:56:A0 profile gap-profile state changed: connected -> disconnecting (0)
bluetoothd[3432]: ../bluez-5.50/src/service.c:change_state() 0x55fffe0b9880: device C4:53:23:00:56:A0 profile gap-profile state changed: disconnecting -> disconnected (0)
If you could help me figure out why it works in once instance and not the second, I would very much appreciate it.
Tom Green
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-03 23:05 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-18 11:19 Help Lorenzo Brito Morales
2009-09-18 13:18 ` Help Iain Hibbert
-- strict thread matches above, loose matches on Subject: below --
2022-06-03 23:04 help Thomas Green
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox