[ABANDONED] J-Trace on Linux: SerialNumber wrong in Linux kernel

This site uses cookies. By continuing to browse this site, you are agreeing to our Cookie Policy.

  • [ABANDONED] J-Trace on Linux: SerialNumber wrong in Linux kernel

    I got a J-Trace Cortex unit, and using it on Linux.
    I don't know if this is / can be a problem as such (didn't get there yet ..), but I saw that when I plug it in, the kernel shows a wrong serial number for it.


    Mar 06 13:48:48 esembbox kernel: usb 2-1: new SuperSpeed USB device number 2 using xhci_hcd
    Mar 06 13:48:48 esembbox kernel: usb 2-1: New USB device found, idVendor=1366, idProduct=1020
    Mar 06 13:48:48 esembbox kernel: usb 2-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
    Mar 06 13:48:48 esembbox kernel: usb 2-1: Product: J-Trace PRO V2 Cortex
    Mar 06 13:48:48 esembbox kernel: usb 2-1: Manufacturer: SEGGER
    Mar 06 13:48:48 esembbox kernel: usb 2-1: SerialNumber: 004294967295

    That's 2^32 -1 , looks like .

    But the JLinkExe does identify correct number. May be it's not an issue ...
  • Hello,

    Thank you for your inquiry.
    We tried to replicate the setup with Debian and Ubuntu and the S/N was showing up correctly.
    Iirc you were using Fedora 27, we will try it there once again as well.

    That's 2^32 -1 , looks like .

    But the JLinkExe does identify correct number. May be it's not an issue ...

    Yes it seems like -1 which indicates an error when grabbing the S/N.
    JLinkExe gets the number from the debug probe directly, that is why it is showing up correctly.
    So for most J-Link compatible software this will cause no issues as they usually grab the S/N from the debug probe directly instead of relying on the information from the driver.
    However the USB device information should of course show up correctly as well.

    Could you provide us with the kernel log entry for the J-Trace PRO Cortex under /var/log ?
    Does it show there faulty as well?

    Edit:
    Attached is the kernel log when calling demsg var/log on a Fedora 27 VM.
    The S/N is showing up correctly.

    Best regards,
    Nino
    Images
    • Capture.PNG

      12.79 kB, 544×76, viewed 80 times
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support contact us per e-mail.
    The following contact form can be used for this: Contact Us

  • Which host controller are you using?

    Because, for J-Trace I use USB3 controller.

    >Could you provide us with the kernel log entry for the J-Trace PRO Cortex under /var/log ?

    Which file specifically? The extract I provided is the journal entry (journal -f ) , and the same information is reflected in /var/log/messages.

    I've re-tested now on updated Fedora kernel, still the same.

    Linux esembbox 4.15.6-300.fc27.x86_64 #1 SMP Mon Feb 26 18:43:03 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • Hello,

    Which host controller are you using?

    Because, for J-Trace I use USB3 controller.

    Same here. It is recognized as a super speed device:

    Source Code

    1. /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    2. |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 5000M



    Which file specifically? The extract I provided is the journal entry (journal -f ) , and the same information is reflected in /var/log/messages.

    I mean for example "dmesg var/log".
    There you will see a summary of last kernel log messages.

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support contact us per e-mail.
    The following contact form can be used for this: Contact Us

  • Hello,
    I mean for example "dmesg var/log".
    If you mean the output of "dmesg" command, and also /var/log/messages file, then this is what i provided, essentially.

    I'm looking at your output here
    " Bus 04.Port 1: Dev 1, Class=root_hub, Driver=xhci_hcd/4p, 5000M
    |__ Port 1: Dev 2, If 0, Class=Vendor Specific Class, Driver=, 5000M"

    Do you know which hw controller you use (you specify this in VM ware?), and which kernel driver? And which Fedora kernel you test with.

    I checked under /sys folder, that's where the "bad" serial number as kernel/driver reads it.
    So in my case, for e.g., this is under:
    cat /sys/devices/pci0000\:00/0000\:00\:0c.0/usb2/2-1/serial
    004294967295


    By tracing what JLinkExe does at the start up (snippet):
    ...

    lstat("/sys/devices/pci0000:00/0000:00:0c.0/usb2/2-1/serial", {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
    openat(AT_FDCWD, "/sys/devices/pci0000:00/0000:00:0c.0/usb2/2-1/serial", O_RDONLY|O_CLOEXEC) = 3
    fstat(3, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
    fstat(3, {st_mode=S_IFREG|0444, st_size=4096, ...}) = 0
    read(3, "004294967295\n", 4096) = 13
    read(3, "", 4096) = 0
    close(3) = 0
    .........

    Seems it does peek into same file but has other means to get the correct serial number, which it just writes out at the end of the startup, I didn't trace where it gets it.

    Do you know what JLink code does to get serial number?
    (Is there a check for -1 reported by kernel/driver and then it gets it directly from device .. ? )

    Anyway, as long as it doesnt' cause any issues with further using the JTrace under Linux, and my J-Trace Hw is all good .
  • Hello,

    If you mean the output of "dmesg" command, and also /var/log/messages file, then this is what i provided, essentially.

    Correct. Just wanted to clarify what output I was looking for.

    Do you know which hw controller you use (you specify this in VM ware?), and which kernel driver? And which Fedora kernel you test with.


    According to lsusb the controller is Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

    Kernel: 4.14.16-300.fc27.x86_64 #1 SMP Wed Jan 31 19:24:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

    Do you know what JLink code does to get serial number?

    Yes, It uses the J-Link SDK API like all our software tools and as far as we know all 3rd party tools do as well.
    So it is independent from the S/N that the driver shows.

    Anyway, as long as it doesnt' cause any issues with further using the JTrace under Linux, and my J-Trace Hw is all good .

    It won't cause any issues as no software we are aware of uses the driver S/N.
    So you should be good to go as is.

    Do you have some other Linux machine to test this against? e.g. some Ubuntu or Debian etc.?
    Does the S/N show up there wrongly as well?

    Best regards,
    Nino
    Please read the forum rules before posting: Forum Rules

    Keep in mind, this is not a support forum. Its main purpose is user to user interaction.
    Our engineers will try to answer your questions between their projects if possible but this can be delayed by longer periods of time.
    Should you be entitled to support contact us per e-mail.
    The following contact form can be used for this: Contact Us