Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
remove unused function get_device_connection()
  • Loading branch information
perexg committed Jun 1, 2015
1 parent 5b6ed5e commit dce5451
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 80 deletions.
68 changes: 0 additions & 68 deletions src/main.c
Expand Up @@ -1197,71 +1197,3 @@ scopedunlock(pthread_mutex_t **mtxp)
{
pthread_mutex_unlock(*mtxp);
}


/**
*
*/
const char *
hostconnection2str(int type)
{
switch(type) {
case HOSTCONNECTION_USB12:
return "USB (12 Mbit/s)";

case HOSTCONNECTION_USB480:
return "USB (480 Mbit/s)";

case HOSTCONNECTION_PCI:
return "PCI";
}
return "Unknown";

}


/**
*
*/
static int
readlinefromfile(const char *path, char *buf, size_t buflen)
{
int fd = open(path, O_RDONLY);
ssize_t r;

if(fd == -1)
return -1;

r = read(fd, buf, buflen - 1);
close(fd);
if(r < 0)
return -1;

buf[buflen - 1] = 0;
return 0;
}


/**
*
*/
int
get_device_connection(const char *dev)
{
char path[200];
char l[64];
int speed;

snprintf(path, sizeof(path), "/sys/class/%s/device/speed", dev);

if(readlinefromfile(path, l, sizeof(l))) {
// Unable to read speed, assume it's PCI
return HOSTCONNECTION_PCI;
} else {
speed = atoi(l);

return speed >= 480 ? HOSTCONNECTION_USB480 : HOSTCONNECTION_USB12;
}
}


12 changes: 0 additions & 12 deletions src/tvheadend.h
Expand Up @@ -233,18 +233,6 @@ LIST_HEAD(dvr_timerec_entry_list, dvr_timerec_entry);
TAILQ_HEAD(th_pktref_queue, th_pktref);
LIST_HEAD(streaming_target_list, streaming_target);

/**
* Device connection types
*/
#define HOSTCONNECTION_UNKNOWN 0
#define HOSTCONNECTION_USB12 1
#define HOSTCONNECTION_USB480 2
#define HOSTCONNECTION_PCI 3

const char *hostconnection2str(int type);
int get_device_connection(const char *dev);


/**
* Stream component types
*/
Expand Down

0 comments on commit dce5451

Please sign in to comment.