Also consider the vendor when looking for quirks
This commit is contained in:
parent
fbf66280e0
commit
3d6af30b93
@ -2130,6 +2130,8 @@ static HayesCommandStatus _on_reset_settle_callback(HayesCommand * command,
|
||||
HAYES_REQUEST_LOCAL_ECHO_DISABLE);
|
||||
_hayes_request_type(hayes, channel,
|
||||
HAYES_REQUEST_VERBOSE_ENABLE);
|
||||
_hayes_request_type(hayes, channel,
|
||||
HAYES_REQUEST_VENDOR);
|
||||
_hayes_request_type(hayes, channel,
|
||||
HAYES_REQUEST_MODEL);
|
||||
_hayes_request_type(hayes, channel,
|
||||
@ -2948,7 +2950,6 @@ static void _on_code_cgmm(HayesChannel * channel, char const * answer)
|
||||
{
|
||||
ModemEvent * event = &channel->events[MODEM_EVENT_TYPE_MODEL];
|
||||
char * p;
|
||||
size_t i;
|
||||
|
||||
if(answer[0] == '\0' || strcmp(answer, "OK") == 0
|
||||
|| (p = strdup(answer)) == NULL) /* XXX report error? */
|
||||
@ -2956,17 +2957,7 @@ static void _on_code_cgmm(HayesChannel * channel, char const * answer)
|
||||
free(channel->model_name);
|
||||
channel->model_name = p;
|
||||
event->model.name = p;
|
||||
/* determine known quirks */
|
||||
for(i = 0; hayes_quirks[i].model != NULL; i++)
|
||||
if(strcmp(hayes_quirks[i].model, p) == 0)
|
||||
{
|
||||
channel->quirks = hayes_quirks[i].quirks;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: %s() quirks=%u\n", __func__,
|
||||
channel->quirks);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
channel->quirks = hayes_quirks(event->model.vendor, p);
|
||||
}
|
||||
|
||||
|
||||
|
@ -15,28 +15,51 @@
|
||||
|
||||
|
||||
|
||||
#include <stddef.h>
|
||||
#include <sys/types.h>
|
||||
#include <string.h>
|
||||
#include "quirks.h"
|
||||
|
||||
|
||||
/* HayesQuirks */
|
||||
/* public */
|
||||
/* private */
|
||||
/* constants */
|
||||
HayesQuirks hayes_quirks[] =
|
||||
static HayesQuirks _hayes_quirks[] =
|
||||
{
|
||||
{ "\"Neo1973 Embedded GSM Modem\"",
|
||||
{ "Openmomo", "\"Neo1973 Embedded GSM Modem\"",
|
||||
HAYES_QUIRK_WANT_SMSC_IN_PDU
|
||||
| HAYES_QUIRK_CONNECTED_LINE_DISABLED
|
||||
| HAYES_QUIRK_REPEAT_ON_UNKNOWN_ERROR },
|
||||
{ "\"Neo1973 GTA01/GTA02 Embedded GSM Modem\"",
|
||||
{ "Openmoko", "\"Neo1973 GTA01/GTA02 Embedded GSM Modem\"",
|
||||
HAYES_QUIRK_WANT_SMSC_IN_PDU
|
||||
| HAYES_QUIRK_CONNECTED_LINE_DISABLED
|
||||
| HAYES_QUIRK_REPEAT_ON_UNKNOWN_ERROR },
|
||||
{ "\"Neo1973 GTA02 Embedded GSM Modem\"",
|
||||
{ "Openmoko", "\"Neo1973 GTA02 Embedded GSM Modem\"",
|
||||
HAYES_QUIRK_WANT_SMSC_IN_PDU
|
||||
| HAYES_QUIRK_CONNECTED_LINE_DISABLED
|
||||
| HAYES_QUIRK_REPEAT_ON_UNKNOWN_ERROR },
|
||||
{ "Nokia N900",
|
||||
HAYES_QUIRK_BATTERY_70 },
|
||||
{ NULL, 0 }
|
||||
{ "Nokia", "Nokia N900",
|
||||
HAYES_QUIRK_BATTERY_70 }
|
||||
};
|
||||
|
||||
|
||||
/* public */
|
||||
/* functions */
|
||||
/* hayes_quirks */
|
||||
unsigned int hayes_quirks(char const * vendor, char const * model)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if(vendor == NULL || model == NULL)
|
||||
return 0;
|
||||
for(i = 0; i < sizeof(_hayes_quirks) / sizeof(*_hayes_quirks); i++)
|
||||
if(strcmp(_hayes_quirks[i].vendor, vendor) == 0
|
||||
&& strcmp(_hayes_quirks[i].model, model) == 0)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "DEBUG: %s() quirks=%u\n", __func__,
|
||||
_hayes_quirks[i].quirks);
|
||||
#endif
|
||||
return _hayes_quirks[i].quirks;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -33,12 +33,13 @@ typedef enum _HayesQuirk
|
||||
|
||||
typedef const struct _HayesQuirks
|
||||
{
|
||||
char const * vendor;
|
||||
char const * model;
|
||||
unsigned int quirks;
|
||||
} HayesQuirks;
|
||||
|
||||
|
||||
/* constants */
|
||||
extern HayesQuirks hayes_quirks[];
|
||||
/* functions */
|
||||
unsigned int hayes_quirks(char const * vendor, char const * model);
|
||||
|
||||
#endif /* PHONE_MODEM_HAYES_QUIRKS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user