Modem devices
Implementation internals » Device handling

Modem detection functions. More...

## Data Structures

struct | speeds_s

## Macros

#define | MAX_SPEED (sizeof speeds / sizeof *speeds)
#define | MAX_INIT_STRING (sizeof init_strings / sizeof *init_strings)

## Functions

static void | get_serial_modem (hd_data_t *hd_data)
static void | add_serial_modem (hd_data_t *hd_data)
static int | dev_name_duplicate (hd_data_t *hd_data, char *dev_name)
static void | guess_modem_name (hd_data_t *hd_data, ser_device_t *sm)
static void | at_cmd (hd_data_t *hd_data, char *at, int raw, int log_it)
static void | write_modem (hd_data_t *hd_data, char *msg)
static void | read_modem (hd_data_t *hd_data)
static ser_device_t * | add_ser_modem_entry (ser_device_t **sm, ser_device_t *new_sm)
static int | set_modem_speed (ser_device_t *sm, unsigned baud)
static int | init_modem (ser_device_t *mi)
static unsigned | chk4id (ser_device_t *mi)
static void | dump_ser_modem_data (hd_data_t *hd_data)
void | hd_scan_modem (hd_data_t *hd_data)
int | check_for_responce (str_list_t *str_list, char *str, int len)
str_list_t * | str_list_dup (str_list_t *orig)
int | is_pnpinfo (ser_device_t *mi, int ofs)

## Variables

static struct speeds_s | speeds []
static char * | init_strings []

## Detailed Description

Modem detection functions.

Note: what about modem speed?

## Macro Definition Documentation

## MAX_INIT_STRING

#define MAX_INIT_STRING (sizeof init_strings / sizeof *init_strings)

Referenced by get_serial_modem().

## MAX_SPEED

#define MAX_SPEED (sizeof speeds / sizeof *speeds)

Referenced by get_serial_modem(), and set_modem_speed().

## Function Documentation

## add_ser_modem_entry()

ser_device_t * add_ser_modem_entry | ( | ser_device_t ** | sm,
|  | ser_device_t * | new_sm )

static

References s_ser_device_t::next.

Referenced by get_serial_modem().

## add_serial_modem()

void add_serial_modem | ( | hd_data_t * | hd_data | ) |

static

References add_hd_entry(), add_res_entry(), s_hd_t::attached_to, s_hd_t::base_class, u_hd_res_t::baud, bc_modem, s_hd_t::bus, bus_serial, s_hd_t::compat_device, s_hd_t::compat_vendor, s_ser_device_t::dev_id, s_ser_device_t::dev_name, s_hd_t::device, hd_data, hd_get_device_by_idx(), s_ser_device_t::hd_idx, hd_id_t::id, res_init_strings_t::init1, res_init_strings_t::init2, s_ser_device_t::init_string1, s_ser_device_t::init_string2, u_hd_res_t::init_strings, s_ser_device_t::is_modem, MAKE_ID, s_ser_device_t::max_baud, hd_id_t::name, name2eisa_id(), new_mem(), new_str(), s_ser_device_t::next, res_pppd_option_t::option, s_ser_device_t::pnp_id, s_ser_device_t::pppd_option, u_hd_res_t::pppd_option, s_hd_t::res, res_baud, res_init_strings, res_pppd_option, s_hd_t::serial, s_ser_device_t::serial, res_baud_t::speed, TAG_EISA, TAG_SPECIAL, res_baud_t::type, res_init_strings_t::type, res_pppd_option_t::type, s_hd_t::unix_dev_name, s_ser_device_t::user_name, s_ser_device_t::vend, and s_hd_t::vendor.

Referenced by hd_scan_modem().

## at_cmd()

void at_cmd | ( | hd_data_t * | hd_data,
|  | char * | at,
|  | int | raw,
|  | int | log_it )

static

References ADD2LOG, add_str_list(), s_ser_device_t::at_resp, s_ser_device_t::buf, s_ser_device_t::buf_len, s_ser_device_t::cur_baud, s_ser_device_t::dev_name, s_ser_device_t::do_io, free_str_list(), hd_data, HD_DEB_MODEM, hd_log_hex(), s_ser_device_t::next, s_str_list_t::next, PROGRESS, read_modem(), s_str_list_t::str, and write_modem().

Referenced by get_serial_modem(), and guess_modem_name().

## check_for_responce()

int check_for_responce | ( | str_list_t * | str_list,
|  | char * | str,
|  | int | len )

References s_str_list_t::next, and s_str_list_t::str.

Referenced by get_serial_modem().

## chk4id()

unsigned chk4id | ( | ser_device_t * | mi | ) |

static

References s_ser_device_t::buf_len, s_ser_device_t::garbage, is_pnpinfo(), and s_ser_device_t::pnp.

Referenced by get_serial_modem().

## dev_name_duplicate()

int dev_name_duplicate | ( | hd_data_t * | hd_data,
|  | char * | dev_name )

static

References s_ser_device_t::dev_name, hd_data, and s_ser_device_t::next.

Referenced by get_serial_modem().

## dump_ser_modem_data()

void dump_ser_modem_data | ( | hd_data_t * | hd_data | ) |

static

References ADD2LOG, s_ser_device_t::bits, s_ser_device_t::buf, s_ser_device_t::buf_len, s_ser_device_t::class_name, s_ser_device_t::dev_id, s_ser_device_t::dev_name, s_ser_device_t::garbage, hd_data, hd_log_hex(), s_ser_device_t::is_modem, s_ser_device_t::next, s_ser_device_t::pnp, s_ser_device_t::pnp_id, s_ser_device_t::pnp_rev, s_ser_device_t::serial, and s_ser_device_t::user_name.

