68byte 라서,17 개의 float 데이터 일 것 같은데 매칭되는게 없어 보이네?

 

가장 처음꺼는 timestamp 같은데

가장 마지막의 ToCA는 먼지 모르겠고..

float 형으로 해도 int 형으로 해도 먼가 의미를 지니는 패킷을 찾긴 쉽지 않네..

68 received, 343 sizeof(FORZA_DASH)

0D A9 01 00 90 B3 A2 3F EB B4 CA 3D 94 9B 23 BF 
1A BA 3B 40 2B 3A E4 3D E8 46 E5 3F A1 BE E9 BF 
7F 16 E1 3E ED 9A 23 C1 27 43 06 BF 64 1A 84 C0 
AA 38 EF BF 00 C3 E7 FA 0E 13 2C FE 00 2D A6 08 
54 6F 43 41 
--------------
108813 0.000000
1067627408 1.271105
1036694763 0.098978
-1088185452 -0.639093
1077656090 2.933234
1038367275 0.111439
1071990504 1.791226
-1075200351 -1.826130
1054938751 0.439625
-1054631187 -10.225324
-1090108633 -0.524462
-1065084316 -4.128222
-1074841430 -1.868917
-85474560 -601687822097128628961607183025307648.000000
-30665970 -57181538217263035746945707264998113280.000000
145108224 0.000000
1094938452 12.214680

