Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid rig# does not create proper error #735

Closed
mdblack98 opened this issue Jul 8, 2021 · 1 comment
Closed

Invalid rig# does not create proper error #735

mdblack98 opened this issue Jul 8, 2021 · 1 comment
Labels
bug needs test Patches have been submitted but need testing to close issue

Comments

@mdblack98
Copy link
Contributor

Ok but what should I call if I need list of supported rig model numbers and names? I need it to help users choose their rig. Because of model numbers change in 4.x is important to handle unknown models properly (return NULL and keep process alive).

If I omit rig_load_all_backends, then rig_list_foreach returns only models up to 6:

C:\temp\hamlib42exit\Debug>hamlib42exit.exe
rig_check_rig_caps: p1=56492520, p2=56497AE8, rig_model=56492520, macro_name=56497AE8
dummy.c(2465):initrigs4_dummy entered
initrigs4_dummy: _init called
rig_register called
rig_register: rig_register (1)
rig_register called
rig_register: rig_register (2)
rig_register called
rig_register: rig_register (4)
rig_register called
rig_register: rig_register (5)
rig_register called
rig_register: rig_register (6)
dummy.c(2474):initrigs4_dummy return(0)
ret=00000000
unreached
C:\temp\hamlib42exit\Debug>

#include "stdafx.h"
#include "stdio.h"
#include "hamlib/rig.h"

int func(const rig_caps *caps, rig_ptr_t)
{
printf("%d %s\n", caps->rig_model, caps->model_name);
return 1;
}

int _tmain(int argc, _TCHAR* argv[])
{
//rig_load_all_backends();
rig_list_foreach(func, NULL);
RIG *tmprig = rig_init(228); // unknown model
printf("ret=%p\n", tmprig);
printf("unreached");
}

If I uncomment rig_load_all_backends, result is:

...
32001 2050
32002 950
33001 FDM-DUO
rig_check_rig_caps: p1=56492520, p2=56497AE8, rig_model=56492520, macro_name=56497AE8
dummy.c(2465):initrigs4_dummy entered
initrigs4_dummy: _init called
rig_register called
rig_register: rig_register (1)
Hash collision!!! Fatal error!!

Note "ret" and "unreached" are not printed.

All this worked in 3.3.

@mdblack98 mdblack98 added the bug label Jul 8, 2021
@mdblack98 mdblack98 added the needs test Patches have been submitted but need testing to close issue label Jul 8, 2021
@mdblack98
Copy link
Contributor Author

mdblack98 commented Jul 8, 2021

This broke the c++ make check so reverting this change

mdblack98 added a commit that referenced this issue Jul 8, 2021
Another solution to this needed
#735
@mdblack98 mdblack98 removed the needs test Patches have been submitted but need testing to close issue label Jul 15, 2021
mdblack98 added a commit that referenced this issue Aug 24, 2021
…ed hash collision error instead of unknown rig

#735
@mdblack98 mdblack98 added the needs test Patches have been submitted but need testing to close issue label Aug 24, 2021
wutje pushed a commit to wutje/Hamlib that referenced this issue Sep 4, 2021
mdblack98 added a commit that referenced this issue Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs test Patches have been submitted but need testing to close issue
Projects
None yet
Development

No branches or pull requests

1 participant