Henneberg-Systemdesign / cp2130

Linux kernel driver for Silicon Labs CP2130 USB-SPI bridge
15 stars 12 forks source link

How to install it? #44

Open nandni22jain opened 2 years ago

nandni22jain commented 2 years ago

Hi, I am pretty new to Linux and not able to understand how to install this. I did:

  1. git clone https://github.com/Henneberg-Systemdesign/cp2130.git
  2. make -C /lib/modules/uname -r/build M=$PWD which gave me an error: make[1]: No rule to make target '/lib/modules/Makefile'. Stop. make: [Makefile:1849: /lib/modules] Error 2

It will be a great help if anyone can anyone provide the steps to follow which can help me installing it. Thanks in advance

jh-hsd commented 2 years ago

Unfortunately the text view of the message does not show the details to me. For general Posix shells it should be something like make -C /lib/modules/$(uname -r) /build M=$PWD The error looks as if uname -r did not give you a directory. Did you install the packet for the kernel headers? Which distribution do you use?

Btw., be aware that the CP2130 is deprecated and you cannot order it anymore AFAIK.

nandni22jain commented 2 years ago

Yes, I installed the Kernel headers and I am using Ubuntu distribution.

After building and installing the driver, when we emulated the device the dmesg showed the following error: [175898.470235] cp2130 probe [175898.470268] usb 1-1: failed to read gpios [175898.490199] usb 1-1: failed to read gpios ...

The driver is not also visible in /lib/modules/5.11.0-1027-aws/kernel/drivers/usb/serial/ location.

  1. How should I sort the gpio error?
  2. How to get driver visible in the kernel driver location?

I am trying to emulate cp2130 and want the driver for the same.

jh-hsd commented 2 years ago

Ok. So build works. And the driver has been loaded. Did you configure the driver via the sysfs hooks as described in the README? Really, you will have a hard time to get the driver working without understanding how to setup things and without being able to read some information from the driver code. If you just build a hardware that emulates the CP2130 it might be better to talk to the driver using libusb and simulate everything from there. You will also be able to understand errors from your hardware emulation.

nandni22jain commented 2 years ago

No, I didn't configure the driver via the sysfs hooks as described in the README because I am not getting how to do it.

I am trying to understand the code. I am not building a hardware to emulate cp2130 instead emulating it as shown in this link https://unix.stackexchange.com/questions/338026/centos-how-to-emulate-a-usb-flashdrive/686568#686568 . The driver is getting attached to the emulated usb which can be verified through usb-devices but:

  1. There is no .ko file in /lib/modules/'uname -r'/kernel/drivers/usb/serial/ location
  2. The dmesg is showing failed to read gpios error
  3. It is not creating a folder in dev for that USB

Help will be highly appreciated. Please look into in and suggest what can be done.

jh-hsd commented 2 years ago

The usage of sysfs API is explained in the README. You load your SPI chip (the one that is attached to CP2130 SPI bus) with the chip parameters through the sysfs API. I am not sure which ko file you are looking for. If you use out-of-tree build the ko file is build in the cp2130 checkout directory. Ignore the dmesg for now. I do not fully understand your 'emulation' useing real hardware as the CP2130. Which chip do you attach to the SPI bus of the CP2130?

nandni22jain commented 2 years ago

Hii, Can I please connect with you personally? Because there is surely communication problem. I am still stuck at it. What I require is *cp2130* directory in /sys/class/ with dev, event, subsystem, power, usb_path as subdirectories inside cp2130-0 or cp2130-1.

On Mon, Feb 7, 2022 at 11:30 AM Jochen Henneberg @.***> wrote:

The usage of sysfs API is explained in the README. You load your SPI chip (the one that is attached to CP2130 SPI bus) with the chip parameters through the sysfs API. I am not sure which ko file you are looking for. If you use out-of-tree build the ko file is build in the cp2130 checkout directory. Ignore the dmesg for now. I do not fully understand your 'emulation' useing real hardware as the CP2130. Which chip do you attach to the SPI bus of the CP2130?

— Reply to this email directly, view it on GitHub https://github.com/Henneberg-Systemdesign/cp2130/issues/44#issuecomment-1031101711, or unsubscribe https://github.com/notifications/unsubscribe-auth/APPMKGRZULKVYNMT2LX4LSDUZ5NW3ANCNFSM5MXQL66Q . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you authored the thread.Message ID: @.***>

jh-hsd commented 2 years ago

Hi, my email address is available from the github website. Sure you can. However, I am very busy right now and I don't think this will change soon. Sorry for the sparse replies.