LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices


Reply
  Search this Thread
Old 11-19-2014, 06:33 AM   #1
ylmzekrm
LQ Newbie
 
Registered: Oct 2014
Posts: 4

Rep: Reputation: Disabled
About errno:70, writing data to Fm1188 voice chip


Hi friends,
I try to write to a voice processesor,

The i2c-2 device open succesfully, and Slave adress set successfully
But "write" returns -1 value and I get errno:70(Commnication error on send)

Anyone have detailed information about Errno:70, what caused errno:70? I couldnt find useful info yet about it.

Part of my code below:

Code:
JNIEXPORT jint JNICALL Java_com_I2CInterface_i2cwrite
  (JNIEnv * env, jclass jc, jintArray data)
{
   jint rc = -1;

   jint *buffer = (*env)->GetByteArrayElements(env, data, NULL);

   if (NULL == buffer)
   {
      LOGE("Buffer empty");
      return 0;
   }
   // Get data length
   jsize data_len = (*env)->GetArrayLength(env, data);
   LOGI("data_len = %d", data_len);

   // i2c-dev open
   int fd = open("/dev/i2c-2", O_RDWR);
   LOGI("fd return value = %d",fd);

   if(fd > 0)
   {   
int SLAVEADDR=0x60;
int in=ioctl(fd, I2C_SLAVE_FORCE, SLAVEADDR);
LOGI("IOCTL value: %d",in);

      if( in < 0)
      {
    	 char* error_str = strerror(errno);
         LOGE("Slave Address could not set, errno = %d (%s)", errno, error_str);
         goto _error;

      }
// writing data
int mq=write(fd, buffer, data_len);
LOGI("Write retun value: %d",mq);
     
     if(mq != data_len)
     {
     char* error_str = strerror(errno);
     LOGE("Couldnt write data!, errno = %d (%s)", errno, error_str);
     goto _error;
     }

      LOGI("Data write succesfully \n");
     
      rc = 0;

   _error:
      close(fd);
   }
   else
   {
      char* error_str = strerror(errno);
      LOGE("i2c device couldnt open-> I2C port 1, errno = %d (%s)", errno, error_str);
   }

   return (rc);
}

Last edited by ylmzekrm; 11-19-2014 at 06:34 AM.
 
  


Reply

Tags
embedded, linux command, serial port



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ErrNo 14 and ErrNo 256 in yum server configuration nivedhitha Linux - Server 4 05-22-2011 12:45 AM
I'm writing a CHIP-8 emulator, and have a lot of questions. Anikom15 Programming 13 12-23-2009 11:47 PM
LXer: Reinventing Voice & Data Networks LXer Syndicated Linux News 0 09-14-2006 07:03 PM
Problem with reading/writing GPIO on video card with bttv compatible chip boky Linux - Hardware 0 10-13-2005 05:08 AM
GVC 56 k external modem (Data, fax, voice) yagneshmistry Linux - Hardware 0 08-11-2004 10:24 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer

All times are GMT -5. The time now is 12:28 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration