[ 1194141 ] better diagnostics for opening ppdev device

git-svn-id: https://urjtag.svn.sourceforge.net/svnroot/urjtag/trunk@707 b68d4a1b-bc3d-0410-92ed-d4ac073336b7
master
Kolja Waschk 17 years ago
parent ebbd82cd16
commit 88a859acab

@ -34,6 +34,7 @@
#include <linux/ioctl.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include "parport.h"
@ -161,10 +162,13 @@ ppdev_open( parport_t *parport )
ppdev_params_t *p = parport->params;
p->fd = open( p->portname, O_RDWR );
if (p->fd < 0)
if (p->fd < 0) {
printf( _("Could not open port %s: %s\n"), p->portname, strerror(errno) );
return -1;
}
if ((ioctl( p->fd, PPEXCL ) == -1) || (ioctl( p->fd, PPCLAIM ) == -1)) {
printf( _("Could not claim ppdev device: %s\n"), strerror(errno) );
close( p->fd );
p->fd = -1;
return -1;

Loading…
Cancel
Save