Return-Path: From: To: CC: , , , , Date: Wed, 6 Oct 2010 12:32:28 +0300 Subject: RE: Sim Access profile server implementation Message-ID: <99B09243E1A5DA4898CDD8B700111448097D01B814@EXMB04.eu.tieto.com> References: <1285657515.12097.7.camel@atheros013-desktop> <1286265730.17473.29.camel@aeonflux> <99B09243E1A5DA4898CDD8B700111448097D01B371@EXMB04.eu.tieto.com> <1286280767.17473.89.camel@aeonflux> <99B09243E1A5DA4898CDD8B700111448097D01B6CF@EXMB04.eu.tieto.com> In-Reply-To: <99B09243E1A5DA4898CDD8B700111448097D01B6CF@EXMB04.eu.tieto.com> Content-Type: multipart/mixed; boundary="_002_99B09243E1A5DA4898CDD8B700111448097D01B814EXMB04eutieto_" MIME-Version: 1.0 List-ID: --_002_99B09243E1A5DA4898CDD8B700111448097D01B814EXMB04eutieto_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi Marcel, >> >>Can you share that code with us. And also hardware if you. We=20 >are still=20 >>having hard time to find proper hardware to test this on. > >Will send a patch soon. I use=20 >http://www.stericsson.com/platforms/U8500.jsp hw, but need to=20 >check if I can share one with you. > Here you are the patch. Just note that it is based on an old bluez 4.4x If you consider to accept the design I will update the patch upon the lates= t release.=20 Will appreciate any comments. Thanks, /Waldek = --_002_99B09243E1A5DA4898CDD8B700111448097D01B814EXMB04eutieto_ Content-Type: application/octet-stream; name="0001-Add-Sim-Access-plugin.patch" Content-Description: 0001-Add-Sim-Access-plugin.patch Content-Disposition: attachment; filename="0001-Add-Sim-Access-plugin.patch"; size=95321; creation-date="Wed, 06 Oct 2010 11:00:03 GMT"; modification-date="Wed, 06 Oct 2010 11:00:03 GMT" Content-Transfer-Encoding: base64 RnJvbSAxMmY1NjBjMjhmZDNmZTkyNmQxMDYzOTE1NmUxMGQwODlkZDI2NTA2IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBXYWxkZW1hciBSeW1hcmtpZXdpY3ogPHdhbGRlbWFyLnJ5bWF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FRF9PTiwgICAvKiBDYXJkIGluIHJlYWRl ciBhbmQgaXMgcG93ZXJlZCBvbiAqLworCUlDQ19SRUFERVJfREVBQ1RJVkFURUQsICAgICAgIC8q IENhcmQgUmVhZGVyIGRlYWN0aXZhdGVkICovCisJSUNDX1JFQURFUl9DQVJEX1BPV0VSRURfT0ZG LCAgLyogQ2FyZCBpbiByZWFkZXIsIGJ1dCBwb3dlcmVkIG9mZiAqLworCUlDQ19SRUFERVJfTk9f Q0FSRCwgICAgICAgICAgIC8qIE5vIGNhcmQgaW4gcmVhZGVyICovCisJSUNDX1JFQURFUl9MQVNU Cit9IGljY19yZWFkZXJfc3RhdHVzX3Q7CisKKworI2RlZmluZSBTQVBfQlVGX1NJWkUJCTUxMgor CisjZGVmaW5lIFNBUF9NU0dfSEVBREVSX1NJWkUJNAorCit0eXBlZGVmIGVudW0geworCVNBUF9D T05ORUNUX1JFUSAgICAgICAgICAgICAgICAgICAgICAgID0gMHgwMCwJLyogQ2xpZW50IC0+IFNl cnZlciAqLworCVNBUF9DT05ORUNUX1JFU1AgICAgICAgICAgICAgICAgICAgICAgID0gMHgwMSwJ LyogU2VydmVyIC0+IENsaWVudCAqLworCisJU0FQX0RJU0NPTk5FQ1RfUkVRICAgICAgICAgICAg ICAgICAgICAgPSAweDAyLAkvKiBDbGllbnQgLT4gU2VydmVyICovCisJU0FQX0RJU0NPTk5FQ1Rf UkVTUCAgICAgICAgICAgICAgICAgICAgPSAweDAzLAkvKiBTZXJ2ZXIgLT4gQ2xpZW50ICovCisJ U0FQX0RJU0NPTk5FQ1RfSU5EICAgICAgICAgICAgICAgICAgICAgPSAweDA0LAkvKiBTZXJ2ZXIg LT4gQ2xpZW50ICovCisKKwlTQVBfVFJBTlNGRVJfQVBEVV9SRVEgICAgICAgICAgICAgICAgICA9 IDB4MDUsCS8qIENsaWVudCAtPiBTZXJ2ZXIgKi8KKwlTQVBfVFJBTlNGRVJfQVBEVV9SRVNQICAg ICAgICAgICAgICAgICA9IDB4MDYsCS8qIFNlcnZlciAtPiBDbGllbnQgKi8KKworCVNBUF9UUkFO U0ZFUl9BVFJfUkVRICAgICAgICAgICAgICAgICAgID0gMHgwNywJLyogQ2xpZW50IC0+IFNlcnZl ciAqLworCVNBUF9UUkFOU0ZFUl9BVFJfUkVTUCAgICAgICAgICAgICAgICAgID0gMHgwOCwJLyog U2VydmVyIC0+IENsaWVudCAqLworCisJU0FQX1BPV0VSX1NJTV9PRkZfUkVRICAgICAgICAgICAg ICAgICAgPSAweDA5LAkvKiBDbGllbnQgLT4gU2VydmVyICovCisJU0FQX1BPV0VSX1NJTV9PRkZf UkVTUCAgICAgICAgICAgICAgICAgPSAweDBBLAkvKiBTZXJ2ZXIgLT4gQ2xpZW50ICovCisKKwlT QVBfUE9XRVJfU0lNX09OX1JFUSAgICAgICAgICAgICAgICAgICA9IDB4MEIsCS8qIENsaWVudCAt PiBTZXJ2ZXIgKi8KKwlTQVBfUE9XRVJfU0lNX09OX1JFU1AgICAgICAgICAgICAgICAgICA9IDB4 MEMsCS8qIFNlcnZlciAtPiBDbGllbnQgKi8KKworCVNBUF9SRVNFVF9TSU1fUkVRICAgICAgICAg ICAgICAgICAgICAgID0gMHgwRCwJLyogQ2xpZW50IC0+IFNlcnZlciAqLworCVNBUF9SRVNFVF9T SU1fUkVTUCAgICAgICAgICAgICAgICAgICAgID0gMHgwRSwJLyogU2VydmVyIC0+IENsaWVudCAq LworCisJU0FQX1RSQU5TRkVSX0NBUkRfUkVBREVSX1NUQVRVU19SRVEgICAgPSAweDBGLAkvKiBD bGllbnQgLT4gU2VydmVyICovCisJU0FQX1RSQU5TRkVSX0NBUkRfUkVBREVSX1NUQVRVU19SRVNQ ICAgPSAweDEwLAkvKiBTZXJ2ZXIgLT4gQ2xpZW50ICovCisKKwlTQVBfU1RBVFVTX0lORCAgICAg ICAgICAgICAgICAgICAgICAgICA9IDB4MTEsCS8qIFNlcnZlciAtPiBDbGllbnQgKi8KKwlTQVBf RVJST1JfUkVTUCAgICAgICAgICAgICAgICAgICAgICAgICA9IDB4MTIsCS8qIFNlcnZlciAtPiBD bGllbnQgKi8KKworCVNBUF9TRVRfVFJBTlNQT1JUX1BST1RPQ09MX1JFUSAgICAgICAgID0gMHgx MywJLyogQ2xpZW50IC0+IFNlcnZlciAqLworCVNBUF9TRVRfVFJBTlNQT1JUX1BST1RPQ09MX1JF U1AgICAgICAgID0gMHgxNCwJLyogU2VydmVyIC0+IENsaWVudCAqLworfSBzYXBfcHJvdG9jb2w7 CisKKy8qIFNBUCAxLjEgc2VjdGlvbiA1LjIgUGFyYW1ldGVycyBJRHMgYW5kIENvZGluZyAqLwor I2RlZmluZSBTQVBfUEFSQU1fSURfTUFYTVNHU0laRSAgICAgICAgICAgICAweDAwCisjZGVmaW5l IFNBUF9QQVJBTV9JRF9NQVhNU0dTSVpFX0xFTiAgICAgICAgIDB4MDIKKworI2RlZmluZSBTQVBf UEFSQU1fSURfQ09OTl9TVEFUVVMgICAgICAgICAgICAweDAxCisjZGVmaW5lIFNBUF9QQVJBTV9J RF9DT05OX1NUQVRVU19MRU4gICAgICAgIDB4MDEKKworI2RlZmluZSBTQVBfUEFSQU1fSURfUkVT VUxUX0NPREUgICAgICAgICAgICAweDAyCisjZGVmaW5lIFNBUF9QQVJBTV9JRF9SRVNVTFRfQ09E RV9MRU4gICAgICAgIDB4MDEKKworI2RlZmluZSBTQVBfUEFSQU1fSURfRElTQ09OTkVDVF9JTkQg ICAgICAgICAweDAzCisjZGVmaW5lIFNBUF9QQVJBTV9JRF9ESVNDT05ORUNUX0lORF9MRU4gICAg IDB4MDEKKworI2RlZmluZSBTQVBfUEFSQU1fSURfQ09NTUFORF9BUERVICAgICAgICAgICAweDA0 CisKKyNkZWZpbmUgU0FQX1BBUkFNX0lEX1JFU1BPTlNFX0FQRFUgICAgICAgICAgMHgwNQorCisj ZGVmaW5lIFNBUF9QQVJBTV9JRF9BVFIgICAgICAgICAgICAgICAgICAgIDB4MDYKKworI2RlZmlu ZSBTQ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