Bluetooth states - Windows Mobile Development and Hacking General

I've been doing some research on the states bluetooth can have on windows mobile 6.1, i have got them from this registry value:
HKLM\System\State\Hardware\Bluetooth
I have found the following states:
Code:
8 = "OFF/NoBrdcst"
9 = "ON/NoBrdcst"
11 = "ON/Brdcst"
13 = "A2DP/NoBrdcst" //bluetooth on before headset
15 = "A2DP/Brdcst" //bluetooth on before headset
25 = "Headset/NoBrdcst" //headset on before bluetooth
27 = "Headset/Brdcst" //headset on before bluetooth
29 = "A2DP/NoBrdcst" //headset on before bluetooth, if a call comes true and the state was 13, the state switches to this state after and just before the call
31 = "A2DP/NoBrdcst" //headset on before bluetooth, if a call comes true and the state was 15, the state switches to this state after and just before the call
57 = "callPrevStateHeadset/NoBrdcst"
59= "callPrevStateHeadset/NoBrdcst"
61= "callPrevStateA2DP/NoBrdcst"
63 = "callPrevStateA2DP/Brdcst"
It would be nice if this list could be extended. If you know a state not mentioned above, please post!

*Kick
It would be nice if more states are known

Related

auto bluetooth on when call incoming

