1 /* $Id$ */
2 /* Copyright (c) 2014-2015 Pierre Pronchery <khorben@defora.org> */
3 /* This file is part of DeforaOS Desktop Phone */
4 /* This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, version 3 of the License.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>. */
15 
16 
17 
18 #include <sys/types.h>
19 #ifdef DEBUG
20 # include <stdio.h>
21 #endif
22 #include <string.h>
23 #include "quirks.h"
24 
25 
26 /* HayesQuirks */
27 /* private */
28 /* constants */
29 static HayesQuirks _hayes_quirks[] =
30 {
31 	{ "Ericsson", "F3507g",
32 		HAYES_QUIRK_CPIN_SLOW
33 			| HAYES_QUIRK_REPEAT_ON_UNKNOWN_ERROR		},
34 	{ "Nokia", "Nokia N9",
35 		HAYES_QUIRK_WANT_SMSC_IN_PDU				},
36 	{ "Sierra Wireless Inc.", "Sierra Wireless EM7345 4G LTE",
37 		HAYES_QUIRK_WANT_SMSC_IN_PDU				},
38 	{ "Openmoko", "\"Neo1973 Embedded GSM Modem\"",
39 		HAYES_QUIRK_WANT_SMSC_IN_PDU
40 			| HAYES_QUIRK_CONNECTED_LINE_DISABLED
41 			| HAYES_QUIRK_REPEAT_ON_UNKNOWN_ERROR		},
42 	{ "Openmoko", "\"Neo1973 GTA01/GTA02 Embedded GSM Modem\"",
43 		HAYES_QUIRK_WANT_SMSC_IN_PDU
44 			| HAYES_QUIRK_CONNECTED_LINE_DISABLED
45 			| HAYES_QUIRK_REPEAT_ON_UNKNOWN_ERROR		},
46 	{ "Openmoko", "\"Neo1973 GTA02 Embedded GSM Modem\"",
47 		HAYES_QUIRK_WANT_SMSC_IN_PDU
48 			| HAYES_QUIRK_CONNECTED_LINE_DISABLED
49 			| HAYES_QUIRK_REPEAT_ON_UNKNOWN_ERROR		},
50 	{ "Nokia", "Nokia N900",
51 		HAYES_QUIRK_BATTERY_70					}
52 };
53 
54 
55 /* public */
56 /* functions */
57 /* hayes_quirks */
hayes_quirks(char const * vendor,char const * model)58 unsigned int hayes_quirks(char const * vendor, char const * model)
59 {
60 	size_t i;
61 
62 	if(vendor == NULL || model == NULL)
63 		return 0;
64 	for(i = 0; i < sizeof(_hayes_quirks) / sizeof(*_hayes_quirks); i++)
65 		if(strcmp(_hayes_quirks[i].vendor, vendor) == 0
66 				&& strcmp(_hayes_quirks[i].model, model) == 0)
67 		{
68 #ifdef DEBUG
69 			fprintf(stderr, "DEBUG: %s() quirks=%u\n", __func__,
70 					_hayes_quirks[i].quirks);
71 #endif
72 			return _hayes_quirks[i].quirks;
73 		}
74 	return 0;
75 }
76