OpenCPN Partial API docs
linux_devices.cpp File Reference

Implement linux_devices.h. More...

#include "config.h"
#include <string>
#include <sstream>
#include <iomanip>
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
#include <sys/sysmacros.h>
#include <sys/stat.h>
#include <libusb.h>
#include "model/linux_devices.h"
#include "model/logger.h"
#include "model/ocpn_utils.h"

Go to the source code of this file.

Classes

struct  usbdata
 

Typedefs

typedef struct usbdata usbdata
 

Functions

bool IsDonglePermissionsWrong ()
 Return true if an existing dongle cannot be accessed.
 
bool IsDevicePermissionsOk (const char *path)
 Check device path permissions. More...
 
std::string MakeUdevLink ()
 Get next available udev rule base name. More...
 
std::string GetDongleRule ()
 
std::string GetDeviceRule (const char *device, const char *symlink)
 Get device udev rule. More...
 

Detailed Description

Implement linux_devices.h.

Definition in file linux_devices.cpp.

Function Documentation

◆ GetDeviceRule()

std::string GetDeviceRule ( const char *  device,
const char *  symlink 
)

Get device udev rule.

Parameters
deviceComplete device path
symlinkAs returned by MakeUdevLink()
Returns
udev rule which makes the device public read/write (0666)

Definition at line 301 of file linux_devices.cpp.

◆ GetDongleRule()

std::string GetDongleRule ( )
Returns
udev rule which makes the dongle public read write (666)

Definition at line 289 of file linux_devices.cpp.

◆ IsDevicePermissionsOk()

bool IsDevicePermissionsOk ( const char *  path)

Check device path permissions.

Parameters
pathcomplete device path
Returns
True if device is exposing read/write permissions.

Definition at line 156 of file linux_devices.cpp.

◆ MakeUdevLink()

std::string MakeUdevLink ( )

Get next available udev rule base name.

Returns
first name not used in the sequence opencpn0..opencpn9

Definition at line 244 of file linux_devices.cpp.