Can't use ioctl() to control a device owned by kernel module?Benefit of kernel module compiled inside...

12V lead acid charger with LM317 not charging

How to halve redstone signal strength?

How to help new students accept function notation

Can I enter a rental property without giving notice if I'm afraid a tenant may be hurt?

Did Apollo leave poop on the moon?

How can I refer to something in a book?

What does VB stand for?

Traveling from Germany to other countries by train?

Why ReLU function is not differentiable at 0?

Did silent film actors actually say their lines or did they simply improvise “dialogue” while being filmed?

Is the Folding Boat truly seaworthy?

How do these cubesats' whip antennas work?

If someone else uploads my GPL'd code to Github without my permission, is that a copyright violation?

Is there a drawback to Flail Snail's Shell defense?

Is it double speak?

What is the German idiom or expression for when someone is being hypocritical against their own teachings?

Differentiability of operator norm

What word best describes someone who likes to do everything on his own?

Is Odin inconsistent about the powers of Mjolnir?

Count number of occurences of particular numbers in list

Cobb-Douglas production function with expenditures rather than units

What is a Casino Word™?

Can ads on a page read my password?

Did Captain America make out with his niece?



Can't use ioctl() to control a device owned by kernel module?


Benefit of kernel module compiled inside kernel?kernel module function callKernel optimiziations for ioctl AF_INET operationswhat is the difference between Device driver and kernel moduleXen Kernel - SCSI_WAIT_SCAN ModuleCompiling kernel module Debian 7.9 xillybusmodule issues with kernelpsmouse kernel module recompilingKernel 4.9 module mismatchUnload running kernel module






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







0















I failed to use C/C++ to access the image sensor OV5645's register on my system via I2C bus. Below are some information about my system:



