diff options
Diffstat (limited to 'hidd')
-rw-r--r-- | hidd/fakehid.c | 11 | ||||
-rw-r--r-- | hidd/hidd.h | 4 | ||||
-rw-r--r-- | hidd/main.c | 10 |
3 files changed, 17 insertions, 8 deletions
diff --git a/hidd/fakehid.c b/hidd/fakehid.c index 138d2b48..2699d3f5 100644 --- a/hidd/fakehid.c +++ b/hidd/fakehid.c @@ -277,7 +277,7 @@ static void sig_term(int sig) __io_canceled = 1; } -void epox_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel) +int epox_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel) { unsigned char buf[16]; struct sigaction sa; @@ -287,12 +287,12 @@ void epox_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel) sk = rfcomm_connect(src, dst, channel); if (sk < 0) - return; + return -1; fd = uinput_create("Bluetooth Presenter", 0, 1); if (fd < 0) { close(sk); - return; + return -1; } ba2str(dst, addr); @@ -335,9 +335,12 @@ void epox_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel) close(fd); close(sk); + + return 0; } -void headset_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel) +int headset_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel) { printf("Not implemented\n"); + return -1; } diff --git a/hidd/hidd.h b/hidd/hidd.h index 5e9fd311..afc65be1 100644 --- a/hidd/hidd.h +++ b/hidd/hidd.h @@ -28,5 +28,5 @@ int get_stored_device_info(const bdaddr_t *src, const bdaddr_t *dst, struct hidp int get_sdp_device_info(const bdaddr_t *src, const bdaddr_t *dst, struct hidp_connadd_req *req); int get_alternate_device_info(const bdaddr_t *src, const bdaddr_t *dst, uint16_t *uuid, uint8_t *channel); -void epox_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel); -void headset_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel); +int epox_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel); +int headset_presenter(const bdaddr_t *src, const bdaddr_t *dst, uint8_t channel); diff --git a/hidd/main.c b/hidd/main.c index b1fe2cb4..4ececd5a 100644 --- a/hidd/main.c +++ b/hidd/main.c @@ -438,12 +438,18 @@ static void do_connect(int ctl, bdaddr_t *src, bdaddr_t *dst, uint8_t subclass, goto connect; case SERIAL_PORT_SVCLASS_ID: - epox_presenter(src, dst, channel); + if (epox_presenter(src, dst, channel) < 0) { + close(ctl); + exit(1); + } break; case HEADSET_SVCLASS_ID: case HANDSFREE_SVCLASS_ID: - headset_presenter(src, dst, channel); + if (headset_presenter(src, dst, channel) < 0) { + close(ctl); + exit(1); + } break; } |