wimax-tools 1.4.4
Functions

WiMAX device management

The main device management operations are wimaxll_open(), wimaxll_close() and wimax_reset(). More...

Functions

struct wimaxll_handlewimaxll_open (const char *device)
 Open a handle to the WiMAX control interface in the kernel.
void wimaxll_close (struct wimaxll_handle *wmx)
 Close a device handle opened with wimaxll_open()
int wimaxll_reset (struct wimaxll_handle *wmx)
 Reset a WiMAX device.
int wimaxll_rfkill (struct wimaxll_handle *wmx, enum wimax_rf_state state)
 Control the software RF Kill switch and obtain switch status.
int wimaxll_state_get (struct wimaxll_handle *wmx)
 Get Wimax device status from kernel and return it to user space.
const char * wimaxll_ifname (const struct wimaxll_handle *wmx)
 Return the name of a the system's WiMAX interface associated to an open handle.
unsigned wimaxll_ifidx (const struct wimaxll_handle *wmx)
 Return the interface index of the system's WiMAX interface associated to an open handle.
void wimaxll_priv_set (struct wimaxll_handle *wmx, void *priv)
 Set the private data associated to a WiMAX device handle.
void * wimaxll_priv_get (struct wimaxll_handle *wmx)
 Return the private data associated to a WiMAX device handle.

Detailed Description

The main device management operations are wimaxll_open(), wimaxll_close() and wimax_reset().

It is allowed to have more than one handle opened at the same time.

Use wimaxll_ifname() to obtain the name of the WiMAX interface a handle is open for.


Function Documentation

void wimaxll_close ( struct wimaxll_handle wmx)

Close a device handle opened with wimaxll_open()

Parameters:
wmxWiMAX device handle

Referenced by i2400m_destroy(), and main().

unsigned wimaxll_ifidx ( const struct wimaxll_handle wmx)

Return the interface index of the system's WiMAX interface associated to an open handle.

Parameters:
wmxWiMAX device handle
Returns:
Interface index

Note that if this is an any interface (open for all devices), this will vary. When not processing a callback, it will be zero. When processing a callback, this call will return the interface for which the callback was executed.

const char* wimaxll_ifname ( const struct wimaxll_handle wmx)

Return the name of a the system's WiMAX interface associated to an open handle.

Parameters:
wmxWiMAX device handle
Returns:
Interface name (only valid while the handle is open)

Note that if this is an any interface (open for all devices), this will be empty.

struct wimaxll_handle* wimaxll_open ( const char *  device) [read]

Open a handle to the WiMAX control interface in the kernel.

Parameters:
devicedevice name of the WiMAX network interface; to specify an interface by index, use the name "#IFNAME". To open a handle that will receive data for any device (but not allow sending commands to devices), set NULL.
Returns:
WiMAX device handle on success; on error, NULL is returned and the errno variable is updated with a corresponding negative value.

When opening the handle to the device, a basic check of API versioning will be done. If the kernel interface has a different major version, the wimaxll_open() call will fail (existing interfaces modified or removed). A higher kernel minor version is allowed (new interfaces added); a lower kernel minor version is allowed with a warning (the library might need interfaces that are not in the kernel).

Referenced by i2400m_create(), and main().

void* wimaxll_priv_get ( struct wimaxll_handle wmx)

Return the private data associated to a WiMAX device handle.

Parameters:
wmxWiMAX device handle
Returns:
pointer to priv data as set by wimaxll_priv_set() or wimaxll_open_name() or wimaxll_open_ifindex().
void wimaxll_priv_set ( struct wimaxll_handle wmx,
void *  priv 
)

Set the private data associated to a WiMAX device handle.

Parameters:
wmxWiMAX device handle
privPrivate data pointer to associate.
int wimaxll_reset ( struct wimaxll_handle wmx)

Reset a WiMAX device.

Parameters:
wmxWiMAX device handle
Returns:
result of the operation.
  • 0: warm reset suceeded
  • -ENODEV: warm reset failed and had to resort to a cold/bus reset; the device was disconnected from the system and the current handle is invalid and should be closed.
  • Any other negative error code: unrecoverable error, shutdown and go home

When there is a need to reset the device wimaxll_reset() can be used to issue a warm reset. That won't invalidate the existing handles, while still moving the device to power on state.

If the device cannot be properly reset, the WiMAX kernel stack may fall back to a cold reset, which will most likely disconnect the device from the driver (and bus) and reconnect it; that means device handles will be invalid from there on. In those cases, -ENODEV is returned.

Note:
This call is synchronous; when success is returned, the device has completed its internal reset.
int wimaxll_rfkill ( struct wimaxll_handle wmx,
enum wimax_rf_state  state 
)

Control the software RF Kill switch and obtain switch status.

Parameters:
wmxWiMAX device handle
stateState to which you want to toggle the sofware RF Kill switch (WIMAX_RF_ON, WIMAX_RF_OFF or WIMAX_RF_QUERY for just querying the current state of the hardware and software switches).
Returns:
Negative errno code on error. Otherwise, radio kill switch status (bit 0 hw switch, bit 1 sw switch, 0 OFF, 1 ON):
  • 3 0b11: Both HW and SW switches are on, radio is on
  • 2 0b10: HW switch is off, radio is off
  • 1 0b01: SW switch is on, radio is off
  • 0 0b00: Both HW and SW switches are off, radio is off

Allows the caller to control the state of the software RF Kill switch (if present) and in return, obtain the current status of both the hardware and software RF Kill switches.

If there is no hardware or software switch, that switch is assumed to be always on (radio on).

Changing the radio state might cause the device to change state, and cause the kernel to send reports indicating so.

Note:
The state of the radio (ON or OFF) is the inverse of the state of the RF-Kill switch (enabled/on kills the radio, radio off; disabled/off allows the radio to work, radio on).

Referenced by main(), and wimaxll_open().

int wimaxll_state_get ( struct wimaxll_handle wmx)

Get Wimax device status from kernel and return it to user space.

Parameters:
wmxWiMAX device handle
Returns:
Negative errno code on error. Otherwise, one from Wimax device status value, defined in enum wimax_st.

Allows the caller to get the state of the Wimax device.