LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Programing to read USB-GPS for SBC2440-IV Single Board Computer (https://www.linuxquestions.org/questions/linux-newbie-8/programing-to-read-usb-gps-for-sbc2440-iv-single-board-computer-771848/)

kennyha85 11-27-2009 01:56 AM

Programing to read USB-GPS for SBC2440-IV Single Board Computer
 
I have an USB-GPS receiver (Haicom 204E) and a SBC2440-IV Single Board
Computer. I have also written a C program to read my GPS receiver on Unbutu 8.10 for testing. It has worked well. On my PC, I have created a file asserted for usb port by using command " $ sudo mknod /dev/ttyUSB0 c 188 0". so I"ve treated my device as a file named "/dev/ttyUSB0".

However, on SBC2440-IV Single Board Computer, when I plug the GPS receiver in the USB host port1, I see a message on the terminal: "[root@arm-linux]# usb 1-1: new full speed USB device using s3c2410-ohci and address 2". then create /dev/ttyUSB0 file by using command "$ mknod /dev/ttyUSB0 c 188 0". I saw a file "ttyUSB0" in dev folder, but I can"t open it like the way on Unbutu. It"s seem to be that /dev/ttyUSB0 is not asserted for the USB host1.

Could someone help me to read the GPS receiver on SBC2440-IV Single Board
Computer?
this is my C code to read the file.
/*************************************************************************************/
int main(void)

{

int status,n;

char *port = "/dev/ttyUSB0";

printf("GPS receiver\n");

open_port (port);

configure_port(1);
pthread_create(&GPS_READ_ID, NULL, GPSreceiver, 0);
pthread_create(&GPS_SHOW_ID, NULL, GPSshow, 0);


while(1){

}

/* close the device file */

close(GPS_handle);

}



void open_port(char *port)

{

/* open the serial port device file

* O_NDELAY - tells port to operate and ignore the DCD line

* O_NOCTTY - this process is not to become the controlling

* process for the port. The driver will not send

* this process signals due to keyboard aborts, etc.

* O_NONBLOCK- tells port to be nonblocking (read will return immediatly)

*/

GPS_handle = open(port, O_RDWR | O_NDELAY | O_NOCTTY | O_NONBLOCK);

if (GPS_handle == -1)

{

perror("open_port: Unable to open");

exit(1);

}

else

tcgetattr(GPS_handle, &tio);

fcntl(GPS_handle, F_SETOWN, getpid());

fcntl(GPS_handle, F_SETFL, FASYNC);

}
/********************************************************************/

AwesomeMachine 11-27-2009 02:03 AM

You can try using gpsd.

kennyha85 11-27-2009 02:40 AM

Usb gps
 
I can't use gpsd because I want to program to read data from my GPS. My problem is that I don't know how to make the file asserted for USB hostport1 of SBC2440-IV Single Board Computer.
Somebody help me please,


All times are GMT -5. The time now is 09:06 AM.