yashsingh1/xdaforums huggingface dataset:
[Windows Mobile Software Development] leaskovski:
I would have to say that is a good idea. Maybe get a lock on this thread and have two new ones started....

GFMAPI

and a

Generic TMC Driver (using GFMAPI)
[Windows Mobile Software Development] L_o_k_i:
@flohtc

Hi,

No I don't have to leave HGPSClient running in the background to get TMC in iGO.

I don't know if the new stock rom make any difference for TMC because I didn't test HGPSClient on the previous rom. I know for sure that it makes the difference for the GPS signal (GSM too). I have the feeling the HD is running better also.
[Windows Mobile Software Development] pelroig:
@flywhc, on Sony X1 FMClose does not take 1 minute. Maximum of 20 secs.

Do not have HTC Volume control as you know.
[Windows Mobile Software Development] beemerTPPC:
TMC driver section of the project creates a new thread

In order to maintain things ordered, I've created another thread with the permission of flywhc: http://xdaforums.com/showthread.php?p=3741838#post3741838

Please STOP POSTING ISSUES RELATED TO HyperGPS TMC driver here and do in the new thread.

This one will be only for further development on the FM API and its related applications and versions. The new thread will concentrate on the TMC virtual COM driver.

Of course we will maintain both developments syncronized, but you won't have to download anything from this thread if you only want to use TMC, or anything from the other thread if you only want FM API and radio programs.

In the new thread you will find the second version of the driver.
[Windows Mobile Software Development] flywhc:
HTC volume control is evil, source of all problems. :)

FMRadio must do something special to stop HTC volume control but I don't know.

mhemart, thanks I will have a look to see if reverse engineering is feasible.
[Windows Mobile Software Development] johnpatcher:
I don't think so. My ROM doesn't include HTC Volume Control neither, but closing the application (with a headset plugged in) is a never-ending-story sometimes.
[Windows Mobile Software Development] flywhc:
This version of FMRadio.EXE uses DeviceIOControl directly communicating with the device driver. I can see it supports following functions:

* ChannelSpacing

* Threshold

* Channel

* Volume

* AGC

* Mute

* Stereo

* AudioPath

* FMRadioFirst

In the resource and function import table I cannot find anything related to RDS.

Most DeviceIOControl function calls do not have any "comments" so I can't guess what purpose of them.

Did you find fmradio.dll in the ROM or just typo?

FM radio is not provided by bluetooth chipset because Artemis uses BRF6150.

I don't know what chip it uses for FM radio.

If we know the chip, we can know if that chipset supports RDS and may find programming sheet then we can write a driver for it.

=======================

About FMClose issue, I tried almost all possible ways:

FMS_API.dll uses SetKMode and SharedVirtualAllocCopy for that memory block and doesn't use file mapping. my program doesn't have access to that memory.

FMRadio.exe doesn't use FindWindow or DeviceIOControl do anything special.

I almost disassembled 80% non-UI code of fmradio.exe still cannot find what's wrong in my program, except some registry operations related to power state and phone state.

I am really fed up with this issue. maybe we have to stay with that 60 seconds delay...

Well, I have a very hacking solution here:

search 3C 00 54 E3 08 00 00 8A in fms_api.dll, replace 3C with 0A to make it only waiting 10 seconds (3C = 60 seconds). Then sign the file and copy it back.
[Windows Mobile Software Development] jackleung:
Hi Flywhy, I can't find above value on my X1's FM driver, maybe they are using different timeout value?
[Windows Mobile Software Development] on4cet:
Hi Flywhc,

Some notes on xFm since using it a few days ... :

For some reason after using my TouchHD for a while, there's no RDS information anymore ... When I do a softreset, everything works again, and TMC info is displayed too ...

When I try to save the log file, it gives 'cannot create the file'. I tried on main memory as well as on storage card, tried different directories, to no avail ...

When signal quality is under 20 (approx.), the AF jump statements come in, and the sound begin to stutter ... Is there a solution ? I guess it's because of the af jump (the radio tries different frequencies very quickly, resulting in stutter on the main frequency ... ?)

However, nice to see all that information pop-up on my htc ... I guess that's why htc sells so good, it's because of all the developers working on them ...

Bart
[Windows Mobile Software Development] mhemart:
Artemis Radio Chip

The chip used for Artemis is the Si4701 made by Silicon Lab. I had some more specific informations here : https://www.silabs.com/products/audiovideo/fmreceivers/Pages/default.aspx. RDS is functional because FMRadio gives me the name of the radio.

After searching on XDA website, my impression is that there is no dll used for the FMRadio.exe and everything is coded in the .exe. I tried to play a little bit with IDA to see something but I know nothing about coding and disassembling.

If I find more information, I'll tell you.
[Windows Mobile Software Development] mhemart:
Si4701 for Artemis

I found this document that may help for "playing" with the code for radio chip : http://delanet.ru/images/stories/datasheet/AN230Rev0_3.pdf. I wanted to upload it but it's too large.
[Windows Mobile Software Development] on4cet:
Just tested the HyperGPS solution, same problem here, after using it, the second time, it doesn't get any rds information anymore, and so no tmc ...

Is anyone else experiencing the same ? And possible solution ??

bart
[Windows Mobile Software Development] on4cet:
Sorry guys, found out in the HyperGPS thread that others have the same issue ... Posted the problem here, since the same happens to xFM ...
[Windows Mobile Software Development] flywhc:
It is not recommended to do that anyway.

I just found another workaround: while waiting it exit, change volume on your device will speed up the delay.

Whoever experiencing 1 minute delay can you test on your device please?

If it works, I may have a solution.

Plesae try OmniaTMC from here.

DeamRider told me that Samsung Omnia uses SI4703, which should be very similar to si4701. (and he actually uses si4702 programming interface)

And OmniaTMC does use DeviceIOControl to implement FM radio functions.

I bet OmniaTMC highly likely works on your Artemis.

If it is working, BeamRider is making a GFMAPI for omnia so that xFMRadio will work on your device too.

If it is not working, I am sure BeamRider can make it works since you found programming sheet.

That xFMRadio is buggy and I haven't got time to improve it.

I saw no RDS only once on my phone and I had to soft reset to solve the issue. I guess this may related to FMClose issue that abnormally shutdown FM Radio.

It is very interesting to hear that AF Jump working on your device -- I haven't seen AF Jump happens on my device before.

I should try TouchHD driver. I believe AF Jump is controlled by RSSI search level - can you try enter a number such as 10 in the input box, and click on Menu->Set Search RSSI ?

That means AF Jump will be invoked only if RSSI is below 10.

I guess that so many hacking development was unexpected by HTC and Microsoft because windows mobile wasn't designed for open development.

Just HTC focus on hardware and not waste energy on security stuff like nokia and SE.

Google Android was designed for open development but it uses java... and google refused my job application after a few rounds successful interview due to job cut down... :P
[Windows Mobile Software Development] Dtrieb:
Would it be work under a Samsung I900 Omnia?
[Windows Mobile Software Development] mhemart:
Thanks,

I tried the BeamRider driver but it doesn't work. I think some adjustments are needed. I'm just waiting for his answer.

@Dtrieb : try the OmniaTMC from here
[Windows Mobile Software Development] beemerTPPC:
I've found that even using the API to reroute the audio to the speaker, it will go back to the headset depending on the program launched, for example with iGO navigator.

This is not a great problem when we are developing a FM receiver app, but it is when we are developeing a TMC receiver.

The solution I've found maybe useful for other developers... Simply redirect the audio to another audio device, the ID1.

#define DRVM_MAPPER 0x2000
#define DRVM_MAPPER_PREFERRED_SET (DRVM_MAPPER+22)
HWAVEOUT hDi;
uint j=waveOutGetNumDevs();
for (uint i=0; i < j; i++)
{
hDi=(HWAVEOUT)i;
waveOutMessage(hDi,DRVM_MAPPER_PREFERRED_SET,i,1);
}
[Windows Mobile Software Development] pelroig:
@flywhc, google made a huge mistake :D
[Windows Mobile Software Development] camro:
great idea - will see if it's working on next version :)

because i'm searching the last hour to find a audio toogle programm for HTC HD , so that not always iGO switch between headsetspeaker and internal spaker - then it could be that this is not necc anymore :)

great job :)

cu camel
[Windows Mobile Software Development] on4cet:
Maybe I didn't explain it well enough ... The application dumps some AF Jump information, but the actual frequency stays the same, but I guess it is by (trying) looking on the other frequencies that it stutters ...

I guess it's not the xFMradio's fault that the rds info is not shown anymore, I think it's the GFMapi.dll, because if you copy this file to \windows directory, it works again ...

anyway, I managed to get tmc info on my igo too ... In belgium there are several frequencies, I set it to 93.5 (joe fm), because it has a quite strong signal ...

This project has some nice potential, all we have to do is wait and encourage the developers ...

Bart
[Windows Mobile Software Development] flywhc:
sorry I still cannot make it faster.

If use xFMRadio v0.4B, tap Exit menu and then press volume up/down key, after a few seconds xFMRadio exit.

I thought I could change volume when calling FMClose to make it quite faster

but... doesn't work even APITest doesn't work with this way at all.

xFMRadio still wait 60 seconds when using debugger.

And it is not stable - sometimes still wait for 60 seconds.

HTC FMRadio has some operations I didn't do:

System\State\Hardware\Headset

System\State\Phone\VTCall

register notifications:

\\.\Notifications\NamedEvents\FMRadioSleepModeTimeUp

\\.\Notifications\NamedEvents\FMRadioSleepModeTimeChanged

\\.\Notifications\NamedEvents\FMRadioSleepModeWakeUp

RequestPowerNotifications

RegisterWindowMessage for "Vol Up" "Vol Down" "PlayPause" etc

Checks:

Software\Drivers\FMS\PowerOnFinish

Software\Drivers\FMS\PowerOffFinish

In FMS.dll it monitors ControlPanel\Volume

I tried modifying those registry but still no improvements.
[Windows Mobile Software Development] camro:
hmm - damned :(

i will try to get the real sources of fmapi ....

EDIT:

some interest things ...maybe these can help or work together ... ? http://eten-users.eu/index.php?showtopic=7229&st=60
[Windows Mobile Software Development] flywhc:
I've provided source code of the API on the first post. you can easily write your test program.

I also disassembled fmradio.exe, FMS_API.dll and FMS.DLL.

If you could get source code from HTC that will be the best. :)

I still believe it related to volume control.

I wonder if we can disable FM radio hardware or headset hardware.

I am not familiar with WAV1, mixer or wave functions.
[Windows Mobile Software Development] camro:
hmm - serious - the HTC HD fmradio is differnet or i'm blind ...

here attached the fmradio from HTC HD rom. (exe+dll)

but i only checked it with PE Explorer.

have to install on my notebook the IDA.

let you know soon more details ...

gn8 camel
[Windows Mobile Software Development] kolomparrudi:
flywhc:

I made my test FM application based on your first FM API and the FM close is very fast (1-2 sec) on this app. You can try it, maybe it helps finding the problem.
[Windows Mobile Software Development] 4irm:
switch to speakerphone

...see attachment, that's what I have been using, especially for VOIP.

regards

irm
[Windows Mobile Software Development] beemerTPPC:
System\State\Hardware\Headset

System\State\Phone\VTCall

Those two are for the State and Notifications Broker API and are probably used by HTC to get notified when the headset is konnected/disconnected or a call is in progress for muting the radi. I don't think they could be related to the close issue.
[Windows Mobile Software Development] camro:
thanks for this tool.

i tried it, but also doesn't work on HTC HD.

Espec. no switching is working there.

to headset and to speaker doesn't work.

cu camel
[Windows Mobile Software Development] 4irm:
that's pretty strange - for me it does. It can't be a proper solution anyway!
[Windows Mobile Software Development] flywhc:
kolomparrudi, it is very impressive -- faster than HTC FM Radio!

You will save my life again. :)

How did you do that?

It doesn't show any events such as RDS, tune etc. didn't you implement events?

camro, I am using energyROM 2.0 that has ported 1.7x fm radio. should be same version as yours
[Windows Mobile Software Development] kolomparrudi:
re:

Nothing special, just followed your instructions.

Here is the compete source, you can take a look:

http://madar.cjb.hu/fm_src.zip

Hope it helps!
[Windows Mobile Software Development] flywhc:
Thanks. It uses API v1.0. sounds like a bug somewhere in the newer version of the API or APITest... incredible.

I will have a look.

FM_Destroy etc should be OnOK instead of OnDestroy otherwise dialog is disappear but may still run in the background.
[Windows Mobile Software Development] camro:
can you post your SOURCE ?

thanks - then it's easier to see the diff.

cu camel

EDIT:

forget post ... source was provided :)

thanks cu camel
[Windows Mobile Software Development] camro:
i've tested FM.exe

but - also if a close it and try to start it again - it is not possible.

so the fmclose is also not faster.

before i can start it again - it waits also til the AI is ready.

(if i plugged out the cable from headset then it starts faster.

otherwise there is the same problem with timeout 7sec without headset 7+60 sec with headset and ~ 5% are 7+60+60 for new start.

cu camel
[Windows Mobile Software Development] flywhc:
When I tested it on my raphael, it can be closed and restarted after about 5 seconds, with headset.

I tried a few times it was always working.
[Windows Mobile Software Development] camro:
well - as i told you ...

the HTC HD 3,5 cinch seems to be differnent from other "normal" devices whic have the orig mini-usb headset.

but anyway ... this is now not so important...

i can send here a gallery of tools which should can change the audio settings.

-) HeadsetSwitcher.ARM

-) PPC-AudioSwitch

-) switch Speaker

-) audioroute_1.2.020

-) Glofiish_Headset-Speaker_Selector

-) a2dptoggle_1.1_10

nothing is working on HTC HD.

... anyhow ... for now it is not so important.

cu camel

PLS: if somebody have a HTC HD - maybe some other guy can also test if one of them are working on HTC HD (maybe my ROM is diff...)

EDIT: maybe we must be careful if users with HTC HD reporting bugs which are only on HTC HD !
[Windows Mobile Software Development] flywhc:
kolomparrudi's program takes 60 sec to exit in debugger

but only takes a few seconds to exit if run without debugger.

I always use debug build in these tests.

And in bigger program such as xFMRadio takes 60 sec even without debugger, but can quite faster if change volume by using volume key. again, doesn't work with debugger.

in complicated program such as APITest with GFMAPI it always takes 60 seconds unless unplug headset.

I don't understand this puzzle...
[Windows Mobile Software Development] beemerTPPC:
Remember to have active Error reporting in the device.

kolomparrudi's program have given me several unhandled exceptions when exiting. MAybe you havent the error reporting active and when the program is exiting fast, the real thing is that it is failing in the background.
[Windows Mobile Software Development] flywhc:
I am also thinking of that - it was closed too fast - shorter than 7 seconds.

I saw MFC assert errors a few times but it didn't show error message box when exiting fast. Indeed I haven't got error report in my customized rom. It does explain if it throw unhandled exceptions.

if this is the case, a workaround is call FMClose in a thread, and kill that thread after a short time.

These is a way to verify: registry value HKLM\software\drivers\fms, AbnormalClose tells if there was a 60 seconds timeout. must delete this value before testing.

Unplugging headset will speed up exiting but it still causes AbnormalClose appearing.

I burnt a new 6.5 rom but disappointed and reverse back to a 6.1 ROM and fully charged yesterday.

Then I tried htc debug tool FMSApp.exe and xFMRadio 0.4. surprisingly they took less than 10 seconds to quite! and AbnormalClose didn't appear!

Then I tried ApiTest, it failed again with AbnormalClose

Could you tell me if xFMradio 0.4 also working on your device?if not working, test after hardreset if you could. thx
[Windows Mobile Software Development] pelroig:
do not want to spoil you debug fun and FMClose issue, but on Sony X1 the closure is within 8 secs. Running generic rom R2A.
[Windows Mobile Software Development] flywhc:
Did you mean Beemer's TMC driver also only take 8 seconds to close on your X1?

then it might relate to FM driver...

not only for "fun" but also I should solve FMClose issue for other devices that has long delay.

however, as I said I am really fed up with this issue. I am writting xFMRadio 0.5 that using new API.
[Windows Mobile Software Development] pelroig:
affirmative. Beemer TMC driver also takes arround 8 secs to close on my X1.

Understand that this issue is pretty annoying :mad:

What about this audio initialization? Does xFMRadio 4B uses parts of the new API?
[Windows Mobile Software Development] ggrew:
I can affirm this. 8 -10 seconds and Beemers driver is turned off on my Polaris, your xFMradio closes as fast too.

:)
[Windows Mobile Software Development] :
On HD takes 60+ secs to close (stock ROM). Also the mute and speaker button bugs i mentioned earlier. If this app is not supposed to be for HD then sorry for bothering U :)
[Windows Mobile Software Development] flywhc:
Thanks for testing. It should be supported.

Touch HD must have something different.

One of solution i am thinking is installing X1 FMS driver.

Anybody could upload a Sony X1 driver please?
[Windows Mobile Software Development] pelroig:
is this the correct one?
[Windows Mobile Software Development] jackleung:
I posted one before as in previous post: http://xdaforums.com/showpost.php?p=3745168&postcount=475
[Windows Mobile Software Development] flywhc:
Thanks but pelroig said X1 doesn't have timeout issue at all. Why did you want to modify the driver?