Referenced by hd_scan_modem().

## get_serial_modem()

void get_serial_modem | ( | hd_data_t * | hd_data | ) |

static

References add_ser_modem_entry(), at_cmd(), s_ser_device_t::at_resp, s_hd_t::base_class, bc_comm, bc_modem, s_ser_device_t::buf, s_ser_device_t::buf_len, s_hd_t::bus, bus_usb, check_for_responce(), chk4id(), s_ser_device_t::cur_baud, s_ser_device_t::dev_name, dev_name_duplicate(), s_ser_device_t::do_io, s_ser_device_t::fd, free_mem(), free_str_list(), guess_modem_name(), has_something_attached(), hd_data, HD_DEB_MODEM, s_ser_device_t::hd_idx, hd_probe_feature(), hd_id_t::id, s_hd_t::idx, init_modem(), s_ser_device_t::init_string1, s_ser_device_t::init_string2, init_strings, s_ser_device_t::is_modem, s_ser_device_t::max_baud, MAX_INIT_STRING, MAX_SPEED, new_mem(), new_str(), s_hd_t::next, s_ser_device_t::next, s_ser_device_t::pppd_option, pr_modem_usb, PROGRESS, sc_com_ser, s_hd_t::tag_s::ser_device, set_modem_speed(), s_hd_t::tag_s::skip_modem, speeds, str_list_dup(), str_printf(), s_hd_t::sub_class, s_hd_t::tag, s_ser_device_t::tio, s_hd_t::unix_dev_name, s_ser_device_t::user_name, and s_ser_device_t::vend.

Referenced by hd_scan_modem().

## guess_modem_name()

void guess_modem_name | ( | hd_data_t * | hd_data,
|  | ser_device_t * | sm )

static

References at_cmd(), s_ser_device_t::at_resp, canon_str(), s_ser_device_t::do_io, free_mem(), hd_data, new_str(), s_ser_device_t::next, s_str_list_t::next, s_str_list_t::str, str_printf(), s_ser_device_t::user_name, and s_ser_device_t::vend.

Referenced by get_serial_modem().

## hd_scan_modem()

void hd_scan_modem | ( | hd_data_t * | hd_data | ) |

References add_serial_modem(), s_ser_device_t::at_resp, s_ser_device_t::class_name, s_ser_device_t::dev_id, s_ser_device_t::dev_name, dump_ser_modem_data(), free_mem(), free_str_list(), get_serial_modem(), hd_data, HD_DEB_MODEM, hd_fork(), hd_fork_done(), hd_move_to_shm(), hd_probe_feature(), hd_shm_clean(), s_ser_device_t::init_string1, s_ser_device_t::init_string2, mod_modem, s_ser_device_t::next, pr_modem, PROGRESS, remove_hd_entries(), s_ser_device_t::serial, s_ser_device_t::user_name, and s_ser_device_t::vend.

Referenced by hd_scan_no_hal().

## init_modem()

int init_modem | ( | ser_device_t * | mi | ) |

static

References s_ser_device_t::fd, and s_ser_device_t::tio.

Referenced by get_serial_modem().

## is_pnpinfo()

int is_pnpinfo | ( | ser_device_t * | mi,
|  | int | ofs )

References s_ser_device_t::bits, s_ser_device_t::buf, s_ser_device_t::buf_len, s_ser_device_t::class_name, s_ser_device_t::dev_id, s_ser_device_t::pnp_id, s_ser_device_t::pnp_rev, s_ser_device_t::serial, str_printf(), and s_ser_device_t::user_name.

Referenced by chk4id(), and chk4id().

## read_modem()

void read_modem | ( | hd_data_t * | hd_data | ) |

static

References hd_data.

Referenced by at_cmd().

## set_modem_speed()

int set_modem_speed | ( | ser_device_t * | sm,
|  | unsigned | baud )

static

References s_ser_device_t::cur_baud, s_ser_device_t::fd, MAX_SPEED, and speeds.

Referenced by get_serial_modem().

## str_list_dup()

str_list_t * str_list_dup | ( | str_list_t * | orig | ) |

References add_str_list(), s_str_list_t::next, and s_str_list_t::str.

Referenced by get_serial_modem().

## write_modem()

void write_modem | ( | hd_data_t * | hd_data,
|  | char * | msg )

static

References ADD2LOG, s_ser_device_t::dev_name, s_ser_device_t::do_io, s_ser_device_t::fd, hd_data, and s_ser_device_t::next.

Referenced by at_cmd().

## Variable Documentation

## init_strings

char* init_strings[]

static

Initial value:
= {
"Q0 V1 E1",
"S0=0",
"&C1",
"&D2",
"+FCLASS=0"
}

Referenced by get_serial_modem().

## speeds

struct speeds_s speeds[]

static

Initial value:
= {
{ 1200, B1200 },
{ 1800, B1800 },
{ 2400, B2400 },
{ 4800, B4800 },
{ 9600, B9600 },
{ 19200, B19200 },
{ 38400, B38400 },
{ 57600, B57600 },
{ 115200, B115200 }
,{ 230400, B230400 }
,{ 460800, B460800 }
,{ 500000, B500000 }
,{ 1000000, B1000000 }
,{ 2000000, B2000000 }
,{ 4000000, B4000000 }
}

Referenced by get_serial_modem(), and set_modem_speed().