[PATCH] H22xx bluetooth support for Zeevo and CSR

Slavek Banko <[email protected]>
Newsgroups gmane.comp.handhelds.opie.devel
Organization axis, spol. s r. o.
Message-ID <[email protected]>
Hi.

Here is seccond patch to add detection of radio chip used in H22xx. Code 
is based on informations that I learn from blueprobe script and is not 
"pretty".

Why applet not try to use informations from /etc/sysconfig/bluetooth?

Slavek

_______________________________________________

http://opie.handhelds.org/cgi-bin/moin.cgi/DeveloperWikiIndex

Opie-devel mailing list
[email protected]
https://handhelds.org/mailman/listinfo/opie-devel
h22xx-bluetooth.patch (text/x-diff, 1.5 KB)
diff -aruN opie-bluetoothapplet.orig/opie/noncore/net/opietooth/applet/bluezapplet.cpp opie-bluetoothapplet/opie/noncore/net/opietooth/applet/bluezapplet.cpp
--- opie-bluetoothapplet.orig/opie/noncore/net/opietooth/applet/bluezapplet.cpp	2006-05-30 17:08:53.000000000 +0200
+++ opie-bluetoothapplet/opie/noncore/net/opietooth/applet/bluezapplet.cpp	2006-06-01 19:11:03.000000000 +0200
@@ -52,6 +52,8 @@
 
 /* STD */
 #include <device.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 namespace OpieTooth {
 
@@ -113,7 +115,29 @@
 		break;
 
 	    case Model_iPAQ_H22xx:
-		btDevice = new Device( "/dev/tts/3", "any", "921600" );
+	        int fd = ::open( "/dev/mtdblock1", O_RDONLY|O_NONBLOCK );
+	        if ( fd >= 0 ) {
+		    int btVerIndex;
+		    char btVerRaw[5];
+		    char btVer[sizeof(btVerRaw)+1];
+		    memset(btVer, 0, sizeof(btVer));
+		    memset(btVerRaw, 0, sizeof(btVerRaw));
+
+		    // read radio version from ROM
+		    ::lseek(fd, 126968, SEEK_SET);
+		    ::read(fd, btVerRaw, sizeof(btVerRaw));
+		    ::close(fd);
+		    for(btVerIndex = 0; btVerIndex < sizeof(btVerRaw); btVerIndex++) {
+                	if(btVerRaw[btVerIndex] != '\0')
+			    strncat(btVer, &btVerRaw[btVerIndex], 1);
+		    }
+
+		    // select radio protocol by chip
+		    if(strcmp(btVer, "141") == 0)
+			btDevice = new Device( "/dev/tts/3", "any", "921600" );
+		    if(strcmp(btVer, "525") == 0)
+			btDevice = new Device( "/dev/tts/3", "bcsp", "921600" );
+		}
 		break;
 
             default:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.