have anyone tested pelroig's driver with beemer's HyperGPS?

If test failed you can rename driver files and soft reset.

I have to test after working hours.
[Windows Mobile Software Development] beemerTPPC:
In the driver thread, some people are having problems with corrupted GFMAPI.DLL after only one use. It changes the name to GFMAPI.DL-, changes its size to 256 bytes, etc.

Some of them have solved the issue changing the name to lowercase gfmapi.dll

Does someone have an idea of what could be the reason for this?
[Windows Mobile Software Development] flywhc:
Shouldn't related to GFMAPI.dll itself -- a dll cannot change the name of itself.

I am thinking that use posting notification messages instead of callback functions to avoid thread deadlock. something like EDB notification. Windows API rarely uses callback because it has synchronous issue.
[Windows Mobile Software Development] JassyNL:
WOW this is a great tool! Thanks Flywhc!!

I'd like to make a 'bug' report, and I'd like to make two Feature requests.

The 'bug':

On my X1, I'm unable to select a verbose level, when I select the menu option and then Verbose, nothing does happen.

Featurerequests:

- Show the RDS-PI on the screen, which is very usefull by weak signals. It's a unique Code (Which is be used by RDS-AF) and it's the first thing which will be showed when RDS is received.

- A Log system to log the RDS-PS and RDS-RT data to a txt file, very usefull to see the PS and RT changes.

Thanks alot!
[Windows Mobile Software Development] seelion:
i cant input a frequence like 87.135mhz

only 87100 or 87200 works ;(

bug or feature ;)
[Windows Mobile Software Development] TheNicoT:
I'm not sble to recieve any TMC Message. In the testwindow is always the same:

Send

$PSRF123,1,1*27

Recieve

$PSRFTXT,Ack Input123*6C

what am i doing wrong?

Using Xperia X1 in germany.
[Windows Mobile Software Development] flywhc:
JassyNL, you have to enter verbose level in the edit box on top left of screen and then click that menu

seelion, that is hardware restriction. And it is reasonable - channels in FM CCIR bandplan has 100KHz bandwidth.

TheNicoT I guess you posted in wrong place.

you can try:

soft reset;

stay in a opened area with strong FM signal;

make sure tune to a channel that supports TMC.
[Windows Mobile Software Development] seelion:
thx for info ;)

sad bad ok
[Windows Mobile Software Development] gordonnorth:
In order to automate some of the points, would it be possible to write some sort of Mort script, that first starts the driver, then (if needed) changes some parameters in the system.ini file, and then starts up Igo?

I have no idea if this is possible, but it would be a nice shortcut to have in the start programs directory :))
[Windows Mobile Software Development] mhemart:
Artemis driver

Hello everybody,

I've been trying to find the physical address of the Si4701 chip for several days but dissassembling is definitely not an easy task. Here you'll find one part of what I found that can be interesting but I don't know what to find (for instance, the physical address).

I spent time looking at AdvFMRadio.dll from Beamrider and I think that the problem is not the used address that may be different between Omnia and Artemis but more a question of variation of programming the driver : for instance, Samsung looks for System\State\Samsung\FMRadio in the registry that doesn't exist for HTC (I don't know why !!:D).

If you have some ideas Flywhc... I continue !
[Windows Mobile Software Development] flywhc:
mhemart, the driver directly talk to chipset via physical address so registry is not used.

Samsung uses that maybe for state such as the driver is started, radio is powered on etc.

after mapping physical address to virtual address, the program just read or write to that device by using MOV. just like a block of memory.

I am trying to make new version of API, which is notification based, single thread API.

It will support multiples devices with a helper class. because I realized that it is not easy to handle notification based events and multiple devices with pure C interface.

After comparing with Symbian OS API, I understand the API should be called Tuner API not FMAPI because it may support AM, DAB etc in the future.

I will have two weeks vacation from next Monday.

I may or may not have access to computer and unlikely can do development.

Thanks for all donators and supporters. I will do as much as I can to improve FM API and applications

Update: GFMAPI 1.2

* Using notificaitons instead of callback functions

* Add FMPROP_POWER (read only)

* Fix FMClose timeout issue.

It only takes a few seconds to close now.

I tried open/close a many time for testing closing speed in two days. saw once fms driver in abnormal state and have to reboot to tune any channel. I tried modifying code I believe it has been fixed.

It still takes long time to close in debugger but it if fast if run it from device.

I don't have time to write more instructions to explain how to use this new API. You can read APITest source code to see how it works.