Skip to content

Commit be0eb79

Browse files
jefdriesenmikeller
authored andcommitted
Remove the rfcomm filter function
The rfcomm filter function is not only platform dependent (Linux only), but also difficult to use correctly. It should only be enabled for devices which support DC_TRANSPORT_SERIAL due to the serial port emulation layer of the bluetooth Serial Port Profile (SPP/rfcomm), and not for usb-serial communication. However, some dive computers models like the OSTC3 have both rfcomm and usb-serial enabled variants. Since the filter functions are shared by all models, the result isn't always reliable. Fixed by simply removing the rfcomm filter. For serial communication, every string will now be considered a match, which is the same result as with no filter function present.
1 parent 9442528 commit be0eb79

File tree

1 file changed

+0
-24
lines changed

1 file changed

+0
-24
lines changed

src/descriptor.c

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -521,15 +521,6 @@ dc_match_prefix (const void *key, const void *value)
521521
return strncasecmp (k, v, strlen (v)) == 0;
522522
}
523523

524-
static int
525-
dc_match_devname (const void *key, const void *value)
526-
{
527-
const char *k = (const char *) key;
528-
const char *v = *(const char * const *) value;
529-
530-
return strncmp (k, v, strlen (v)) == 0;
531-
}
532-
533524
static int
534525
dc_match_usb (const void *key, const void *value)
535526
{
@@ -641,13 +632,6 @@ dc_filter_internal (const void *key, const void *values, size_t count, size_t si
641632
return count == 0;
642633
}
643634

644-
static const char * const rfcomm[] = {
645-
#if defined (__linux__)
646-
"/dev/rfcomm",
647-
#endif
648-
NULL
649-
};
650-
651635
static int
652636
dc_filter_uwatec (const dc_descriptor_t *descriptor, dc_transport_t transport, const void *userdata)
653637
{
@@ -724,8 +708,6 @@ dc_filter_hw (const dc_descriptor_t *descriptor, dc_transport_t transport, const
724708

725709
if (transport == DC_TRANSPORT_BLUETOOTH || transport == DC_TRANSPORT_BLE) {
726710
return DC_FILTER_INTERNAL (userdata, bluetooth, 0, dc_match_prefix);
727-
} else if (transport == DC_TRANSPORT_SERIAL) {
728-
return DC_FILTER_INTERNAL (userdata, rfcomm, 1, dc_match_devname);
729711
}
730712

731713
return 1;
@@ -750,8 +732,6 @@ dc_filter_shearwater (const dc_descriptor_t *descriptor, dc_transport_t transpor
750732

751733
if (transport == DC_TRANSPORT_BLUETOOTH || transport == DC_TRANSPORT_BLE) {
752734
return DC_FILTER_INTERNAL (userdata, bluetooth, 0, dc_match_name);
753-
} else if (transport == DC_TRANSPORT_SERIAL) {
754-
return DC_FILTER_INTERNAL (userdata, rfcomm, 1, dc_match_devname);
755735
}
756736

757737
return 1;
@@ -766,8 +746,6 @@ dc_filter_tecdiving (const dc_descriptor_t *descriptor, dc_transport_t transport
766746

767747
if (transport == DC_TRANSPORT_BLUETOOTH) {
768748
return DC_FILTER_INTERNAL (userdata, bluetooth, 0, dc_match_name);
769-
} else if (transport == DC_TRANSPORT_SERIAL) {
770-
return DC_FILTER_INTERNAL (userdata, rfcomm, 1, dc_match_devname);
771749
}
772750

773751
return 1;
@@ -847,8 +825,6 @@ dc_filter_mclean(const dc_descriptor_t *descriptor, dc_transport_t transport, co
847825

848826
if (transport == DC_TRANSPORT_BLUETOOTH || transport == DC_TRANSPORT_BLE) {
849827
return DC_FILTER_INTERNAL (userdata, bluetooth, 0, dc_match_name);
850-
} else if (transport == DC_TRANSPORT_SERIAL) {
851-
return DC_FILTER_INTERNAL(userdata, rfcomm, 1, dc_match_devname);
852828
}
853829

854830
return 1;

0 commit comments

Comments
 (0)