Hi,
I've just acquir a stereo bluetooth headset "voyager 855" (I think the best one...), I've paring it to my kaiser, switch on the bluetooth ... and i've seen that my htc's power drown so fast ! less than a day to go to 0% !
I think it's 'cause that my bluetooth being always turn "on" !!!?!
So i'm looking for a software that turn "on" my bluetooth connection before "off" when a call incoming and shut it "off" when I stop to convers.
Is this soft exist or is someone be interested to developpe it ?
Thank for your answer
this would be great, if we could reduce the pair-up time of the bluetooth devices and then get the phone to re-route the audio
or if this isn't possible, what about auto-adjusting the transmit power of the bluetooth radio on the phone so that when the phone isn't in a call, or some other use of the bt-audio that the transmitter run just strong enough to maintain the pairing, and when a call comes in, it jacks the power up to an acceptable level ( user configurable of course) to enable a call
ozbt
Google for ozbt. This app switches BT on every time the phone app is active. To have BT switched off after a call, I used AE Button plus to assign a Mortscript to the RED hard key. This script checks if the active app is "Phone" and, if it is, switches BT off (using BTtoggle.exe) and sends the RED key to the "Phone" App to terminate the call. It's not perfect, it takes about one second to terminate a call in my kaiser and I have to select headsets in the begining of some calls.
mortscript:
Run("/Program Files/AEBPlus/aebplus Emulate Red Button.lnk")
PhoneActive = WndActive ("Phone")
if (PhoneActive = TRUE)
#Sleep( 10000 )
PhoneActive = TRUE
while(PhoneActive = TRUE)
PhoneActive = WndActive ("Phone")
endwhile
B = RegRead ("HKLM", "System\State\Hardware\" , "Bluetooth" )
If ( B >8 )
Run( "\Program Files\BTToggle.exe" )
endif
endif
Hi mmoiron,
Could you share your ozbt version ? the Oleg Zakharov site is down and all web site that I visit link on it...
- PhoneAlarm
- Csdevctrl - lock/unlock app with multiple features and you can use the bluetooth option only
I was trying to upload it to rapidshare using my kaiser but I couldn't. I'll upload it in a couple of days.
cumprimentos
thank for your passed time mmoiron
ozbt
here it is.
http://rapidshare.com/files/238730777/Oleg_Zaharov_ozBTWF_0.76.cab.html

Audio capture problem

Hi
We are developing a push-to-talk app -- Loudtalks. The free version is quite popular and many people on this forum use it.
We spent the last two days trying to fix or isolate a problem reported by a user with Hermes 200 -- all outgoing messages come silent and show up with 0:00 duration in History, even though the connection is good and everything else (including incoming messages work perfectly).
Still no luck. The last thing we found is that our code receives just 2 audio buffers from the sound card in 3 seconds, while normally that should be more like 30...
The same code (standard wave api stuff) works fine on many other devices. Is there any Hermes/HTC-specific secrets or hacks?
Or could you try it and report back if it works and which ROM/radio are you on? We don't have the device to test with so kind of walking in the dark... but very much want to have mystery fixed.
Here is today's build:
http://loudtalks.com/data/LoudtalksMobileSetup.cab
More details:
- We are using 8000 Hz, 16 bits per sample, mono sound format
- waveInStart fails returning 0x00000001 ( #define MMSYSERR_ERROR (MMSYSERR_BASE + 1) /* unspecified error */ HUH?)
Thanks!

What's a usb/H2W headset?

The CPLD info of the HTC dream shows some H2W signals listed below. But I can not understand what is it. It looks like it includes 2 kinds of the H2W devices. Could anyone please shed some light on it?
CPLD info on Dream:
2 H2W_DAT_DIR
3 H2W_CLK_DIR
4 H2W_DAT_GPO
5 H2W_CLK_GPO
6 H2W_SEL0
7 H2W_SEL1
Also some codes about the H2W on Nike phone.
i2c_register_board_info(0, htcnike_i2c_board_info,
279 280 ARRAY_SIZE(htcnike_i2c_board_info));
280 281 /* H2W pins <-> UART3, Bluetooth <-> UART1 */
281 282 /* Dumped from board-trout.c -- bluetooth 1st attempt */
282 283 gpio_set_value(HTCNIKE_GPIO_H2W_SEL0, 0);
283 284 gpio_set_value(HTCNIKE_GPIO_H2W_SEL1, 1);

[Q] the meaning of the byte array read from socket

I am trying to develop a sniffer in android using VpnService. I modified the ToyVpn example so that i am capable to read the ip packets from the ParcelFileDescriptor. For every packet I open a Socket with the dest ip and port and send the payload(whitout IP or TCP header) and read the response from the server.
I use this code:
Code:
// We keep forwarding packets till something goes wrong.
while (vpnInterface != null && vpnInterface.getFileDescriptor() != null
&& vpnInterface.getFileDescriptor().valid()) {
packet.clear();
// Read the outgoing packet from the input stream.
final byte[] data = packet.array();
int length = in.read(data);
//for geting unsigned int from byte
int[] d = new int[data.length];
if (length > 0) {
packet.limit(length);
StringBuilder sb = new StringBuilder("");
for (int i = 0; i < length; i++) {
d[i] = data[i] & 0xFF;
sb.append(Integer.toHexString(d[i])+" ");
}
Log.i("packet", sb.toString());
Socket socket = SocketChannel.open().socket();
this.protect(socket);
//connect to output ip and port
socket.connect(new InetSocketAddress(d[16] + "." + d[17] + "."
+ d[18] + "." + d[19], (d[22] * 256) + d[23]));
DataOutputStream dOut = new DataOutputStream(
socket.getOutputStream());
DataInputStream dIn = new DataInputStream(
socket.getInputStream());
dOut.write(data, 40, length - 40);
//read data from the socket
length = dIn.read(data);
if (length > 0) {
sb = new StringBuilder("");
for (int i = 0; i <length; i++) {
d[i] = data[i] & 0xFF;
sb.append(Integer.toHexString(d[i])+" ");
}
Log.w("lungime", length+"");
Log.i("response", sb.toString());
//write data to virtual interface
out.write(data, 0, length);
}
socket.close();
}
Thread.sleep(5);
}
The Log looks like this:
Code:
12-04 15:37:29.891: I/packet(7029): 45 0 0 3c a3 8b 40 0 40 6 b8 35 a 0 0 2 ad c2 27 37 88 c3 0 50 d4 8f 3b 1b 0 0 0 0 a0 2 35 20 f9 ce 0 0 2 4 5 50 4 2 8 a 2 1c 9f a0 0 0 0 0 1 3 3 6
12-04 15:37:29.986: W/lungime(7029): 1068
12-04 15:37:29.991: I/response(7029): 48 54 54 50 2f 31 2e 30 20 34 30 30 20 42 61 64 20 52 65 71 75 65 73 74 d a 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 74 65 78 74 2f 68 74 6d 6c 3b 20 63 68 61 72 73 65 74 3d 55 54 46 2d 38 d a 43 6f 6e 74 65 6e 74 2d 4c 65 6e 67 74 68 3a 20 39 32 35 d a 44 61 74 65 3a 20 57 65 64 2c 20 30 34 20 44 65 63 20 32 30 31 33 20 31 34 3a 33 36 3a 31 33 20 47 4d 54 d a 53 65 72 76 65 72 3a 20 47 46 45 2f 32 2e 30 d a d a 3c 21 44 4f 43 54 59 50 45 20 68 74 6d 6c 3e a 3c 68 74 6d 6c 20 6c 61 6e 67 3d 65 6e 3e a 20 20 3c 6d 65 74 61 20 63 68 61 72 73 65 74 3d 75 74 66 2d 38 3e a 20 20 3c 6d 65 74 61 20 6e 61 6d 65 3d 76 69 65 77 70 6f 72 74 20 63 6f 6e 74 65 6e 74 3d 22 69 6e 69 74 69 61 6c 2d 73 63 61 6c 65 3d 31 2c 20 6d 69 6e 69 6d 75 6d 2d 73 63 61 6c 65 3d 31 2c 20 77 69 64 74 68 3d 64 65 76 69 63 65 2d 77 69 64 74 68 22 3e a 20 20 3c 74 69 74 6c 65 3e 45 72 72 6f 72 20 34 30 30 20 28 42 61 64 20 52 65 71 75 65 73 74 29 21 21 31 3c 2f 74 69 74 6c 65 3e a 20 20 3c 73 74 79 6c 65 3e a 20 20 20 20 2a 7b 6d 61 72 67 69 6e 3a 30 3b 70 61 64 64 69 6e 67 3a 30 7d 68 74 6d 6c 2c 63 6f 64 65 7b 66 6f 6e 74 3a 31 35 70 78 2f 32 32 70 78 20 61 72 69 61 6c 2c 73 61 6e 73 2d 73 65 72 69 66 7d 68 74 6d 6c 7b 62 61 63 6b 67 72 6f 75 6e 64 3a 23 66 66 66 3b 63 6f 6c 6f 72 3a 23 32 32 32 3b 70 61 64 64 69 6e 67 3a 31 35 70 78 7d 62 6f 64 79 7b 6d 61 72 67 69 6e 3a 37 25 20 61 75 74 6f 20 30 3b 6d 61 78 2d 77 69 64 74 68 3a 33 39 30 70 78 3b 6d 69 6e 2d 68 65 69 67 68 74 3a 31 38 30 70 78 3b 70 61 64 64 69 6e 67 3a 33 30 70 78 20 30 20 31 35 70 78 7d 2a 20 3e 20 62 6f 64 79 7b 62 61 63 6b 67 72 6f 75 6e 64 3a 75 72 6c 28 2f 2f 77 77 77 2e 67 6f 6f 67 6c 65 2e 63 6f 6d 2f 69 6d 61 67 65 73 2f 65 72 72 6f 72 73 2f 72 6f 62 6f 74 2e 70 6e 67 29 20 31 30 30 25 20 35 70 78 20 6e 6f 2d 72 65 70 65 61 74 3b 70 61 64 64 69 6e 67 2d 72 69 67 68 74 3a 32 30 35 70 78 7d 70 7b 6d 61 72 67 69 6e 3a 31 31 70 78 20 30 20 32 32 70 78 3b 6f 76 65 72 66 6c 6f 77 3a 68 69 64 64 65 6e 7d 69 6e 73 7b 63 6f 6c 6f 72 3a 23 37 37 37 3b 74 65 78 74 2d 64 65 63 6f 72 61 74 69 6f 6e 3a 6e 6f 6e 65 7d 61 20 69 6d 67 7b 62 6f 72 64 65 72 3a 30 7d 40 6d 65 64 69 61 20 73 63 72 65 65 6e 20 61 6e 64 20 28 6d 61 78 2d 77 69 64 74 68 3a 37 37 32 70 78 29 7b 62 6f 64 79 7b 62 61 63 6b 67 72 6f 75 6e 64 3a 6e 6f 6e 65 3b 6d 61 72 67 69 6e 2d 74 6f 70 3a 30 3b 6d 61 78 2d 77 69 64 74 68 3a 6e 6f 6e 65 3b 70 61 64 64 69 6e 67 2d 72 69 67 68 74 3a 30 7d 7d a 20 20 3c 2f 73 74 79 6c 65 3e a 20 20 3c 61 20 68 72 65 66 3d 2f 2f 77 77 77 2e 67 6f 6f 67 6c 65 2e 63 6f 6d 2f 3e 3c 69 6d 67 20 73 72 63 3d 2f 2f 77 77 77 2e 67 6f 6f 67 6c 65 2e 63 6f 6d 2f 69 6d 61 67 65 73 2f 65 72 72 6f 72 73 2f 6c 6f 67 6f 5f 73 6d 2e 67 69 66 20 61 6c 74 3d 47 6f 6f 67 6c 65 3e 3c 2f 61 3e a 20 20 3c 70 3e 3c 62 3e 34 30 30 2e 3c 2f 62 3e 20 3c 69 6e 73 3e 54 68 61 74 e2 80 99 73 20 61 6e 20 65 72 72 6f 72 2e 3c 2f 69 6e 73 3e a 20 20 3c 70 3e 59 6f 75 72 20 63 6c 69 65 6e 74 20 68 61 73 20 69 73 73 75 65 64 20 61 20 6d 61 6c 66 6f 72 6d 65 64 20 6f 72 20 69 6c 6c 65 67 61 6c 20 72 65 71 75 65 73 74 2e 20 20 3c 69 6e 73 3e 54 68 61 74 e2 80 99 73 20 61 6c 6c 20 77 65 20 6b 6e 6f 77 2e 3c 2f 69 6e 73 3e a
The first is really an IP packet but the problem is that I don't know what this response means. I was expecting to receive a IP packet,too. This response that you see above, I write it to the OutputStreamReader coresponding to the virtual interface and it apears to me in the VPN Status that I received packets. All this packets are from browser trying to access the google page but that packets which I write to Virtual interface maybe are thrown because the page does not open.
In adb shell netstat I get this:
Code:
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 1 0 10.0.0.2:35011 173.194.39.55:80 SYN_SENT
tcp 1 0 10.0.0.2:35010 173.194.39.55:80 SYN_SENT
tcp6 0 1 ::ffff:172.21.201.226:39772 ::ffff:173.194.39.39:80 CLOSE_WAIT
tcp6 0 0 ::ffff:172.21.201.226:45095 ::ffff:173.194.39.55:443 ESTABLISHED
tcp6 1 0 ::ffff:10.0.0.2:38484 ::ffff:173.194.70.95:443 SYN_SENT
tcp6 0 0 ::ffff:172.21.201.226:59836 ::ffff:173.194.70.188:5228 ESTABLISHED
tcp6 1 0 ::ffff:172.21.201.226:50164 ::ffff:173.194.70.95:443 SYN_SENT
tcp6 0 0 ::ffff:172.21.201.226:55260 ::ffff:54.228.207.7:5223 ESTABLISHED
So it seems that the SYN package was send but I receive nothing. If anybody could tell me what the received bytes means and how to write them properly in the virtual interface I will be deeply grateful.

Verify whether headset supports aptX?

I purchased a headset that claims to support aptX, but I can't verify it's working. I've enabled it in OP5 settings, and also tried restarting the phone for good measure. The manual for the headset specifies that it supports aptX, and it doesn't list any special steps to enable.
Looking at logcat and btsnoop output it seems to be negotiating SBC. I've tried playing FLAC and MP3 files with VLC, and streaming over Google Play music and it does not negotiate aptX. Has anyone else been able to confirm that aptX is working on their OP5?
I followed this answer on stackexchange and got the btsnoop logs, analyzed with WireShark. This is what I came up with:
Code:
AVDTP 25 Rcvd ResponseAccept - GetCapabilities - Audio SBC (16000 32000 44100 48000 | Mono DualChannel Stereo JointStereo | block: 4 8 12 16 | subbands: 4 8 | allocation: SNR Loudness | bitpool: 2..53)
The headset is obviously responding with SBC, but does this definitively mean the headset is refusing to support aptX, or could it be an issue with the OP5?
I can post more of the btsnoop logs or logcat if necessary.
How would I confirm it? I see the "aptX HD" logo briefly flash on the screen whenever I start playing video or music after connecting to my LG HBS-730, but how would I know for sure? I mean it does sound better than the same media on my wife's Moto X Play.
Chahk said:
How would I confirm it? I see the "aptX HD" logo briefly flash on the screen whenever I start playing video or music after connecting to my LG HBS-730, but how would I know for sure? I mean it does sound better than the same media on my wife's Moto X Play.
Click to expand...
Click to collapse
If you run a logcat over adb while either connecting or playing the media (I'm not sure which) you should see some output about codec negotiation. That's probably the quickest and easiest way. The btsnoop method in the stackexchange I linked is more low level, but I was hoping to see conclusively if the device supports aptX
I've never seen an aptX logo you up on screen. Hopefully that's a reliable indicator, but I would think that would get annoying!
One more thing, my understanding is that aptX and aptX HD are two different things (someone correct me if I'm wrong), even if one is working I don't think that necessarily means the other is.
I'm probably going to return this headset if I can't prove that aptX is working for it...
Here is the screenshot.
And here's an exert from logcat while trying to play some tune via Google Play Music app:
Code:
08-17 17:39:43.734 2880 20308 D bt_btif : btif_snd_ctrl_cmd : A2DP_CTRL_CMD_START DONE
08-17 17:39:43.734 2880 2900 D bt_btif : btif_av_state_opened_handler event:BTIF_AV_START_STREAM_REQ_EVT flags 0 and index = 0
08-17 17:39:43.734 2880 2900 I bt_btif_media: btif_a2dp_encoder_init SCMS_T DISABLED
08-17 17:39:43.734 2880 2900 E bt_btif : bta_av_select_codec hdl = 65
08-17 17:39:43.734 2880 2900 I bt_btif_media: btif_a2dp_encoder_init Selected Codec aptX
08-17 17:39:43.734 2880 20306 D bt_btif : btif_media_thread_handle_cmd : 5 BTIF_MEDIA_SBC_ENC_INIT
08-17 17:39:43.734 2880 2912 D bt_btif : AV Sevent(0x41)=0x120b(AP_START) state=3(OPEN)
08-17 17:39:43.734 2880 20306 D bt_btif : btif_media_thread_handle_cmd: BTIF_MEDIA_SBC_ENC_INIT DONE
The "Selected Codec aptX" bit makes me think it's working. There are a lot of crappy knock-off headsets that boast aptX "support" that isn't working right because they omit the profiles necessary for it to actually work. I remember reading an article a while back about this very problem, but can't seem to find the link anymore.
Chahk said:
The "Selected Codec aptX" bit makes me think it's working. There are a lot of crappy knock-off headsets that boast aptX "support" that isn't working right because they omit the profiles necessary for it to actually work. I remember reading an article a while back about this very problem, but can't seem to find the link anymore.
Click to expand...
Click to collapse
Ok, that logcat looks like what I was expecting to see. I agree that yours is working. Thanks!
For the record, this one *is* some cheap Chinese one I found on Amazon. The sound quality is not awful for the price, but the false advertising is unforgivable.
I see aptX logo flashed on a screen after my Sennheiser HD1 got connected via Bluetooth. And I don't see that logo when using other BT headsets.

Categories

Resources