cryptotronix / atsha204-i2c Goto Github PK
View Code? Open in Web Editor NEWThis project forked from cristeam/hwcrypt
Kernel module for handling Atmel crypto chip (ATSHA204)
License: GNU General Public License v3.0
This project forked from cristeam/hwcrypt
Kernel module for handling Atmel crypto chip (ATSHA204)
License: GNU General Public License v3.0
There are some dependencies that need to be addressed / installed:
The interface to /dev/atsha
should require just the command specific data, e.g.:
param1 - param2 - data
The kernel module with prepend the length, command byte, and append the crc.
Restrict the device to only be opened once.
The transaction function is used by various devices (random and the main driver). It is a critical section and needs to be appropriately protected.
[ 461.880961] atsha204_i2c: loading out-of-tree module taints kernel.
[ 461.881434] atsha204_i2c: Unknown symbol hwrng_unregister (err 0)
[ 461.881586] atsha204_i2c: Unknown symbol hwrng_register (err 0)
[ 461.925206] i2c i2c-1: new_device: Instantiated device atsha204-i2c at 0x64
Hello.
This is actually not an issue, but could you please tell me how could you know the CRC16 algorithm of ATSHA204? The algorithm is not a common one and I was struggling with it.
HI, i have added the atsha204-i2c driver in raspberrypi kernel. when i'm trying to add the device its through the error. plz find the logs below.:
root@raspberrypi3:/lib/modules/4.14.87/kernel/drivers/misc# echo atsha204-i2c 0x64 | tee /sys/class/i2c-adapter/i2c-1/new_device
atsha204[ 203.201663] Ramya atasha204 driver probe called
-i2c 0x6[ 203.206945] Attempting Wakeup : 1
4
[ 203.211957] Unable to handle kernel NULL pointer dereference at virtual address 00000033
[ 203.220167] pgd = b8e04000
[ 203.222949] [00000033] *pgd=00000000
[ 203.226590] Internal error: Oops: 5 [#1] SMP ARM
[ 203.231273] Modules linked in: atsha204_i2c bnep bluetooth ecdh_generic ipv6 brcmfmac brcmutil cfg80211 rfkill i2c_bcm2835 uio_pdrv_genirq]
[ 203.247390] CPU: 2 PID: 416 Comm: tee Not tainted 4.14.87 #1
[ 203.253127] Hardware name: BCM2835
[ 203.256576] task: b97de900 task.stack: b96a8000
[ 203.261185] PC is at atsha204_i2c_wakeup+0x6c/0x138 [atsha204_i2c]
[ 203.267465] LR is at i2c_adapter_unlock_bus+0x1c/0x20
[ 203.272588] pc : [<7f532484>] lr : [<8060f458>] psr: 60070013
[ 203.278944] sp : b96a9c40 ip : b96a9bb8 fp : b96a9c64
[ 203.284243] r10: 80c6b8b0 r9 : 00000015 r8 : 00000000
[ 203.289542] r7 : b8cac400 r6 : 7f5343b4 r5 : 00000001 r4 : 00000004
[ 203.296163] r3 : 00000000 r2 : 00000001 r1 : 00000008 r0 : 00000033
[ 203.302786] Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user
[ 203.310026] Control: 10c5383d Table: 38e0406a DAC: 00000055
[ 203.315855] Process tee (pid: 416, stack limit = 0xb96a8210)
[ 203.321594] Stack: (0xb96a9c40 to 0xb96aa000)
[ 203.326018] 9c40: 809b0050 43331104 b96a9c84 b8cac400 7f533040 7f535060 b96a9c84 b96a9c68
[ 203.334320] 9c60: 7f533090 7f532424 8060faa0 807a93e0 b8cac420 7f533040 b96a9cac b96a9c88
[ 203.342621] 9c80: 8060fd8c 7f53304c b8cac420 80d1b354 00000000 00000000 7f535060 00000015
[ 203.350922] 9ca0: b96a9cd4 b96a9cb0 8055773c 8060faf0 7f535060 b96a9d20 b8cac420 00000001
[ 203.359223] 9cc0: 80d1b330 00000000 b96a9cf4 b96a9cd8 8055798c 8055752c 00000000 b96a9d20
[ 203.367524] 9ce0: 805578cc 00000001 b96a9d1c b96a9cf8 80555a0c 805578d8 b9dfcd6c b8cdfab8
[ 203.375827] 9d00: b8cac420 b8cac420 b8cac454 80c6b900 b96a9d44 b96a9d20 805573d4 80555998
[ 203.384129] 9d20: b8cac420 00000001 b8cac428 b8cac420 80c6b900 b8cac420 b96a9d54 b96a9d48
[ 203.392431] 9d40: 80557a0c 80557320 b96a9d74 b96a9d58 805568d0 805579fc b8cac428 00000000
[ 203.400733] 9d60: b8d64068 b8cac420 b96a9db4 b96a9d78 8055487c 80556848 b96a9d9c b96a9d88
[ 203.409035] 9d80: 80563894 80160fd4 b8cac420 b8cac420 b96a9e10 b8cac404 b8d64068 b8cac420
[ 203.417337] 9da0: 00000000 b84cfc90 b96a9dcc b96a9db8 80554af0 8055452c b8cac400 b96a9e10
[ 203.425639] 9dc0: b96a9dfc b96a9dd0 80610b78 80554ad8 807ad8ec 807acf4c b8d64068 b8c1c180
[ 203.433941] 9de0: 00000012 b8d64028 b8c1c18c b8c1c180 b96a9e6c b96a9e00 80610ef0 80610a3c
[ 203.442244] 9e00: b96a9e5c b96a9e10 801612e4 0a7b567c 68737461 34303261 6332692d 00000000
[ 203.450544] 9e20: 00000000 00640000 00000000 00000000 00000000 00000000 00000000 00000000
[ 203.458846] 9e40: 00000000 00000000 014000c0 80610e10 b84cfc80 00000000 00000000 b96a9f78
[ 203.467147] 9e60: b96a9e84 b96a9e70 80551a1c 80610e1c 805519f4 b84cfc80 b96a9e9c b96a9e88
[ 203.475449] 9e80: 803196d4 80551a00 00000012 b84cfc80 b96a9ed4 b96a9ea0 80318d34 80319698
[ 203.483750] 9ea0: 00000000 00000000 80123c28 b8e1cf00 80318c58 7efe3c04 b96a9f78 b96a9f78
[ 203.492051] 9ec0: 00000012 00000004 b96a9f44 b96a9ed8 8029908c 80318c64 b96a9efc b96a9ee8
[ 203.500353] 9ee0: 801014ec 80175bac 801c61c0 8029940c 00000001 b8c4a848 00000002 801fc680
[ 203.508656] 9f00: 00000004 00000000 00000000 8029b0e4 00000000 b96d2180 b96a9f44 b96a9f28
[ 203.516956] 9f20: 8029b0e4 00000012 b8e1cf00 7efe3c04 b96a9f78 00000000 b96a9f74 b96a9f48
[ 203.525258] 9f40: 80299354 80299060 801c6270 802ba54c b8e1cf00 b8e1cf00 00000000 00000000
[ 203.533559] 9f60: 7efe3c04 00000012 b96a9fa4 b96a9f78 80299598 802992ac 00000000 00000000
[ 203.541860] 9f80: 00000070 7efe3c04 007f2190 00000004 80108324 b96a8000 00000000 b96a9fa8
[ 203.550162] 9fa0: 801082f8 80299558 00000070 7efe3c04 00000003 7efe3c04 00000012 00000000
[ 203.558462] 9fc0: 00000070 7efe3c04 007f2190 00000004 00000012 00000012 7efe3c04 00000002
[ 203.566764] 9fe0: 00000004 7efe3b40 76ed9a5b 76e66c46 60010030 00000003 00000000 00000000
[ 203.575097] [<7f532484>] (atsha204_i2c_wakeup [atsha204_i2c]) from [<7f533090>] (atsha204_i2c_probe+0x50/0xfc0 [atsha204_i2c])
[ 203.586672] [<7f533090>] (atsha204_i2c_probe [atsha204_i2c]) from [<8060fd8c>] (i2c_device_probe+0x2a8/0x2c8)
[ 203.596747] [<8060fd8c>] (i2c_device_probe) from [<8055773c>] (driver_probe_device+0x21c/0x2e8)
[ 203.605586] [<8055773c>] (driver_probe_device) from [<8055798c>] (__device_attach_driver+0xc0/0xe4)
[ 203.614774] [<8055798c>] (__device_attach_driver) from [<80555a0c>] (bus_for_each_drv+0x80/0xa4)
[ 203.623697] [<80555a0c>] (bus_for_each_drv) from [<805573d4>] (__device_attach+0xc0/0x124)
[ 203.632091] [<805573d4>] (__device_attach) from [<80557a0c>] (device_initial_probe+0x1c/0x20)
[ 203.640750] [<80557a0c>] (device_initial_probe) from [<805568d0>] (bus_probe_device+0x94/0x9c)
[ 203.649497] [<805568d0>] (bus_probe_device) from [<8055487c>] (device_add+0x35c/0x5ac)
[ 203.657537] [<8055487c>] (device_add) from [<80554af0>] (device_register+0x24/0x28)
[ 203.665314] [<80554af0>] (device_register) from [<80610b78>] (i2c_new_device+0x148/0x2d0)
[ 203.673622] [<80610b78>] (i2c_new_device) from [<80610ef0>] (i2c_sysfs_new_device+0xe0/0x1d0)
[ 203.682279] [<80610ef0>] (i2c_sysfs_new_device) from [<80551a1c>] (dev_attr_store+0x28/0x34)
[ 203.690851] [<80551a1c>] (dev_attr_store) from [<803196d4>] (sysfs_kf_write+0x48/0x54)
[ 203.698895] [<803196d4>] (sysfs_kf_write) from [<80318d34>] (kernfs_fop_write+0xdc/0x1c0)
[ 203.707202] [<80318d34>] (kernfs_fop_write) from [<8029908c>] (__vfs_write+0x38/0x138)
[ 203.715242] [<8029908c>] (__vfs_write) from [<80299354>] (vfs_write+0xb4/0x1c8)
[ 203.722664] [<80299354>] (vfs_write) from [<80299598>] (SyS_write+0x4c/0xa0)
[ 203.729826] [<80299598>] (SyS_write) from [<801082f8>] (__sys_trace_return+0x0/0x10)
[ 203.737689] Code: e55b4020 e3a01008 e3a03000 e3a02001 (e1d0c0b0)
[ 203.743914] ---[ end trace b459a7b939560dd9 ]---
Segmentation fault
root@raspberrypi3:/lib/modules/4.14.87/kernel/drivers/misc#
Let me know the issue here.
Thanks in advance.
Regards,
Ramya
Title says it all.
The device doesn't have a public API so remove the header file. Also, re-organize function prototypes.
Migrate install.sh to a make test
target in Makefile.
Currently, the handle for the i2c_client
for the random interface is a global variable. This should not be this way.
Read needs to accept single byte, or reads less than the msg length, reads. Currently it is assumed that the user will request >= the data available. However, the user may not know how much data is returned in a response.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.