Hardware:
Dragonboard 410c +
96Boards MIPI Adapter with Dual OV5645
(https://www.ebay.com/itm/96Boards-MIPI-Adapter-with-Dual-OV5645/253645902432?hash=item3b0e795260%25253Ag%25253AL38AAOSwCmNZyJq5%252525EF%252525BC%25252589)
OS :
Linaro Linux 19.01


As I can use GStreamer to control the two OV5645 to feedback captured images, the hardware connections seems to be fine. Below are some information about the I2C master and OV5645 in my system:



linaro@linaro-developer:~$ sudo i2cdetect -l
i2c-3 i2c QUP I2C adapter I2C adapter
i2c-1 i2c QUP I2C adapter I2C adapter
i2c-4 i2c Qualcomm Camera Control Interface I2C adapter
i2c-0 i2c QUP I2C adapter I2C adapter

linaro@linaro-developer:~$ dmesg | grep ov5645
[ 11.825197] ov5645 4-003b: OV5645 detected at address 0x3b
[ 12.290626] ov5645 4-003a: OV5645 detected at address 0x3a


And here is my short program: https://gist.github.com/oliverjungen/6f25e9e77167a17d677e7a3c0678c41e



What it does are simply:





  1. Open /dev/i2c-4



    file = open(filename, O_RDWR);




  2. Set I2C slave address 0x3b



    errno = ioctl(file, I2C_SLAVE_FORCE, CAM_REAR_I2C_ADDR);




  3. Send 16-bit register address 0x300a to this I2C slave



    ret = write(file, &reg, 2);




However, when it runs, I always get:



Write i2c internal address error: Input/output error


This message was printed by perror() in this program’s Line 54, after writing the register address (0x300a, SENSOR CHIP ID HIGH BYTE) to OV5645.



I found that, when this error occurs, the kernel module i2c-qcom-cci reports error messages like:



linaro@linaro-developer:~$ dmesg | grep cci
[ 1280.099448] i2c-qcom-cci 1b0c000.cci: Master 0 error 0x08000000
[ 1280.099502] i2c-qcom-cci 1b0c000.cci: master 0 queue 0 error -5
[ 1280.104247] i2c-qcom-cci 1b0c000.cci: cci i2c xfer error -5


These I2C slaves (these OV5645) are actually owned by kernel modules. That's the reason why I use I2C_SLAVE_FORCE instead of I2C_SLAVE as the flag when I set the I2C slave address: errno = ioctl(file, I2C_SLAVE_FORCE, CAM_REAR_I2C_ADDR);



I'm wondering whether I can't use ioctl() to control a device owned by kernel modules?










share|improve this question































    0















    I failed to use C/C++ to access the image sensor OV5645's register on my system via I2C bus. Below are some information about my system:



    Hardware:
    Dragonboard 410c +
    96Boards MIPI Adapter with Dual OV5645
    (https://www.ebay.com/itm/96Boards-MIPI-Adapter-with-Dual-OV5645/253645902432?hash=item3b0e795260%25253Ag%25253AL38AAOSwCmNZyJq5%252525EF%252525BC%25252589)
    OS :
    Linaro Linux 19.01


    As I can use GStreamer to control the two OV5645 to feedback captured images, the hardware connections seems to be fine. Below are some information about the I2C master and OV5645 in my system:



    linaro@linaro-developer:~$ sudo i2cdetect -l
    i2c-3 i2c QUP I2C adapter I2C adapter
    i2c-1 i2c QUP I2C adapter I2C adapter
    i2c-4 i2c Qualcomm Camera Control Interface I2C adapter
    i2c-0 i2c QUP I2C adapter I2C adapter

    linaro@linaro-developer:~$ dmesg | grep ov5645
    [ 11.825197] ov5645 4-003b: OV5645 detected at address 0x3b
    [ 12.290626] ov5645 4-003a: OV5645 detected at address 0x3a


    And here is my short program: https://gist.github.com/oliverjungen/6f25e9e77167a17d677e7a3c0678c41e



    What it does are simply:





    1. Open /dev/i2c-4



      file = open(filename, O_RDWR);




    2. Set I2C slave address 0x3b



      errno = ioctl(file, I2C_SLAVE_FORCE, CAM_REAR_I2C_ADDR);




    3. Send 16-bit register address 0x300a to this I2C slave



      ret = write(file, &reg, 2);




    However, when it runs, I always get:



    Write i2c internal address error: Input/output error


    This message was printed by perror() in this program’s Line 54, after writing the register address (0x300a, SENSOR CHIP ID HIGH BYTE) to OV5645.



    I found that, when this error occurs, the kernel module i2c-qcom-cci reports error messages like:



    linaro@linaro-developer:~$ dmesg | grep cci
    [ 1280.099448] i2c-qcom-cci 1b0c000.cci: Master 0 error 0x08000000
    [ 1280.099502] i2c-qcom-cci 1b0c000.cci: master 0 queue 0 error -5
    [ 1280.104247] i2c-qcom-cci 1b0c000.cci: cci i2c xfer error -5


    These I2C slaves (these OV5645) are actually owned by kernel modules. That's the reason why I use I2C_SLAVE_FORCE instead of I2C_SLAVE as the flag when I set the I2C slave address: errno = ioctl(file, I2C_SLAVE_FORCE, CAM_REAR_I2C_ADDR);



    I'm wondering whether I can't use ioctl() to control a device owned by kernel modules?










    share|improve this question



























      0












      0








      0








      I failed to use C/C++ to access the image sensor OV5645's register on my system via I2C bus. Below are some information about my system:



      Hardware:
      Dragonboard 410c +
      96Boards MIPI Adapter with Dual OV5645
      (https://www.ebay.com/itm/96Boards-MIPI-Adapter-with-Dual-OV5645/253645902432?hash=item3b0e795260%25253Ag%25253AL38AAOSwCmNZyJq5%252525EF%252525BC%25252589)
      OS :
      Linaro Linux 19.01


      As I can use GStreamer to control the two OV5645 to feedback captured images, the hardware connections seems to be fine. Below are some information about the I2C master and OV5645 in my system:



      linaro@linaro-developer:~$ sudo i2cdetect -l
      i2c-3 i2c QUP I2C adapter I2C adapter
      i2c-1 i2c QUP I2C adapter I2C adapter
      i2c-4 i2c Qualcomm Camera Control Interface I2C adapter
      i2c-0 i2c QUP I2C adapter I2C adapter

      linaro@linaro-developer:~$ dmesg | grep ov5645
      [ 11.825197] ov5645 4-003b: OV5645 detected at address 0x3b
      [ 12.290626] ov5645 4-003a: OV5645 detected at address 0x3a


      And here is my short program: https://gist.github.com/oliverjungen/6f25e9e77167a17d677e7a3c0678c41e



      What it does are simply:





      1. Open /dev/i2c-4



        file = open(filename, O_RDWR);




      2. Set I2C slave address 0x3b



        errno = ioctl(file, I2C_SLAVE_FORCE, CAM_REAR_I2C_ADDR);




      3. Send 16-bit register address 0x300a to this I2C slave



        ret = write(file, &reg, 2);




      However, when it runs, I always get:



      Write i2c internal address error: Input/output error


      This message was printed by perror() in this program’s Line 54, after writing the register address (0x300a, SENSOR CHIP ID HIGH BYTE) to OV5645.



      I found that, when this error occurs, the kernel module i2c-qcom-cci reports error messages like:



      linaro@linaro-developer:~$ dmesg | grep cci
      [ 1280.099448] i2c-qcom-cci 1b0c000.cci: Master 0 error 0x08000000
      [ 1280.099502] i2c-qcom-cci 1b0c000.cci: master 0 queue 0 error -5
      [ 1280.104247] i2c-qcom-cci 1b0c000.cci: cci i2c xfer error -5


      These I2C slaves (these OV5645) are actually owned by kernel modules. That's the reason why I use I2C_SLAVE_FORCE instead of I2C_SLAVE as the flag when I set the I2C slave address: errno = ioctl(file, I2C_SLAVE_FORCE, CAM_REAR_I2C_ADDR);



      I'm wondering whether I can't use ioctl() to control a device owned by kernel modules?










      share|improve this question














      I failed to use C/C++ to access the image sensor OV5645's register on my system via I2C bus. Below are some information about my system:



      Hardware:
      Dragonboard 410c +
      96Boards MIPI Adapter with Dual OV5645
      (https://www.ebay.com/itm/96Boards-MIPI-Adapter-with-Dual-OV5645/253645902432?hash=item3b0e795260%25253Ag%25253AL38AAOSwCmNZyJq5%252525EF%252525BC%25252589)
      OS :
      Linaro Linux 19.01


      As I can use GStreamer to control the two OV5645 to feedback captured images, the hardware connections seems to be fine. Below are some information about the I2C master and OV5645 in my system:



      linaro@linaro-developer:~$ sudo i2cdetect -l
      i2c-3 i2c QUP I2C adapter I2C adapter
      i2c-1 i2c QUP I2C adapter I2C adapter
      i2c-4 i2c Qualcomm Camera Control Interface I2C adapter
      i2c-0 i2c QUP I2C adapter I2C adapter

      linaro@linaro-developer:~$ dmesg | grep ov5645
      [ 11.825197] ov5645 4-003b: OV5645 detected at address 0x3b
      [ 12.290626] ov5645 4-003a: OV5645 detected at address 0x3a


      And here is my short program: https://gist.github.com/oliverjungen/6f25e9e77167a17d677e7a3c0678c41e



      What it does are simply:





      1. Open /dev/i2c-4



        file = open(filename, O_RDWR);




      2. Set I2C slave address 0x3b



        errno = ioctl(file, I2C_SLAVE_FORCE, CAM_REAR_I2C_ADDR);




      3. Send 16-bit register address 0x300a to this I2C slave



        ret = write(file, &reg, 2);




      However, when it runs, I always get:



      Write i2c internal address error: Input/output error


      This message was printed by perror() in this program’s Line 54, after writing the register address (0x300a, SENSOR CHIP ID HIGH BYTE) to OV5645.



      I found that, when this error occurs, the kernel module i2c-qcom-cci reports error messages like:



      linaro@linaro-developer:~$ dmesg | grep cci
      [ 1280.099448] i2c-qcom-cci 1b0c000.cci: Master 0 error 0x08000000
      [ 1280.099502] i2c-qcom-cci 1b0c000.cci: master 0 queue 0 error -5
      [ 1280.104247] i2c-qcom-cci 1b0c000.cci: cci i2c xfer error -5


      These I2C slaves (these OV5645) are actually owned by kernel modules. That's the reason why I use I2C_SLAVE_FORCE instead of I2C_SLAVE as the flag when I set the I2C slave address: errno = ioctl(file, I2C_SLAVE_FORCE, CAM_REAR_I2C_ADDR);



      I'm wondering whether I can't use ioctl() to control a device owned by kernel modules?







      debian kernel






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 14 mins ago









      Oliver ChenOliver Chen

      111 bronze badge




      111 bronze badge

























          0






          active

          oldest

          votes














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "106"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f534473%2fcant-use-ioctl-to-control-a-device-owned-by-kernel-module%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Unix & Linux Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f534473%2fcant-use-ioctl-to-control-a-device-owned-by-kernel-module%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Taj Mahal Inhaltsverzeichnis Aufbau | Geschichte | 350-Jahr-Feier | Heutige Bedeutung | Siehe auch |...

          Baia Sprie Cuprins Etimologie | Istorie | Demografie | Politică și administrație | Arii naturale...

          Nicolae Petrescu-Găină Cuprins Biografie | Opera | In memoriam | Varia | Controverse, incertitudini...