Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RTR frames to TCP messages #24

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

Vasili-Sk
Copy link

added < rtr %x %d.%d> message for received Remote transfer request messages in raw mode
added < sendrtr %x > to send RTR message
a little bit formatted files with eclipse CDT formatter

p.s. code needs optimisation... remove same used parts of code, make something like can_message_decode/encode to parse text. Too much same used code.

p.p.s. barely tested. However raspberry pi successfully sends rtr messages over tcp

@marckleinebudde
Copy link
Member

Hey @Vasili-Sk, thanks for contributing.

  • Please do the code reformating in a separate patch
  • The patch description of your second patch is a bit vague, please describe which problem you're fixing.

Thanks,
Marc

@Vasili-Sk
Copy link
Author

Can i somehow edit changes here or need to make a new request?

@marckleinebudde
Copy link
Member

You can force push your modified or rebased branch over the existing one, add the --force option to your git push command.

@Vasili-Sk
Copy link
Author

Formatting removed in last commit, please check

@marckleinebudde
Copy link
Member

The idea of re-formating the code is a good one, but please do either no reformating at all, or do the reformating in one patch and no other changes. Usually the first one.

socketcandcl.c Show resolved Hide resolved
@Vasili-Sk
Copy link
Author

i have no idea how to, other than wiping my fork and making it from scratch :P

@marckleinebudde
Copy link
Member

Check if this branch still works: https://github.com/marckleinebudde/socketcand/tree/vasili-sk/socketcand

@Vasili-Sk
Copy link
Author

Looks ok so far
image

@marckleinebudde
Copy link
Member

Can you take care of not setting the DLC to 0 in RTR frames?

@Vasili-Sk
Copy link
Author

Do you want to set it manually?

@marckleinebudde
Copy link
Member

No, please extend the protocol to transfer the DLC of RTR messages.
Update the protocol description (https://github.com/linux-can/socketcand/blob/master/doc/protocol.md) too.

cd socketcand
sudo ./autogen.sh
sudo ./configure
sudo make
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no sudo for those above needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for ssh needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or for sd card access. i dont know, other way it throws errors

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, only use sudo make install all others don't need root permission.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see where the problem is. Don't change to /boot. You can directly start the git clone in your home directory.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't do this in /boot

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why s that? its easy to copypaste files from my windows machine

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under Linux /boot is for booting the system. A mistake there might lead to an unbootable system. This is why normal users don't have write permission there. Your home directory is where you can and should do your things.

After=server.service multi-user.target

[Service]
ExecStart=
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need the empty line? What about adding the .service file to the git repo?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i have no idea! its a linux magic

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need that empty line.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in this case this thing gonna yell at me that im passing arguments in excutable.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does it say exactly?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you get this error message you might have a drop-in file in /etc/systemd/system/socketcand.service.d/, which has an ExecStart= aswell. You only want /etc/systemd/system/socketcand.service (or /etc/systemd/system/[email protected], see other comment).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what makes my option more noob proof.
how normal user should know all this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Proper instructions are a good starting point to learn more, if someone is interested.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can update it in a commit


After that you may want to make it run on boot as service, run this command to edit it

sudo systemctl edit --force --full socketcand.service
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please name the file [email protected]


[Service]
ExecStart=
ExecStart=-/usr/local/bin/socketcand -i can0
Copy link
Member

@marckleinebudde marckleinebudde Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use %I instead of can0

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Man i described the way it worked. it took me half day long to make it work. i dont want to try over again

Try to start it with

sudo systemctl daemon-reload
sudo systemctl start socketcand.service
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudo systemctl start [email protected]

Note that it should say 'can0' and not 'vcan0'.
If everything ok so far, what is quite suprisingly, then run this command to activate service on boot.

sudo systemctl enable socketcand.service
Copy link
Member

@marckleinebudde marckleinebudde Oct 26, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sudo systemctl enable [email protected]


[Unit]
Description=CAN ethernet
After=server.service multi-user.target
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After=multi-user.target and WantedBy=multi-user.target looks wrong

What about:

After=network.target
After=sys-subsystem-net-devices-%i.device
BindsTo=sys-subsystem-net-devices-%i.device

@Vasili-Sk
Copy link
Author

Okay guide updated. DLC code also added.

@marckleinebudde
Copy link
Member

It would have been good to place your changes ontop of my cleaned up branch....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants