Thread: Troubleshooting a driver issue, but I'm not sure where to go...

  1. #1
    Registered User
    Join Date
    Oct 2011
    Posts
    5

    Question Troubleshooting a driver issue, but I'm not sure where to go...

    Hi everyone,

    First a little background. I have a Pinnacle PCTV-80e tuner, and have patched the video-4-linux code to allow it to work. However, when I restart my computer with it plugged in, it fails to load properly. Essentially it loads, but it fails to set up a frontend for the tuner.

    Here are the applicable messages from dmesg:

    Code:
    [   36.579949] DVB: Unable to find symbol drx39xxj_attach()
    [   36.579965] em28xx #0: /2: frontend initialization failed
    [   36.579973] Em28xx: Initialized (Em28xx dvb Extension) extension
    The DVB portion refers to em28xx-dvb.c which has the following lines of code (relevant to this)
    Code:
    #include "drx39xxj.h"
    
    struct dvb_frontend *fe;
    dvb->fe[0] = dvb_attach(drx39xxj_attach, &dev->i2c_adap);
    The (drx39xxj_attach) is located in the drx39xxj.h file, which is located in another directory under the tree (linux/drivers/media/dvb/frontends/drx39xxy/), where this file is located in linux/drivers/media/video/em28xx/).

    In the drx39xxj.h file, the code looks like this:

    Code:
    #ifndef DRX39XXJ_H
    #define DRX39XXJ_H
    
    
    #include <linux/dvb/frontend.h>
    #include "dvb_frontend.h"
    #include "drx_driver.h"
    
    
    struct drx39xxj_state {
        struct i2c_adapter *i2c;
        DRXDemodInstance_t *demod;
        DRXStandard_t current_standard;
        struct dvb_frontend frontend;
        int powered_up:1;
        unsigned int i2c_gate_open:1;
    };
    
    
    extern struct dvb_frontend* drx39xxj_attach(struct i2c_adapter *i2c);
    
    
    #endif // DVB_DUMMY_FE_H
    So my questions are these...

    1. Would the fact that in the em28xx-dvb.c file, the frontend is declared as "dvb_frontend *fe;" and in the drx39xxj.h file, the frontend is declared as "dvb_frontend frontend;" be enough to cause it to fail to find the drx39xxj_attach method?

    2. Even though this compiles (make and make install), do I need ot change the #include statement in the em28xx-dvb.c file to reflect the directory location of the drx39xxj.h file? (the linux/drivers/media/dvb/frontends/drx39xxy directory instead of just listing the file name)?

    3. How would I trace through this to find out whether it's not finding the drx39xxj.h file when it tries to install the drivers and initialize the frontend, fails to find the drx39xxj_attach method itself from the .h file, or some other issue?

    I have the files uploaded to a github repository, if someone needs to see the entire codebase to help me. Or I can post the entire code for each file, if necessary (although the em28xx-dvb.c file is pretty large).

    Also, any other suggestions besides where I'm looking are greatly appreciated.

    Thanks for any help with this, and have a great day
    Patrick.

  2. #2
    Registered User
    Join Date
    Oct 2011
    Posts
    5
    I think I may have found the error, but I'm not entirely sure (since I'm not a C programmer).

    As mentioned above, in my drx39xxj.h file, I have the following code:

    Code:
    extern struct dvb_frontend* drx39xxj_attach(struct i2c_adapter *i2c);
    However, when I checked my drx39xxj.c file, the structure is written like this:
    Code:
    struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c)
    {
    To me, from my experience with other programming languages, those need to be the same. I'd assume that I need to fix the line in the .h file, but I'm not entirely sure.

    Thanks for any help, and have a great day
    Patrick.

  3. #3
    Registered User
    Join Date
    Sep 2011
    Location
    Stockholm, Sweden
    Posts
    131
    Quote Originally Posted by PatrickDickey View Post
    So my questions are these...

    1. Would the fact that in the em28xx-dvb.c file, the frontend is declared as "dvb_frontend *fe;" and in the drx39xxj.h file, the frontend is declared as "dvb_frontend frontend;" be enough to cause it to fail to find the drx39xxj_attach method?
    The statement in the .c-file declares a pointer to a struct dvb_frontend, while the statement in the h-file just says that there is a function defined somewhere which returns a pointer to a struct dvb_frontend.

    Quote Originally Posted by PatrickDickey View Post
    2. Even though this compiles (make and make install), do I need ot change the #include statement in the em28xx-dvb.c file to reflect the directory location of the drx39xxj.h file? (the linux/drivers/media/dvb/frontends/drx39xxy directory instead of just listing the file name)?
    The compiler should complain if it can't find the header file. The correct path is most likely searched automatically by the make-process. (i.e. passing the -I switch to gcc).


    Quote Originally Posted by PatrickDickey View Post
    3. How would I trace through this to find out whether it's not finding the drx39xxj.h file when it tries to install the drivers and initialize the frontend, fails to find the drx39xxj_attach method itself from the .h file, or some other issue?
    Perhaps the symbol is not exported properly in the source-file?

    Quote Originally Posted by PatrickDickey View Post
    I have the files uploaded to a github repository, if someone needs to see the entire codebase to help me. Or I can post the entire code for each file, if necessary (although the em28xx-dvb.c file is pretty large).

    Also, any other suggestions besides where I'm looking are greatly appreciated.

    Thanks for any help with this, and have a great day
    Patrick.
    Isn't there any official support-forum for this driver/frontend?

  4. #4
    Registered User
    Join Date
    Oct 2011
    Posts
    5
    Quote Originally Posted by iceaway View Post
    The statement in the .c-file declares a pointer to a struct dvb_frontend, while the statement in the h-file just says that there is a function defined somewhere which returns a pointer to a struct dvb_frontend.


    The compiler should complain if it can't find the header file. The correct path is most likely searched automatically by the make-process. (i.e. passing the -I switch to gcc).



    Perhaps the symbol is not exported properly in the source-file?



    Isn't there any official support-forum for this driver/frontend?
    An update and some answers to your questions. I found out that it wasn't making the .o files for the drxj.h or drxj.c (or anything in that directory). In the Makefile, it was just pointing to the directory, so nothing was happening. After I moved all of the files to the main directory and fixed the Makefiles, I got everything to compile....

    Then, I upgraded the kernel (Ubuntu's updates) and now I have to start over.

    As for your question about the official support, I could **probably** get help on the kernel mailing list, but the first (and subsequently last) time that I emailed a question about this, I started a mini-flame war between the developer and one of the maintainers of the video-4-linux project (simply by mentioning what I was doing). So, I'm avoiding that outcome. Also the developer essentially said "I told you on the blog, that you should just build it against the media_build and it will work with some minor changes)." Which implies to me that he's not going to be much help.

    Thanks for all of your help on this, and have a great day
    Patrick.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. hi how to check my serial port is intrupt driver or poll driver?
    By nkrao123@gmail. in forum Networking/Device Communication
    Replies: 5
    Last Post: 09-19-2011, 11:20 PM
  2. Troubleshooting Please
    By jsking09 in forum C Programming
    Replies: 3
    Last Post: 03-03-2010, 02:37 AM
  3. [C++] USB gadget driver, unbound kernel driver?
    By Jelte in forum C++ Programming
    Replies: 0
    Last Post: 01-13-2010, 08:53 AM
  4. Sound Driver Issue
    By HaVoX in forum Tech Board
    Replies: 2
    Last Post: 02-08-2006, 01:38 AM
  5. Troubleshooting DDE
    By musicafterhours in forum Windows Programming
    Replies: 3
    Last Post: 11-18-2001, 08:26 AM