When I plug a Kindle into a USB port, the Kindle's display tells me:
But when I say
So I looked into the source code for
And it bombs on the
How do I go about ejecting the Kindle on FreeBSD?
On (blush) Linux, that's exactly what I do. When I'm done accessing the Kindle from the computer, IIf you want to use your Kindle, please eject your Kindle from your computer.
eject /media/kindle
, and that text on the Kindle disappears, to be replaced with what I usually see when the Kindle is not connected to the computer.But when I say
eject /dev/msdosfs/Kindle
on FreeBSD 10.1-RELEASE, I get "Inappropriate ioctl for device", although the eject
command does succeed in unmounting the device.So I looked into the source code for
eject
, and just to simplify the problem I wrote this:
Code:
#include <sys/cdio.h>
#include <sys/ioctl.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
int
main(void)
{
int lo_fd;
lo_fd=open("/dev/msdosfs/Kindle",O_RDONLY);
if(lo_fd==-1)
{
perror("opening Kindle");
exit(1);
}
if(ioctl(lo_fd,CDIOCEJECT)==-1)
{
perror("ejecting Kindle");
exit(1);
}
printf("EOJ\n");
return 0;
} /* main() */
ioctl()
with "Inappropriate ioctl for device", whether the Kindle is mounted at the time or no.How do I go about ejecting the Kindle on FreeBSD?