간단요약.

COM3의 경우 윈도우에서 시리얼 마우스로 자동 탐지를 하는데

USB to RS232 등을 COM3로 사용시

M이나 B를 인식하면서 마우스 클릭하거나 이상하게 이동하는 문제가 발생을 한다.


시리얼 마우스 서비스를 종료하거나

해당 포트를 열거하지 않도록 함으로서 해결 가능


[링크 : http://stackoverflow.com/questions/9226082/device-misdetected-as-serial-mouse]

[링크 : http://www.taltech.com/support/entry/windows_2000_nt_serial_mice_and_missing_com_port]

[링크 : http://www.sealevel.com/.../How-to-fix-crazy-mouse-syndrome-with-USB-serial-adapters.html]

'모종의 음모 > Win32 시리얼' 카테고리의 다른 글

MFC 시리얼 포트 관련  (0) 2017.05.17
mfc readfile timeout 설정  (0) 2017.04.06
mfc win32 시리얼  (0) 2017.04.05
시리얼 baudrate 목록  (0) 2017.04.05
win32 시리얼 포트 목록 얻기  (0) 2017.04.05
Posted by 구차니

테스트 필요


[링크 : https://www.joinc.co.kr/w/man/4200/ReadFile]

[링크 : http://stackoverflow.com/questions/4063051/possible-to-have-a-timeout-on-readfile]

[링크 : https://msdn.microsoft.com/en-us/library/windows/desktop/bb540534(v=vs.85).aspx]



+

2017.04.12

timeout은 overlapped io를 설정해야만 활성화 되는건가?

[링크 : http://wwwi.tistory.com/215]

[링크 : http://goodjian.tistory.com/entry/시리얼-통신COM-포트에-읽기-쓰기-할때-타임아웃을-설정하자]

[링크 : http://jurang5.tistory.com/entry/시리얼-통신]

[링크 : https://msdn.microsoft.com/en-us/library/windows/desktop/aa363437(v=vs.85).aspx]


+

음.. overlap 설정안해줘도 COMMTIMEOUTS 에서 적절한 값(?)을 해주니 문제없네..

115200bps에서 

commto.ReadIntervalTimeout = 50;

commto.ReadTotalTimeoutConstant = 50;

commto.ReadTotalTimeoutMultiplier = 10;

commto.WriteTotalTimeoutConstant = 50;

commto.WriteTotalTimeoutMultiplier = 10; 

로 설정해 주니 적당히 되는 듯

[링크  : http://blog.daum.net/pg365/51]




+

2017.04.19

115200bps 에서 이렇게 설정해도 문제가 없네.. 응답이 빨라서 가능한건가?

commto.ReadIntervalTimeout = 5;

commto.ReadTotalTimeoutConstant = 5;

commto.ReadTotalTimeoutMultiplier = 10;

commto.WriteTotalTimeoutConstant = 50;

commto.WriteTotalTimeoutMultiplier = 10; 


Posted by 구차니

귀찮아서 대충 구현했는데..

char 배열을 써야지 CString::GetBuffer(n) 으로 버퍼를 받아오니 이상해지네..


설정은 좀더 찾아 봐야겠지만, 자동으로timeout 걸리면서 최대 20자 까지 읽도록 설정이 된 것 같다.


{

CString port;

port = _T("\\\\.\\") + port;

HANDLE m_hCommPort = ::CreateFile(port, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0/*FILE_FLAG_OVERLAPPED*/, 0);


DCB dcb = {0};

dcb.DCBlength = sizeof(DCB);


if (!::GetCommState (m_hCommPort,&dcb))

{

TRACE ("CSerialCommHelper : Failed to Get Comm State Reason: %d",

  GetLastError());

return E_FAIL;

}

dcb.BaudRate    = 115200

dcb.ByteSize    = 8;

dcb.Parity      = 0;

dcb.StopBits    = ONESTOPBIT;

if (!::SetCommState (m_hCommPort,&dcb))

{

ASSERT(0);

TRACE ( "CSerialCommHelper : Failed to Set Comm State Reason: %d",

GetLastError());

return E_FAIL;

}


CString hex_query="ffeeddccbbaa00";

DWORD iolen;

int iRet = WriteFile (m_hCommPort, hex_query, hex_query.GetLength(),&iolen ,NULL);


char temp[20];

int abRet = ReadFile(m_hCommPort, &temp ,20, &iolen, NULL) ;

temp[iolen] = '0x00';


CloseHandle(m_hCommPort);

return 0;



[링크 : http://blog.daum.net/chowood/8039404]

    [링크 : http://forum.falinux.com/zbxe/index.php?document_srl=572257]

    [링크 : http://forum.falinux.com/zbxe/index.php?document_srl=572404]

    [링크 : http://forum.falinux.com/zbxe/index.php?document_srl=572588]

    [링크 : http://forum.falinux.com/zbxe/index.php?document_srl=572862]

[링크 : https://www.codeproject.com/Articles/2682/Serial-Communication-in-Windows]

Posted by 구차니

1200 미만으로는 생소하고...

56000이냐 57600이냐는 좀 헷갈리네..

아무튼 가끔 쓸데 있으니 일단 링크!


Standard baud rates supported by most serial ports:
 
  • 110
  • 300
  •  
  • 600
  • 1200
  •  
  • 2400
  • 4800
  •  
  • 9600
  • 14400
  •  
  • 19200
  • 28800
  •  
  • 38400
  • 56000
  •  
  • 57600
  • 115200


  • Standard baud rates supported by some serial ports:
     
  • 128000
  • 153600
  •  
  • 230400
  • 256000
  •  
  • 460800
  • 921600


  • [링크 : http://digital.ni.com/public.nsf/allkb/D37754FFA24F7C3F86256706005B9BE7]

    Posted by 구차니

    c#이나 .net framework을 쓰면 간편한데

    win32로는 영 복잡할수 밖에 없는 듯?


    그런데 QueryDosDevice()를 쓰면 0ms 라는데

    1. CreateFile("COM" + 1->255) as suggested by Wael Dalloul
      ✔ Found com0com ports, took 234ms.

    2. QueryDosDevice()
      ✔ Found com0com ports, took 0ms.

    3. GetDefaultCommConfig("COM" + 1->255)
      ✔ Found com0com ports, took 235ms.

    4. "SetupAPI1" using calls to SETUPAPI.DLL
      ✔ Found com0com ports, also reported "friendly names", took 15ms.

    5. "SetupAPI2" using calls to SETUPAPI.DLL
      ✘ Did not find com0com ports, reported "friendly names", took 32ms.

    6. EnumPorts()
      ✘ Reported some non-COM ports, did not find com0com ports, took 15ms.

    7. Using WMI calls
      ✔ Found com0com ports, also reported "friendly names", took 47ms.

    8. COM Database using calls to MSPORTS.DLL
      ✔/✘ Reported some non-COM ports, found com0com ports, took 16ms.

    9. Iterate over registry key HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM
      ✔ Found com0com ports, took 0ms. This is apparently what SysInternals PortMon uses.

    [링크 : http://stackoverflow.com/.../how-do-i-get-a-list-of-available-serial-ports-in-win32]


    m_MyPort 변수만 다른걸로 바꿔써주면 잘 작동 하는 듯

    단, unicode 기반에서는 (LPSTR)대신 (LPWSTR)로 해주어야 에러가 나지 않는다.

    void SelectComPort() //added function to find the present serial 
    {
    
        TCHAR lpTargetPath[5000]; // buffer to store the path of the COMPORTS
        DWORD test;
        bool gotPort=0; // in case the port is not found
    
        for(int i=0; i<255; i++) // checking ports from COM0 to COM255
        {
            CString str;
            str.Format(_T("%d"),i);
            CString ComName=CString("COM") + CString(str); // converting to COM0, COM1, COM2
    
            test = QueryDosDevice(ComName, (LPSTR)lpTargetPath, 5000);
    
                // Test the return value and error if any
            if(test!=0) //QueryDosDevice returns zero if it didn't find an object
            {
                m_MyPort.AddString((CString)ComName); // add to the ComboBox
                gotPort=1; // found port
            }
    
            if(::GetLastError()==ERROR_INSUFFICIENT_BUFFER)
            {
                lpTargetPath[10000]; // in case the buffer got filled, increase size of the buffer.
                continue;
            }
    
        }
    
        if(!gotPort) // if not port
        m_MyPort.AddString((CString)"No Active Ports Found"); // to display error message incase no ports found
    
    }


    [링크 : http://stackoverflow.com/.../what-is-proper-way-to-detect-all-available-serial-ports-on-windows]

    Posted by 구차니

    시리얼포트 10번 이후 열기라는 글이 있어서 보니


    버그가 있어서 COM9 까진 그냥 여는데, 그 이후에는

    \\.\COM%d 식으로 표현을 해야 하는데 escape 문자를 넣어주어야 하니 이렇게 미친듯이 길어진다.


    hPort = CreateFile("\\\\.\\COM10", GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0); 

    [링크 : http://stackoverflow.com/questions/11775185/open-a-com-port-in-c-with-number-higher-that-9]

    Posted by 구차니

    많이 쓰는게 N-8-1 이니까

    1byte 전송에 10bit를 주로 쓰니까 일단 둘다 계산



    많이 사용되는(?) 비트레이트 저장

    [링크 : http://www.cermetek.com/Catalog/High-Speed-Modems/DataSheet/...CH1794_607-0003/]

    Posted by 구차니
    모종의 음모/CAN2015. 1. 23. 08:48

    dominant - logical 0 / actively driven to a voltage

    recessive - logical 1/ passively return


    왜이리 어려운 단어를 썼나 했더니

    전기적으로 신호를 설계해서

    0과 1이 충돌되면 0이 우세(우성)하게 판결되어 1을 씹어먹는다.

    그래서 0 이 우선권을 가지고 데이터를 전송하여 "실시간 전송" 성격에 적합하다는 말씀(?)


    CAN data transmission uses a lossless bit-wise arbitration method of contention resolution. This arbitration method requires all nodes on the CAN network to be synchronized to sample every bit on the CAN network at the same time. This is why some call CAN synchronous. Unfortunately the term synchronous is imprecise since the data is transmitted without a clock signal in an asynchronous format.
    The CAN specifications use the terms "dominant" bits and "recessive" bits where dominant is a logical 0 (actively driven to a voltage by the transmitter) and recessive is a logical 1 (passively returned to a voltage by a resistor). The idle state is represented by the recessive level (Logical 1). If one node transmits a dominant bit and another node transmits a recessive bit then there is a collision and the dominant bit "wins". The means there is no delay to the higher priority message, and the node transmitting the lower priority message automatically attempts to re-transmit six bit clocks after the end of the dominant message. This makes CAN very suitable as a real time prioritized communications system.

    [링크 : http://en.wikipedia.org/wiki/CAN_bus#Data_transmission]


    dominant / 우성의

    [링크 : http://endic.naver.com/enkrEntry.nhn?sLn=kr&entryId=7371ab1c34a84fab8bc699af491763d4&query=dominant]


    recessive / 열성의

    [링크 : http://endic.naver.com/enkrEntry.nhn?sLn=kr&entryId=087f00309f264a60ab6d787e5792a02a&query=recessive]

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

    can-utils(cansend, candump)  (0) 2025.02.18
    can invader  (0) 2024.01.09
    CAN(controller area network)  (0) 2023.10.31
    MCP2515 on rpi  (0) 2023.10.31
    mcp2515 can  (0) 2023.10.30
    Posted by 구차니
    모종의 음모/mp3 분석2014. 10. 1. 16:36
    음.. 크게와 닫지 않는데.. ADPCM 같은 느낌?

    과거에는 확실하게 디코더가 작동하지 않아 문제가 되었지만
    요즘에는 디코더가 좋아져서 문제없이 작동하기에 동일 bitrate일 경우 음질이 더 좋아진다고 한다.
    일단 frame 단위로 설정이 되므로 mp3 내에서도 프레임 단위로 M/S stereo 와 Joint Stereo를 오갈수 있는 듯

    M/S (Mid/Main - Side)
    [링크 : http://www.sounddevices.com/notes/general/ms-stereo-basics/]


    한정대역에서 고품질 오디오 서비스를 위한 코딩 방식의 일종. 
    스테레오 처럼 무조건 좌우측 신호를 나누어 기록하는 것이 아니고 좌우축 신호에서 공통되는 신호는 1가지만 기록하며 좌우측에는 각각 다른 신호만을 기록하므로 스테레오와 비교하면 남는 공간에 데이터를 더 기록할 수 있어 음질을 향상시킬 수 있는 방식이다. MP3나 DAB방송에서 한정된 대역으로 고음질 서비스를 위해 사용된다.
     
    [링크 : http://word.tta.or.kr/terms/termsView.jsp?gubun=1&terms_num=28873

    [링크 : http://en.wikipedia.org/wiki/Joint_(audio_engineering)]
    [링크 : http://ko.goldenears.net/board/1160186]
    [링크 : http://www.clien.net/cs2/bbs/board.php?bo_table=cm_mac&wr_id=384226&page=

    '모종의 음모 > mp3 분석' 카테고리의 다른 글

    mp3 id3 태그 내의 jpeg 추출  (0) 2014.10.01
    mp3 format  (0) 2014.10.01
    bitrate / sampling rate / mp3 / 등등등...  (0) 2014.09.16
    Posted by 구차니
    모종의 음모/mp3 분석2014. 10. 1. 16:27
    mp3 파일을 들여다 보다 보니.. JFIF 라는 문구 발견
    심심해서 적당하게 잘라내 보니 된다.

    일단 시작 지점은 JFIF 앞 6바이트 부터
    mp3 헤더인 FFFB... 이전 0x00 부분을 제외한(패딩으로 생각되니)

    추출한 녀석은 320x320 인데 IDv3 에 표준 사이즈인지는 미지수



     

    '모종의 음모 > mp3 분석' 카테고리의 다른 글

    mp3 joint stereo  (0) 2014.10.01
    mp3 format  (0) 2014.10.01
    bitrate / sampling rate / mp3 / 등등등...  (0) 2014.09.16
    Posted by 구차니