- Work-around broken devices that export their names in ISO-8859-1

(#450081)
This commit is contained in:
Bastien Nocera 2009-03-05 18:53:13 +00:00
parent 9f234fe0d6
commit ebbc295ddf
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,23 @@
diff --git a/src/security.c b/src/security.c
index a61d75f..75908ba 100644
--- a/src/security.c
+++ b/src/security.c
@@ -600,8 +600,16 @@ static inline void remote_name_information(int dev, bdaddr_t *sba, void *ptr)
memcpy(name, evt->name, 248);
/* It's ok to cast end between const and non-const since
* we know it points to inside of name which is non-const */
- if (!g_utf8_validate(name, -1, (const char **) &end))
- *end = '\0';
+ if (!g_utf8_validate(name, -1, (const char **) &end)) {
+ char *utf8_name;
+
+ utf8_name = g_convert(name, -1, "UTF-8", "ISO-8859-1", NULL, NULL, NULL);
+ if (utf8_name) {
+ memcpy(name, utf8_name, 248);
+ g_free(utf8_name);
+ } else
+ *end = '\0';
+ }
write_device_name(sba, &dba, name);
}

View File

@ -1,7 +1,7 @@
Summary: Bluetooth utilities
Name: bluez
Version: 4.32
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2+
Group: Applications/System
Source: http://www.kernel.org/pub/linux/bluetooth/%{name}-%{version}.tar.gz
@ -9,6 +9,9 @@ Source1: bluetooth.init
Source2: bluetooth.conf
Source3: bluez-uinput.modules
Patch1: bluez-utils-oui-usage.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=450081
# http://thread.gmane.org/gmane.linux.bluez.kernel/1687
Patch2: bluez-try-utf8-harder.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
URL: http://www.bluez.org/
@ -95,6 +98,7 @@ use in Bluetooth applications.
%setup -q
%patch1 -p0 -b .oui
%patch2 -p1 -b .non-utf8-name
%build
%configure --enable-cups --enable-hid2hci --enable-dfutool --enable-tools --enable-bccmd --enable-gstreamer --enable-hidd --enable-pand --enable-dund
@ -187,6 +191,10 @@ fi
%{_libdir}/alsa-lib/*.so
%changelog
* Thu Mar 05 2009 - Bastien Nocera <bnocera@redhat.com> - 4.32-4
- Work-around broken devices that export their names in ISO-8859-1
(#450081)
* Thu Mar 05 2009 - Bastien Nocera <bnocera@redhat.com> - 4.32-3
- Fix permissions on the udev rules (#479348)