<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>override a Zephyr sensor driver</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/110210/override-a-zephyr-sensor-driver</link><description>I like to override a Zephyr sensor driver with an out of tree driver with the same name and vendor. (Background the driver has a bug in I2C that needs to be solved). 
 I copied all relevant files to the out of tree project but now it gives the error below</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 15 Apr 2024 11:54:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/110210/override-a-zephyr-sensor-driver" /><item><title>RE: override a Zephyr sensor driver</title><link>https://devzone.nordicsemi.com/thread/478757?ContentTypeID=1</link><pubDate>Mon, 15 Apr 2024 11:54:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:454b710d-2e09-425c-aa60-dd22a8d8a111</guid><dc:creator>AHaug</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]What’s the way to override an existing Zephyr driver in an out of tree project?[/quote]
&lt;p&gt;You can also refer to this discussion w.r.t a similar question&amp;nbsp;&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/109144/recognizing-out-of-tree-device-driver-bindings-for-mcuboot-child-image"&gt;Recognizing out of tree device driver bindings for mcuboot child image.&lt;/a&gt;&amp;nbsp;(albeit this touches upon how to make mcuboot recognize an out of tree driver)&amp;nbsp;as well as this case&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/100815/out-of-tree-driver---zephyr-freestanding-app"&gt;Out-of-tree driver - Zephyr (freestanding app)&lt;/a&gt;&amp;nbsp;which has a solution for how to do this based on the Zephyr discord support forum&lt;/p&gt;
&lt;p&gt;But in general there are two points I would like to make you aware of:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;If you overwrite the existing device drives with patches of your you will need to make sure you maintain these changes in your own zephyr fork while developing, which is ok to do but you need to make sure you do this if you ever intend on migrating between versions&lt;/li&gt;
&lt;li&gt;Instead I would recommend that you create a new device based on the existing files with a different name that you instead import as your own device.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Let me know if this answers your questions&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kind regards,&lt;br /&gt;Andreas&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>