[링크 : https://github.com/gabrielgouv/dirt-rally-telemetry-dashboard/blob/main/src/main/java/com/github/gabrielgouv/dr2td/model/TelemetryData.java]

[링크 : https://github.com/ozkar99/cm-telemetry/blob/master/src/dirt/rally2.rs]

[링크 : https://docs.google.com/spreadsheets/d/1eA518KHFowYw7tSMa-NxIFYpiWe5JXgVVQ_IMs7BVW0/edit?gid=0#gid=0]

'모종의 음모 > force feedback' 카테고리의 다른 글

f1 2015 telemetry udp  (0) 2024.12.08
forza horizon 4 telemetry 수정  (0) 2024.12.07
forza telemetry  (0) 2024.12.02
forza horizon 4, 리눅스용 c언어 대시보드  (0) 2024.11.30
forza horizon 4 data format  (0) 2024.11.20
Posted by 구차니

문득 애니메이션 사이코패스가 떠오른다.

집단의 사이코패스 측정은 거부하고 있다가

적을 처벌하기 위해서 집단의 사이코패스를 측정하게 되었고

그걸 위해 집단내 사이코패스를 올리게 되는 구성원을 제거하여 집단의 사이코패스를 낮춘다는 내용

애니메이션에서는 그 안의 순수한 사람들도 구성원이라는 이유로 처벌을 받을수 있기에 위험할수 있다면서 경고를 하지만

 

지금의 현실에서

문제가 있는 집단에서 문제가 있는 사람 몇을 처리했다고 문제가 없는 집단이 될 수 있는가

문제가 있는 사람을 처리했다는 관점에서 조직의 이익을 위해 개인의 선택권등을 침해했는데 그렇다면

그걸 처리했다고 해서 집단이 문제가 없는 것이 될 수 있는가? 라는 새로운 고민이 들어나게 된다.

 

 

‘尹 대통령 탈당’ 요구한 한동훈… 역대 대통령 사례 살펴보니

[링크 : https://biz.chosun.com/policy/politics/2024/12/04/W7CXCLJHGJBQZGGOGSX7YSHO4I/]

 

 

윤석열 대통령, 조기 퇴진 선언 “국정에서 완전히 손 떼겠다”

[링크 : https://v.daum.net/v/20241208115544887]

 

'탄핵 무산'시킨 국힘 "한 번 더 지켜달라" 읍소

 

[링크 : https://v.daum.net/v/20241208145703998]

 

포브스 인정(?)

"尹, '코리아 디스카운트' 옳다는 것 증명…잃어버린 10년 돌입"

[링크 : https://m.news.nate.com/view/20241208n03824]

'개소리 왈왈 > 정치관련 신세한탄' 카테고리의 다른 글

탄핵안 가결  (4) 2024.12.14
대통령 출국금지...?!  (1) 2024.12.09
너무 나갔다~ -> 헐.. 미친 사실이었어?  (1) 2024.12.04
비상 계엄 선포?  (0) 2024.12.03
니들이 무급으로 가덩가  (2) 2024.09.25
Posted by 구차니

빌드하려고 vs2022 부터 다시 깔고 쑈하긴 했는데

아무튼 기어가 올라오긴 한다.

 

서버는 자기 자신의 아이피를 넣고(0.0.0.0을 넣으면 되려나?) 포트를 게임에서 설정한대로 하면 끝

 

이 녀석의 구조체를 뜯어 봐야 겠구만?

[링크 : https://github.com/geeooff/forza-data-web]

 

 

다시 원점으로 돌아가서 하나하나 길이 맞추면서 보니까 먼가 12바이트가 추가되어 있었다.

01 00 00 00 // S32 IsRaceOn;

87 65 A8 14 // U32 TimestampMS;
FB 6F 14 46 // F32 EngineMaxRpm;
F8 FF 47 44 // F32 EngineIdleRpm;
D9 18 0A 45 // F32 CurrentEngineRpm;

C0 FC 1B BD // F32 AccelerationX;
90 AB 60 3D 
6C 00 D9 40 

88 EA A9 BD // F32 VelocityX;
E8 EF 9D BC 
83 62 9B 40 

5D F5 9C 3B // F32 AngularVelocityX;
16 7C 65 BC 
E9 09 D0 BC 

7E D0 B0 BF // F32 Yaw;
F2 E8 B1 BE 
AA F7 69 3E 

FA 31 DB 3E // F32 NormalizedSuspensionTravelFrontLeft
CE 72 B3 3E 
A4 DD F8 3E 
3F 6E 03 3F 

FB 1B 71 3F // F32 TireSlipRatioFrontLeft
07 85 59 3F 
A2 BE 10 3F 
4F 86 29 3F 

39 74 A3 41 // F32 WheelRotationSpeedFrontLeft
CC 09 8C 41 
BC CC 81 41 
C2 F8 85 41 

00 00 00 00 // S32 WheelOnRumbleStripFrontLeft
00 00 00 00 
00 00 00 00 
00 00 00 00 

00 00 00 00 // F32 WheelInPuddleDepthFrontLeft
00 00 00 00 
00 00 00 00 
00 00 00 00 

99 99 19 3F // F32 SurfaceRumbleFrontLeft
99 99 19 3F 
99 99 19 3F
99 99 19 3F

34 3F DD 3D // F32 TireSlipAngleFrontLeft
34 C6 E3 3D 
0F 9A 97 3D 
35 FA 99 3D 

B2 B0 72 3F  // F32 TireCombinedSlipFrontLeft
06 60 5B 3F 
DA FA 11 3F 
20 9D 2A 3F 

1E A2 B0 BB // F32 SuspensionTravelMetersFrontLeft
5C 44 3D BC 
00 E9 9A 3A 
80 C3 54 3B 

89 0D 00 00 // S32 CarOrdinal
04 00 00 00 // S32 CarClass
84 03 00 00 // S32 CarPerformanceIndex
02 00 00 00 // S32 DrivetrainType - // 0 = FWD, 1 = RWD, 2 = AWD

0C 00 00 00 // S32 NumCylinders
0D 00 00 00 // ?? 
00 00 00 00 // ??
00 00 00 00 // ??

EC C6 18 C4 // F32 PositionX; 
33 08 20 43 // F32 PositionY; 
40 A0 1C C5 // F32 PositionZ; 
A1 68 9B 40 // F32 Speed; 
F4 5F 03 48 // F32 Power; 
23 DF 11 44 // F32 Torque; 
20 4C 9C 42 // F32 TireTempFrontLeft; 
0D 43 9D 42 // F32 TireTempFrontRight; 
9B FD A9 42 // F32 TireTempRearLeft; 
9B FD A9 42 // F32 TireTempRearRight; 
00 00 00 00 // F32 Boost; 
00 00 80 3F // F32 Fuel; 
00 00 00 00 // F32 DistanceTraveled; 
00 00 00 00 // F32 BestLap; 
00 00 00 00 // F32 LastLap;
00 00 00 00 // F32 CurrentLap;
C8 AF FB 43 // F32 CurrentRaceTime;
00 00       // U16 LapNumber;
00          // U8 RacePosition;
FF          // U8 Accel;
00          // U8 Brake;
00          // U8 Clutch;
00          // U8 HandBrake;
01          // U8 Gear;
00          // S8 Steer;
00          // S8 NormalizedDrivingLine;
00          // S8 NormalizedAIBrakeDifference;
00          // ???

 

sled 구조체에서 Steer 이후에 24bit는 원래의 구조체와는 다른 것 같네

아무튼 아래와 같이 값들이 정상적으로 출력되는 것 확인!

 

소스코드

더보기
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <ncurses.h>

 

#define BUF_SIZE 500

 

typedef char S8;
typedef unsigned char U8;
typedef unsigned short U16;
typedef int S32;
typedef unsigned int U32;
typedef float F32;

 

typedef struct _sled_
{
// = 1 when race is on. = 0 when in menus/race stopped …
S32 IsRaceOn;

 

// Can overflow to 0 eventually
U32 TimestampMS;
F32 EngineMaxRpm;
F32 EngineIdleRpm;
F32 CurrentEngineRpm;

 

// In the car's local space; X = right, Y = up, Z = forward
F32 AccelerationX;
F32 AccelerationY;
F32 AccelerationZ;

 

// In the car's local space; X = right, Y = up, Z = forward
F32 VelocityX;
F32 VelocityY;
F32 VelocityZ;

 

// In the car's local space; X = pitch, Y = yaw, Z = roll
F32 AngularVelocityX;
F32 AngularVelocityY;
F32 AngularVelocityZ;

 

F32 Yaw;
F32 Pitch;
F32 Roll;

 

// Suspension travel normalized: 0.0f = max stretch; 1.0 = max compression
F32 NormalizedSuspensionTravelFrontLeft;
F32 NormalizedSuspensionTravelFrontRight;
F32 NormalizedSuspensionTravelRearLeft;
F32 NormalizedSuspensionTravelRearRight;

 

// Tire normalized slip ratio, = 0 means 100% grip and |ratio| > 1.0 means loss of grip.
F32 TireSlipRatioFrontLeft;
F32 TireSlipRatioFrontRight;
F32 TireSlipRatioRearLeft;
F32 TireSlipRatioRearRight;

 

// Wheels rotation speed radians/sec.
F32 WheelRotationSpeedFrontLeft;
F32 WheelRotationSpeedFrontRight;
F32 WheelRotationSpeedRearLeft;
F32 WheelRotationSpeedRearRight;

 

// = 1 when wheel is on rumble strip, = 0 when off.
S32 WheelOnRumbleStripFrontLeft;
S32 WheelOnRumbleStripFrontRight;
S32 WheelOnRumbleStripRearLeft;
S32 heelOnRumbleStripRearRight;

 

// = from 0 to 1, where 1 is the deepest puddle
F32 WheelInPuddleDepthFrontLeft;
F32 WheelInPuddleDepthFrontRight;
F32 WheelInPuddleDepthRearLeft;
F32 WheelInPuddleDepthRearRight;

 

// Non-dimensional surface rumble values passed to controller force feedback
F32 SurfaceRumbleFrontLeft;
F32 SurfaceRumbleFrontRight;
F32 SurfaceRumbleRearLeft;
F32 SurfaceRumbleRearRight;

 

// Tire normalized slip angle, = 0 means 100% grip and |angle| > 1.0 means loss of grip.
F32 TireSlipAngleFrontLeft;
F32 TireSlipAngleFrontRight;
F32 TireSlipAngleRearLeft;
F32 TireSlipAngleRearRight;

 

// Tire normalized combined slip, = 0 means 100% grip and |slip| > 1.0 means loss of grip.
F32 TireCombinedSlipFrontLeft;
F32 TireCombinedSlipFrontRight;
F32 TireCombinedSlipRearLeft;
F32 TireCombinedSlipRearRight;

 

// Actual suspension travel in meters
F32 SuspensionTravelMetersFrontLeft;
F32 SuspensionTravelMetersFrontRight;
F32 SuspensionTravelMetersRearLeft;
F32 SuspensionTravelMetersRearRight;

 

// Unique ID of the car make/model
S32 CarOrdinal;

 

// Between 0 (D -- worst cars) and 7 (X class -- best cars) inclusive
S32 CarClass;

 

// Between 100 (worst car) and 999 (best car) inclusive
S32 CarPerformanceIndex;

 

// 0 = FWD, 1 = RWD, 2 = AWD
S32 DrivetrainType;

 

// Number of cylinders in the engine
S32 NumCylinders;
} __attribute__((packed)) FORZA_SLED;

 

typedef struct _dash_
{
// = 1 when race is on. = 0 when in menus/race stopped …
S32 IsRaceOn;

 

// Can overflow to 0 eventually
U32 TimestampMS;
F32 EngineMaxRpm;
F32 EngineIdleRpm;
F32 CurrentEngineRpm;

 

// In the car's local space; X = right, Y = up, Z = forward
F32 AccelerationX;
F32 AccelerationY;
F32 AccelerationZ;

 

// In the car's local space; X = right, Y = up, Z = forward
F32 VelocityX;
F32 VelocityY;
F32 VelocityZ;

 

// In the car's local space; X = pitch, Y = yaw, Z = roll
F32 AngularVelocityX;
F32 AngularVelocityY;
F32 AngularVelocityZ;

 

F32 Yaw;
F32 Pitch;
F32 Roll;

 

// Suspension travel normalized: 0.0f = max stretch; 1.0 = max compression
F32 NormalizedSuspensionTravelFrontLeft;
F32 NormalizedSuspensionTravelFrontRight;
F32 NormalizedSuspensionTravelRearLeft;
F32 NormalizedSuspensionTravelRearRight;

 

// Tire normalized slip ratio, = 0 means 100% grip and |ratio| > 1.0 means loss of grip.
F32 TireSlipRatioFrontLeft;
F32 TireSlipRatioFrontRight;
F32 TireSlipRatioRearLeft;
F32 TireSlipRatioRearRight;

 

// Wheels rotation speed radians/sec.
F32 WheelRotationSpeedFrontLeft;
F32 WheelRotationSpeedFrontRight;
F32 WheelRotationSpeedRearLeft;
F32 WheelRotationSpeedRearRight;

 

// = 1 when wheel is on rumble strip, = 0 when off.
S32 WheelOnRumbleStripFrontLeft;
S32 WheelOnRumbleStripFrontRight;
S32 WheelOnRumbleStripRearLeft;
S32 heelOnRumbleStripRearRight;

 

// = from 0 to 1, where 1 is the deepest puddle
F32 WheelInPuddleDepthFrontLeft;
F32 WheelInPuddleDepthFrontRight;
F32 WheelInPuddleDepthRearLeft;
F32 WheelInPuddleDepthRearRight;

 

// Non-dimensional surface rumble values passed to controller force feedback
F32 SurfaceRumbleFrontLeft;
F32 SurfaceRumbleFrontRight;
F32 SurfaceRumbleRearLeft;
F32 SurfaceRumbleRearRight;

 

// Tire normalized slip angle, = 0 means 100% grip and |angle| > 1.0 means loss of grip.
F32 TireSlipAngleFrontLeft;
F32 TireSlipAngleFrontRight;
F32 TireSlipAngleRearLeft;
F32 TireSlipAngleRearRight;

 

// Tire normalized combined slip, = 0 means 100% grip and |slip| > 1.0 means loss of grip.
F32 TireCombinedSlipFrontLeft;
F32 TireCombinedSlipFrontRight;
F32 TireCombinedSlipRearLeft;
F32 TireCombinedSlipRearRight;

 

// Actual suspension travel in meters
F32 SuspensionTravelMetersFrontLeft;
F32 SuspensionTravelMetersFrontRight;
F32 SuspensionTravelMetersRearLeft;
F32 SuspensionTravelMetersRearRight;

 

// Unique ID of the car make/model
S32 CarOrdinal;

 

// Between 0 (D -- worst cars) and 7 (X class -- best cars) inclusive
S32 CarClass;

 

// Between 100 (worst car) and 999 (best car) inclusive
S32 CarPerformanceIndex;

 

// 0 = FWD, 1 = RWD, 2 = AWD
S32 DrivetrainType;

 

// Number of cylinders in the engine
S32 NumCylinders;

 

S32 reserved1;
S32 reserved2;
S32 reserved3;

 

// add for DASH
F32 PositionX;
F32 PositionY;
F32 PositionZ;
F32 Speed;
F32 Power;
F32 Torque;
F32 TireTempFrontLeft;
F32 TireTempFrontRight;
F32 TireTempRearLeft;
F32 TireTempRearRight;
F32 Boost;
F32 Fuel;
F32 DistanceTraveled;
F32 BestLap;
F32 LastLap;
F32 CurrentLap;
F32 CurrentRaceTime;
U16 LapNumber;
U8 RacePosition;
U8 Accel;
U8 Brake;
U8 Clutch;
U8 HandBrake;
U8 Gear;
S8 Steer;
S8 NormalizedDrivingLine;
S8 NormalizedAIBrakeDifference;

 

F32 TireWearFrontLeft;
F32 TireWearFrontRight;
F32 TireWearRearLeft;
F32 TireWearRearRight;

 

// ID for track
S32 TrackOrdinal;
} __attribute__((packed)) FORZA_DASH;

 

int last_raceon = 0;
void parse_forza_dbg(unsigned char *message)
{
int row = 0;
FORZA_DASH forza;
memcpy(&forza, message, sizeof(FORZA_DASH));

 

for(int i = 0; i < 324; i++)
{
if(i % 16 == 0)
printf("\n");
printf("%02X ",message[i]);
}
printf("\n");

 

printf("NumCylinders %d\n", forza.NumCylinders);
 
printf("PositionX %f\n", forza.PositionX);
printf("PositionY %f\n", forza.PositionY);
printf("PositionZ %f\n", forza.PositionZ);

 

printf("speed %f\n", forza.Speed);

 

printf("clutch %d\n", forza.Clutch);
printf("brake %d\n", forza.Brake);
printf("accel %d\n", forza.Accel);
printf("HandBrake %d\n", forza.HandBrake);
}

 

void parse_forza(unsigned char *message)
{
int row = 0;
FORZA_DASH forza;
memcpy(&forza, message, sizeof(FORZA_DASH));

 

static unsigned int pack_cnt = 0;

 

if(last_raceon != forza.IsRaceOn)
{
clear();
last_raceon = forza.IsRaceOn;
}

 

if(forza.IsRaceOn)
{
mvprintw(row++, 0, "let's fly %d\n",pack_cnt++);

 

mvprintw(row++, 0, "RPM %.0f / %.0f", forza.CurrentEngineRpm, forza.EngineMaxRpm);

 

mvprintw(row++, 0, "acc X %f", forza.AccelerationX);
mvprintw(row++, 0, "acc Y %f", forza.AccelerationY);
mvprintw(row++, 0, "acc Z %f", forza.AccelerationZ);

 

mvprintw(row++, 0, "vel X %f", forza.VelocityX);
mvprintw(row++, 0, "vel Y %f", forza.VelocityY);
mvprintw(row++, 0, "vel Z %f", forza.VelocityZ);

 

mvprintw(row++, 0, "ang vel X %f", forza.AngularVelocityX);
mvprintw(row++, 0, "ang vel Y %f", forza.AngularVelocityY);
mvprintw(row++, 0, "ang vel Z %f", forza.AngularVelocityZ);
 
mvprintw(row++, 0, "yaw %f", forza.Yaw);
mvprintw(row++, 0, "roll %f", forza.Pitch);
mvprintw(row++, 0, "pitch %f", forza.Roll);

 

mvprintw(row++, 0, "CarOrdinal %5d", forza.CarOrdinal);
mvprintw(row++, 0, "CarClass %5d", forza.CarClass);
mvprintw(row++, 0, "CarPerformanceIndex %5d", forza.CarPerformanceIndex);
mvprintw(row++, 0, "DrivetrainType %5d", forza.DrivetrainType);
mvprintw(row++, 0, "NumCylinders %5d", forza.NumCylinders);

 

mvprintw(row++, 0, "clutch[%3d] brake[%3d] accel[%3d] handbrake[%3d] gear[%2d] Steer[%3d]"
, forza.Clutch
, forza.Brake
, forza.Accel
, forza.HandBrake
, forza.Gear
, forza.Steer
);

 

mvprintw(row++, 0, "Speed[%5.0f] Power[%7.0f] Torque[%5.0f] Boost[%5.0f] Fuel[%5.0f]"
, forza.Speed
, forza.Power
, forza.Torque
, forza.Boost
, forza.Fuel
);

 

mvprintw(row++, 0, "Position %f , %f , %f"
, forza.PositionX
, forza.PositionY
, forza.PositionZ
);
}
else mvprintw(row++, 0, "pause");

 

refresh();
}

 

void error_handling(char *message);

 

int main(int argc, char *argv[]){
int serv_sock;
char message[BUF_SIZE];
int str_len;
socklen_t clnt_adr_sz;

 

struct sockaddr_in serv_adr, clnt_adr;

 

printf("%d sizeof(FORZA_SLED)\n", sizeof(FORZA_SLED));
printf("%d sizeof(FORZA_DASH)\n", sizeof(FORZA_DASH));

 

if(argc!=2){
printf("Usage:%s <port>\n", argv[0]);
exit(1);
}

 

serv_sock = socket(PF_INET, SOCK_DGRAM, 0);
if(serv_sock == -1)
error_handling("UDP socket creation error");

 

memset(&serv_adr, 0, sizeof(serv_adr));
serv_adr.sin_family=AF_INET;
serv_adr.sin_addr.s_addr=htonl(INADDR_ANY);
serv_adr.sin_port=htons(atoi(argv[1]));

 

if(bind(serv_sock, (struct sockaddr*)&serv_adr, sizeof(serv_adr)) == -1)
error_handling("bind() error");
 
initscr();

 

while(1){
clnt_adr_sz = sizeof(clnt_adr);
str_len = recvfrom(serv_sock, message, BUF_SIZE, 0, (struct sockaddr*)&clnt_adr, &clnt_adr_sz);
message[str_len] = 0x00;
// printf("%d received [%s]\n", str_len, message);
// printf("%d received, %d sizeof(FORZA_DASH)\n", str_len, sizeof(FORZA_DASH));
parse_forza(message);
// parse_forza_dbg(message);
sendto(serv_sock, message, str_len, 0, (struct sockaddr*)&clnt_adr, clnt_adr_sz);
}
close(serv_sock);
return 0;
}

 

void error_handling(char *message){
fputs(message, stderr);
fputc('\n', stderr);

 

endwin();
exit(1);
}




'모종의 음모 > force feedback' 카테고리의 다른 글

f1 2015 telemetry udp  (0) 2024.12.08
dirt rally 2.0 telemetry udp  (0) 2024.12.08
forza telemetry  (0) 2024.12.02
forza horizon 4, 리눅스용 c언어 대시보드  (0) 2024.11.30
forza horizon 4 data format  (0) 2024.11.20
Posted by 구차니

오른발이 아파서 걷기가 힘들어서 병원가보니 그게 원인이랜다 ㅠㅠ  

저번 다리 수술한 것 부터 생소한 부분만(?) 다치는 느낌인디...

 

부주상골이라고 불필요한(?) 뼈가 있다는데

주상골에서 떨어져 있어서 그게 움직이는 위치 마다 걷지도 못하게 아프기도 하다고

주사를 맞던가

체외충격파를 하던가

물리치료를 해서 오래 걸리던가

 

수술하는 경우는 거의 없다고 하는데.. 에이 설마.. 아니겠지?

'개소리 왈왈 > 직딩의 비애' 카테고리의 다른 글

지르고 싶은건 많은데  (5) 2024.12.15
외근  (0) 2024.12.12
피곤  (0) 2024.11.21
머 이런 개 뼉다구 같은 일이?  (0) 2024.11.18
두근두근 피싱전화  (0) 2024.11.15
Posted by 구차니

와우~ 크리스마스 선물 좋구만!

6시간 뒤에 공개되면 집에가서 받아야지 ㅋㅋ

(다시보니 시간이 아니라 일단위.. -_-)

 

눈누난나~

'게임 > 오리진&스팀&유플레이' 카테고리의 다른 글

아 몰라 또 질러  (0) 2024.12.22
아 몰라 질러  (1) 2024.12.17
블랙 프라이데이 할인... 흐음..  (0) 2024.12.01
오늘의 게임 다운로드  (0) 2024.11.02
게임 지름 + 선물 강요  (0) 2024.10.28
Posted by 구차니
회사일/USB PD2024. 12. 5. 14:08

개발보드 꺼내서 연결해보니 U-boot 레벨에서 20V 받아가는 것 확인.. -_-!

USB 규격 볼 바에는 이걸 보는게 빠를 듯..

[링크 : https://github.com/nxp-imx/uboot-imx/]

[링크 : https://community.nxp.com/t5/i-MX-Processors-Knowledge-Base/i-MX8MP-USB-PD-realized/ta-p/1531209]

 

아무생각없이 보고 있던 소스.. -_- mp를 봐야했나..?

[링크 : https://github.com/nxp-imx/uboot-imx/blob/lf_v2022.04/board/freescale/imx8mm_evk/imx8mm_evk.c]

 

소스를 보면 변경점이 꽤 많긴 하지만 큰 틀에서 ptn5110 쓰는건 동일해서 mm 으로 보는게 편할지도?

[링크 : https://github.com/nxp-imx/uboot-imx/blob/lf_v2022.04/board/freescale/imx8mp_evk/imx8mp_evk.c]

 

+

evk uboot 로그

U-Boot SPL 2023.04-lf_v2023.04+g49b102d988 (Nov 21 2023 - 07:28:53 +0000)
DDRINFO: start DRAM init
DDRINFO: DRAM rate 4000MTS
DDRINFO:ddrphy calibration done
DDRINFO: ddrmix config done
SEC0:  RNG instantiated
Normal Boot
Trying to boot from BOOTROM
Boot Stage: Primary boot
image offset 0x8000, pagesize 0x200, ivt offset 0x0
NOTICE:  Do not release JR0 to NS as it can be used by HAB
NOTICE:  BL31: v2.8(release):android-14.0.0_1.0.0-rc1-1-g08e9d4eef
NOTICE:  BL31: Built : 06:43:30, Nov 21 2023

                                                                                
U-Boot 2023.04-lf_v2023.04+g49b102d988 (Nov 21 2023 - 07:28:53 +0000)           
                                                                                
CPU:   i.MX8MP[8] rev1.1 1800 MHz (running at 1200 MHz)                         
CPU:   Commercial temperature grade (0C to 95C) at 25C                          
Reset cause: POR                                                                
Model: NXP i.MX8MPlus LPDDR4 EVK board                                          
DRAM:  6 GiB                                                                    
TCPC:  Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C2 0x50]                
SNK.Power3.0 on CC1                                                             
PDO 0: type 0, 5000 mV, 3000 mA [E]                                             
PDO 1: type 0, 9000 mV, 3000 mA []                                              
PDO 2: type 0, 12000 mV, 3000 mA []                                             
PDO 3: type 0, 15000 mV, 3000 mA []                                             
PDO 4: type 0, 20000 mV, 3000 mA []                                             
PDO 5: type 3, undefined                                                        
Requesting PDO 4: 20000 mV, 2250 mA                                             
Source accept request                                                           
PD source ready!                                                                
tcpc_pd_receive_message: Polling ALERT register, TCPC_ALERT_RX_STATUS bit faile2
Power supply on USB2                                                            
TCPC:  Vendor ID [0x1fc9], Product ID [0x5110], Addr [I2C1 0x50]                
Core:  257 devices, 36 uclasses, devicetree: separate                           
MMC:   FSL_SDHC: 1, FSL_SDHC: 2                                                 
Loading Environment from MMC... *** Warning - bad CRC, using default environment
                                                                                
[*]-Video Link 0adv7535_mipi2hdmi adv7535@3d: Can't find cec device id=0x3c     
fail to probe panel device adv7535@3d                                           
fail to get display timings                                                     
probe video device failed, ret -19                                              
                                                                                
        [0] lcd-controller@32e80000, video                                      
        [1] mipi_dsi@32e60000, video_bridge                                     
        [2] adv7535@3d, panel                                                   
adv7535_mipi2hdmi adv7535@3d: Can't find cec device id=0x3c                     
fail to probe panel device adv7535@3d                                           
fail to get display timings                                                     
probe video device failed, ret -19                                              
In:    serial                                                                   
Out:   serial                                                                   
Err:   serial                                                                   
SEC0:  RNG instantiated                                                         
switch to partitions #0, OK                                                     
mmc1 is current device                                                          
flash target is MMC:1                                                           
Net:   eth0: ethernet@30be0000, eth1: ethernet@30bf0000 [PRIME]                 
Fastboot: Normal                                                                
Normal Boot                                                                     
Hit any key to stop autoboot:  0                                                
Working FDT set to 43000000                                                     
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND                              
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND                              
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND                              
libfdt fdt_path_offset() returned FDT_ERR_NOTFOUND                              
starting USB...                                                                 
Bus usb@38100000: Failed to initialize board for imx8m USB                      
probe failed, error -62                                                         
Bus usb@38200000: Register 2000140 NbrPorts 2                                   
Starting the controller                                                         
USB XHCI 1.10                                                                   
scanning bus usb@38200000 for devices... 1 USB Device(s) found                  
       scanning usb for storage devices... 0 Storage Device(s) found            
                                                                                
Device 0: unknown device                                                        
switch to partitions #0, OK                                                     
mmc1 is current device                                                          
Scanning mmc 1:1...                                                             
86911 bytes read in 14 ms (5.9 MiB/s)                                           
Working FDT set to 43000000                                                     
Unable to open OP-TEE session (err=-5)                                          
mm_communicate failed!                                                          
Error: Cannot initialize UEFI sub-system, r = 3                                 
switch to partitions #0, OK                                                     
mmc2(part 0) is current device                                                  
Scanning mmc 2:1...                                                             
64669 bytes read in 1 ms (61.7 MiB/s)                                           
Working FDT set to 43000000                                                     
Error: Cannot initialize UEFI sub-system, r = 3                                 
Running BSP bootcmd ...                                                         
switch to partitions #0, OK                                                     
mmc1 is current device                                                          
Failed to load 'boot.scr'                                                       
32856576 bytes read in 372 ms (84.2 MiB/s)                                      
Booting from mmc ...                                                            
86911 bytes read in 4 ms (20.7 MiB/s)                                           
## Flattened Device Tree blob at 43000000                                       
   Booting using the fdt blob at 0x43000000                                     
Working FDT set to 43000000                                                     
clk usb_phy_root_clk already disabled                                           
   Using Device Tree in place at 0000000043000000, end 000000004301837e         
Working FDT set to 43000000                                                     
adv7535_mipi2hdmi adv7535@3d: Can't find cec device id=0x3c                     
fail to probe panel device adv7535@3d                                           
fail to get display timings                                                     
probe video device failed, ret -19                                              
                                                                                
Starting kernel ...

 

'회사일 > USB PD' 카테고리의 다른 글

linux kernel USB PD 관련 검색  (0) 2024.12.04
USB PD 용어 정리중  (0) 2024.12.03
USB PD SOP*?  (0) 2024.12.03
USB-C PTN5110 케이블 방향에 따른 데이터 차이  (0) 2024.11.27
USB PD - DRP?  (0) 2024.11.25
Posted by 구차니
프로그램 사용/busybox2024. 12. 4. 16:59

busybox에 포함된 minicom 보다 더 간략화된 통신 터미널인데

설명이 부실해서 종료하는 법을 알기 힘들다 -_-

 

ctrl-x

[링크 : https://www.armadeus.org/wiki/index.php?title=Microcom]

'프로그램 사용 > busybox' 카테고리의 다른 글

sh: line 1: kill: root: no such pid  (0) 2015.01.05
busybox su가 안될 경우  (0) 2014.12.05
busybox tftp  (0) 2013.06.18
busybox - setconsole  (0) 2011.10.21
busybox ash "cannot open /dev/ttyAS1: no such device"  (0) 2010.04.20
Posted by 구차니
Linux API/linux2024. 12. 4. 14:18

고통 받고 있는 ptn5110에 대해서 검색하는데

리눅스 소스상에 dtb로만 존재해서 문법을 찾아보는 중.

봐야할 부분은 source-pdos의 <PDO_FIXED()>; 인데

	ptn5110: tcpc@50 {
		compatible = "nxp,ptn5110", "tcpci";
		pinctrl-names = "default";
		pinctrl-0 = <&pinctrl_typec>;
		reg = <0x50>;
		interrupt-parent = <&lsio_gpio1>;
		interrupts = <3 IRQ_TYPE_LEVEL_LOW>;

		usb_con1: connector {
			compatible = "usb-c-connector";
			label = "USB-C";
			power-role = "source";
			data-role = "dual";
			source-pdos = <PDO_FIXED(5000, 3000, PDO_FIXED_USB_COMM)>;

			ports {
				#address-cells = <1>;
				#size-cells = <0>;

				port@0 {
					reg = <0>;

					typec_dr_sw: endpoint {
						remote-endpoint = <&usb3_drd_sw>;
					};
				};

				port@1 {
					reg = <1>;

					typec_con_ss: endpoint {
						remote-endpoint = <&usb3_data_ss>;
					};
				};
			};
		};
	};

 

<> 는 cell 이라고 부르고

[링크 : https://kernel.bz/boardPost/118684/3]

 

unsigned int로 된 배열인것 같은데

  • 텍스트 문자열 (널로 종료 됨)은 큰 따옴표로 표시됩니다.
    • string-property = "a string";
  • ‘셀’은 꺾쇠 괄호로 구분 된 32 비트 부호없는 정수입니다.
    • cell-property = <0xbeef 123 0xabcd1234>;
  • 이진 데이터는 대괄호로 구분됩니다.
    • binary-property = [0x01 0x23 0x45 0x67];
  • 다른 표현의 데이터는 쉼표를 사용하여 함께 연결할 수 있습니다.
    • mixed-property = "a string", [0x01 0x23 0x45 0x67], <0x12345678>;
  • 쉼표는 문자열 목록을 만드는 데에도 사용됩니다.
    • string-list = "red fish", "blue fish";

[링크 : https://jung-max.github.io/2019/10/22/Device_Tree_문법/]

 

도대체 저 매크로는 어떻게 dtb에서 인식을 하고 쓰는거지? 하고 찾아보니

아래의 경로에서 dt-bindings 라는 곳에서 정의가 되어있었다.

linux-master/scripts/dtc/include-prefixes/dt-bindings/usb

 

선언을 하도 여러군데서 하다보니 일반소스에서만 선언된 줄 알았는데..

#define PDO_FIXED(mv, ma, flags) \
    (PDO_TYPE(PDO_TYPE_FIXED) | (flags) | \
    PDO_FIXED_VOLT(mv) | PDO_FIXED_CURR(ma))

 

device tress binding 이라는 녀석이 또 추가 되었나 보다..

[링크 : https://docs.zephyrproject.org/latest/build/dts/bindings.html]

'Linux API > linux' 카테고리의 다른 글

usb hid, hidraw  (0) 2024.03.11
linux 멀티터치 프로토콜  (0) 2024.03.08
btrfs CoW  (0) 2024.02.15
statvfs() 의 f_bavail과 f_bfree 차이  (0) 2024.02.15
corrupted size vs. prev_size 에러.. part2  (0) 2023.12.15
Posted by 구차니
회사일/USB PD2024. 12. 4. 11:50

PDO 쪽으로 검색해서 발견했는데

[링크 : https://chromium.googlesource.com/chromiumos/platform/ec/+/firmware-twinkie-9628.B/include/usb_pd.h]

 

드라이버는 이쪽 인 것 같고

[링크 : https://github.com/torvalds/linux/tree/master/drivers/usb/typec]

 

헤더는 이쪽인 것 같다.

/* PDO: Power Data Object */
#define PDO_MAX_OBJECTS 7

enum pd_pdo_type {
PDO_TYPE_FIXED = 0,
PDO_TYPE_BATT = 1,
PDO_TYPE_VAR = 2,
PDO_TYPE_APDO = 3,
};

#define PDO_TYPE_SHIFT 30
#define PDO_TYPE_MASK 0x3

#define PDO_TYPE(t) ((t) << PDO_TYPE_SHIFT)

#define PDO_VOLT_MASK 0x3ff
#define PDO_CURR_MASK 0x3ff
#define PDO_PWR_MASK 0x3ff

#define PDO_FIXED_DUAL_ROLE BIT(29) /* Power role swap supported */
#define PDO_FIXED_SUSPEND BIT(28) /* USB Suspend supported (Source) */
#define PDO_FIXED_HIGHER_CAP BIT(28) /* Requires more than vSafe5V (Sink) */
#define PDO_FIXED_EXTPOWER BIT(27) /* Externally powered */
#define PDO_FIXED_USB_COMM BIT(26) /* USB communications capable */
#define PDO_FIXED_DATA_SWAP BIT(25) /* Data role swap supported */
#define PDO_FIXED_UNCHUNK_EXT BIT(24) /* Unchunked Extended Message supported (Source) */
#define PDO_FIXED_FRS_CURR_MASK (BIT(24) | BIT(23)) /* FR_Swap Current (Sink) */
#define PDO_FIXED_FRS_CURR_SHIFT 23
#define PDO_FIXED_PEAK_CURR_SHIFT 20
#define PDO_FIXED_VOLT_SHIFT 10 /* 50mV units */
#define PDO_FIXED_CURR_SHIFT 0 /* 10mA units */

#define PDO_FIXED_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_FIXED_VOLT_SHIFT)
#define PDO_FIXED_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_FIXED_CURR_SHIFT)

#define PDO_FIXED(mv, ma, flags) \
(PDO_TYPE(PDO_TYPE_FIXED) | (flags) | \
 PDO_FIXED_VOLT(mv) | PDO_FIXED_CURR(ma))

#define VSAFE5V 5000 /* mv units */

#define PDO_BATT_MAX_VOLT_SHIFT 20 /* 50mV units */
#define PDO_BATT_MIN_VOLT_SHIFT 10 /* 50mV units */
#define PDO_BATT_MAX_PWR_SHIFT 0 /* 250mW units */

#define PDO_BATT_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MIN_VOLT_SHIFT)
#define PDO_BATT_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_BATT_MAX_VOLT_SHIFT)
#define PDO_BATT_MAX_POWER(mw) ((((mw) / 250) & PDO_PWR_MASK) << PDO_BATT_MAX_PWR_SHIFT)

#define PDO_BATT(min_mv, max_mv, max_mw) \
(PDO_TYPE(PDO_TYPE_BATT) | PDO_BATT_MIN_VOLT(min_mv) | \
 PDO_BATT_MAX_VOLT(max_mv) | PDO_BATT_MAX_POWER(max_mw))

#define PDO_VAR_MAX_VOLT_SHIFT 20 /* 50mV units */
#define PDO_VAR_MIN_VOLT_SHIFT 10 /* 50mV units */
#define PDO_VAR_MAX_CURR_SHIFT 0 /* 10mA units */

#define PDO_VAR_MIN_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MIN_VOLT_SHIFT)
#define PDO_VAR_MAX_VOLT(mv) ((((mv) / 50) & PDO_VOLT_MASK) << PDO_VAR_MAX_VOLT_SHIFT)
#define PDO_VAR_MAX_CURR(ma) ((((ma) / 10) & PDO_CURR_MASK) << PDO_VAR_MAX_CURR_SHIFT)

#define PDO_VAR(min_mv, max_mv, max_ma) \
(PDO_TYPE(PDO_TYPE_VAR) | PDO_VAR_MIN_VOLT(min_mv) | \
 PDO_VAR_MAX_VOLT(max_mv) | PDO_VAR_MAX_CURR(max_ma))

enum pd_apdo_type {
APDO_TYPE_PPS = 0,
};

#define PDO_APDO_TYPE_SHIFT 28 /* Only valid value currently is 0x0 - PPS */
#define PDO_APDO_TYPE_MASK 0x3

#define PDO_APDO_TYPE(t) ((t) << PDO_APDO_TYPE_SHIFT)

#define PDO_PPS_APDO_MAX_VOLT_SHIFT 17 /* 100mV units */
#define PDO_PPS_APDO_MIN_VOLT_SHIFT 8 /* 100mV units */
#define PDO_PPS_APDO_MAX_CURR_SHIFT 0 /* 50mA units */

#define PDO_PPS_APDO_VOLT_MASK 0xff
#define PDO_PPS_APDO_CURR_MASK 0x7f

#define PDO_PPS_APDO_MIN_VOLT(mv) \
((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MIN_VOLT_SHIFT)
#define PDO_PPS_APDO_MAX_VOLT(mv) \
((((mv) / 100) & PDO_PPS_APDO_VOLT_MASK) << PDO_PPS_APDO_MAX_VOLT_SHIFT)
#define PDO_PPS_APDO_MAX_CURR(ma) \
((((ma) / 50) & PDO_PPS_APDO_CURR_MASK) << PDO_PPS_APDO_MAX_CURR_SHIFT)

#define PDO_PPS_APDO(min_mv, max_mv, max_ma) \
(PDO_TYPE(PDO_TYPE_APDO) | PDO_APDO_TYPE(APDO_TYPE_PPS) | \
PDO_PPS_APDO_MIN_VOLT(min_mv) | PDO_PPS_APDO_MAX_VOLT(max_mv) | \
PDO_PPS_APDO_MAX_CURR(max_ma))


/* RDO: Request Data Object */
#define RDO_OBJ_POS_SHIFT 28
#define RDO_OBJ_POS_MASK 0x7
#define RDO_GIVE_BACK BIT(27) /* Supports reduced operating current */
#define RDO_CAP_MISMATCH BIT(26) /* Not satisfied by source caps */
#define RDO_USB_COMM BIT(25) /* USB communications capable */
#define RDO_NO_SUSPEND BIT(24) /* USB Suspend not supported */

#define RDO_PWR_MASK 0x3ff
#define RDO_CURR_MASK 0x3ff

#define RDO_FIXED_OP_CURR_SHIFT 10
#define RDO_FIXED_MAX_CURR_SHIFT 0

#define RDO_OBJ(idx) (((idx) & RDO_OBJ_POS_MASK) << RDO_OBJ_POS_SHIFT)

#define PDO_FIXED_OP_CURR(ma) ((((ma) / 10) & RDO_CURR_MASK) << RDO_FIXED_OP_CURR_SHIFT)
#define PDO_FIXED_MAX_CURR(ma) ((((ma) / 10) & RDO_CURR_MASK) << RDO_FIXED_MAX_CURR_SHIFT)

#define RDO_FIXED(idx, op_ma, max_ma, flags) \
(RDO_OBJ(idx) | (flags) | \
 PDO_FIXED_OP_CURR(op_ma) | PDO_FIXED_MAX_CURR(max_ma))

#define RDO_BATT_OP_PWR_SHIFT 10 /* 250mW units */
#define RDO_BATT_MAX_PWR_SHIFT 0 /* 250mW units */

#define RDO_BATT_OP_PWR(mw) ((((mw) / 250) & RDO_PWR_MASK) << RDO_BATT_OP_PWR_SHIFT)
#define RDO_BATT_MAX_PWR(mw) ((((mw) / 250) & RDO_PWR_MASK) << RDO_BATT_MAX_PWR_SHIFT)

#define RDO_BATT(idx, op_mw, max_mw, flags) \
(RDO_OBJ(idx) | (flags) | \
 RDO_BATT_OP_PWR(op_mw) | RDO_BATT_MAX_PWR(max_mw))

#define RDO_PROG_VOLT_MASK 0x7ff
#define RDO_PROG_CURR_MASK 0x7f

#define RDO_PROG_VOLT_SHIFT 9
#define RDO_PROG_CURR_SHIFT 0

#define RDO_PROG_VOLT_MV_STEP 20
#define RDO_PROG_CURR_MA_STEP 50

#define PDO_PROG_OUT_VOLT(mv) \
((((mv) / RDO_PROG_VOLT_MV_STEP) & RDO_PROG_VOLT_MASK) << RDO_PROG_VOLT_SHIFT)
#define PDO_PROG_OP_CURR(ma) \
((((ma) / RDO_PROG_CURR_MA_STEP) & RDO_PROG_CURR_MASK) << RDO_PROG_CURR_SHIFT)

#define RDO_PROG(idx, out_mv, op_ma, flags) \
(RDO_OBJ(idx) | (flags) | \
 PDO_PROG_OUT_VOLT(out_mv) | PDO_PROG_OP_CURR(op_ma))

[링크 : https://github.com/torvalds/linux/blob/master/include/linux/usb/pd.h]

'회사일 > USB PD' 카테고리의 다른 글

i.mx8 evk uboot usb pd 메시지  (0) 2024.12.05
USB PD 용어 정리중  (0) 2024.12.03
USB PD SOP*?  (0) 2024.12.03
USB-C PTN5110 케이블 방향에 따른 데이터 차이  (0) 2024.11.27
USB PD - DRP?  (0) 2024.11.25
Posted by 구차니

계엄령 경고했던 김민석 “尹, 오더만 내리면 계엄 완성이라 생각했을 것”

[링크 : https://v.daum.net/v/20241204085934850]

'개소리 왈왈 > 정치관련 신세한탄' 카테고리의 다른 글

대통령 출국금지...?!  (1) 2024.12.09
집단의 사이코패스...?  (0) 2024.12.08
비상 계엄 선포?  (0) 2024.12.03
니들이 무급으로 가덩가  (2) 2024.09.25
태극기 뒤집기에 기미가요라..  (2) 2024.08.15
Posted by 구차니