From d2b8211ae2eeb21773d49cb986b0dc4257f8e2e1 Mon Sep 17 00:00:00 2001 From: Grazvydas Ignotas Date: Wed, 4 Apr 2012 02:01:48 +0300 Subject: [PATCH] bluez4: add urjaman's brf6300 patches --- recipes/bluez/bluez4.inc | 4 +- ...Implement-texas_change_speed-functio.patch | 74 +++++++++++++++++++ recipes/bluez/bluez4/firmware_path.patch | 12 +++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 recipes/bluez/bluez4/0001-hciattach_tialt-Implement-texas_change_speed-functio.patch create mode 100644 recipes/bluez/bluez4/firmware_path.patch diff --git a/recipes/bluez/bluez4.inc b/recipes/bluez/bluez4.inc index d8049222f3..05e4e3fa21 100644 --- a/recipes/bluez/bluez4.inc +++ b/recipes/bluez/bluez4.inc @@ -4,7 +4,7 @@ SECTION = "libs" PRIORITY = "optional" LICENSE = "GPL" DEPENDS = "gst-plugins-base alsa-lib virtual/libusb0 dbus-glib" -INC_PR = "r6" +INC_PR = "r7" # temporary solution until bug 5176 is properly fixed PROVIDES += "bluez-utils bluez-libs bluez-utils-dbus" @@ -15,6 +15,8 @@ SRC_URI = "\ http://www.kernel.org/pub/linux/bluetooth/bluez-${PV}.tar.gz;name=bluez-${PV} \ file://fix-dfutool-usb-declaration-mismatch.patch;patch=1 \ file://sbc-thumb.patch;patch=1 \ + file://0001-hciattach_tialt-Implement-texas_change_speed-functio.patch;patch=1 \ + file://firmware_path.patch;patch=1 \ file://bluetooth.conf \ " S = "${WORKDIR}/bluez-${PV}" diff --git a/recipes/bluez/bluez4/0001-hciattach_tialt-Implement-texas_change_speed-functio.patch b/recipes/bluez/bluez4/0001-hciattach_tialt-Implement-texas_change_speed-functio.patch new file mode 100644 index 0000000000..0d85ee552c --- /dev/null +++ b/recipes/bluez/bluez4/0001-hciattach_tialt-Implement-texas_change_speed-functio.patch @@ -0,0 +1,74 @@ +From 8d5a91d5e07bf16ce5639127d17c21de94ffdb00 Mon Sep 17 00:00:00 2001 +From: Urja Rannikko +Date: Thu, 29 Mar 2012 19:23:59 +0300 +Subject: [PATCH 1/2] hciattach_tialt: Implement texas_change_speed function. + +--- + tools/hciattach_tialt.c | 38 ++++++++++++++++++++++++++++++++++---- + 1 files changed, 34 insertions(+), 4 deletions(-) + +diff --git a/tools/hciattach_tialt.c b/tools/hciattach_tialt.c +index c3caa49..9b876e4 100644 +--- a/tools/hciattach_tialt.c ++++ b/tools/hciattach_tialt.c +@@ -88,15 +88,45 @@ static int read_command_complete(int fd, unsigned short opcode, unsigned char le + return resp.status == 0 ? 0 : -1; + } + ++static int poll_wait_reply(int fd, int ms) { ++ struct pollfd pfd; ++ pfd.fd = fd; ++ pfd.events = POLLIN; ++ pfd.revents = 0; ++ return poll(&pfd, 1, ms); ++} ++ + typedef struct { + uint8_t uart_prefix; + hci_command_hdr hci_hdr; + uint32_t speed; + } __attribute__((packed)) texas_speed_change_cmd_t; + +-static int texas_change_speed(int fd, uint32_t speed) +-{ +- return 0; ++static int texas_change_speed(int fd, uint32_t speed) { ++ int i; ++ texas_speed_change_cmd_t cmd; ++ fprintf(stdout,"Sending speed change command..\n"); ++ ++ cmd.uart_prefix = HCI_COMMAND_PKT; ++ cmd.hci_hdr.opcode = 0xff36; ++ cmd.hci_hdr.plen = sizeof(cmd.speed); ++ cmd.speed = speed; ++ ++ for (i=0;i<3;i++) { ++ int n = write(fd,&cmd,sizeof(cmd)); ++ if (n < 0) { ++ perror("Failed to write speed change command"); ++ return -1; ++ } ++ if (n < sizeof(cmd)) { ++ fprintf(stderr, "Wanted to write %lu bytes, could only write %d. Stop\n", sizeof(cmd), n); ++ return -1; ++ } ++ if (poll_wait_reply(fd,100)!=1) continue; ++ return read_command_complete(fd,cmd.hci_hdr.opcode,cmd.hci_hdr.plen); ++ } ++ fprintf(stderr,"Speed change command timeout.\n"); ++ return -1; + } + + static int texas_load_firmware(int fd, const char *firmware) { +@@ -235,7 +265,7 @@ int texasalt_init(int fd, int speed, struct termios *ti) + sprintf(fw, "/etc/firmware/%s.bin", c_brf_chip[brf_chip]); + texas_load_firmware(fd, fw); + +- texas_change_speed(fd, speed); ++ if (texas_change_speed(fd, speed)) return -1; + } + nanosleep(&tm, NULL); + return 0; +-- +1.7.8.1 + diff --git a/recipes/bluez/bluez4/firmware_path.patch b/recipes/bluez/bluez4/firmware_path.patch new file mode 100644 index 0000000000..b1cb327dbb --- /dev/null +++ b/recipes/bluez/bluez4/firmware_path.patch @@ -0,0 +1,12 @@ +diff -ur bluez-4.62_/tools/hciattach_tialt.c bluez-4.62/tools/hciattach_tialt.c +--- bluez-4.62_/tools/hciattach_tialt.c 2012-04-04 01:53:50.532804002 +0300 ++++ bluez-4.62/tools/hciattach_tialt.c 2012-04-04 01:56:51.012804001 +0300 +@@ -234,7 +234,7 @@ + ((brf_chip > 7) ? "unknown" : c_brf_chip[brf_chip]), + brf_chip); + +- sprintf(fw, "/etc/firmware/%s.bin", c_brf_chip[brf_chip]); ++ sprintf(fw, "/lib/firmware/%s.bin", c_brf_chip[brf_chip]); + texas_load_firmware(fd, fw); + + texas_change_speed(fd, speed); -- 2.39.2